1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-05 11:43:16 +00:00
TiddlyWiki5/core/modules/widgets
Robin Munn e28af8d594
Checkbox widget: list and filter modes (#6561)
* Docs for CheckboxWidget list and filter modes

This documents the `listField` and `filter` attributes.

* Tests for checkbox widget list mode

* Implement checkbox list mode

* WIP on implementing filter attr for checkboxes

* Improve CheckboxWidget documentation

* Refactor checkbox tests: move function to top

The big findNodeOfType function belongs at the top of the describe
block, so that the checkbox tests are more compact and easy to read.

* Move checkbox widget tests to end of file

The checkbox widget tests are long and involved, so we'll move them to
the end of the file so they aren't a huge block of code you need to read
past to find the next test.

* Improve formatting of CheckboxWidget docs

The \define() calls that are short enough to fit on one line should be
put on one line, for readability. The ones that are quite long have been
kept on multiple lines, for readability.

* Added more passing tests for checkbox widget

* Add some failing tests for checkbox widget

The filter mode where neither checked nor unchecked is specified (in
which case an empty filter result means false and a non-empty result
means true) is not working yet.

* Make failing tests pass

* Uncomment (and improve) test for field mode

We're now ready to start working on making this test pass. (There was
also one small mistake in the test, which this commit corrects).

* All tests now passing

* No indeterminate checkboxes in simple modes

The simple checkbox modes (field and index) should not produce
indeterminate checkboxes. That should be reserved for the advanced modes
(list and filter).

* Minor improvement to unit tests

* Allow indeterminate checkboxes in list and filter modes

This change may require some tweaks to the unit tests to be able to test
it properly.

* Slightly easier to read tests

* Two more tests for list mode

* Greatly simplify unit test code

Turns out there's no need to jump through Object.getPrototypeOf hoops.

* Minor simplification of unit test

* Add tests for indeterminate in list & filter modes

With this, the set of tests is complete.

* More tests to specify list mode behavior

* Unfocus tests so all tests run

* Update docs to say "new in 5.2.3" insetad of 5.2.2

* Move checkbox widget tests into their own file

The test-widget.js file was getting too long with all the checkbox
tests added, so we'll move the checkbox tests into their own file.

* Add checkbox widget tests for index mode

This commit also adds tests for index list mode (with a listIndex
attribute that will parallel the listField attribute) but leaves them
commented out because they don't pass yet: the code that implements the
listIndex attribute hasn't been written yet).

* Add listIndex attribute to checkbox widget

* Remove code that lets checkboxes be indeterminate

This reverts commit 6afcb151be. We will
add this code back in a later PR.

* Remove indeterminate tests for checkbox widget

We're currently not allowing indeterminate checkboxes, so there's no
need for the tests that check for them.

* Document listIndex attribute of CheckboxWidget

* adds class tc-checkbox-checked when checked

* equivalent to #2182 (RadioWidget)
* also applies `tc-checkbox` to checkboxes by default, always

* Move macro definitions inside example text

Since the wikitext-example-without-html macro creates a new parsing
context, it's safe to have macro definitions inside it. That makes these
examples a lot easier to write, and to read.

* Remove all mention of indeterminate checkboxes

Also improve the documentation a little bit: mention what happens in
list mode if neither checked nor unchecked is specified.

* Move filter mode to bottom of checkbox docs

The `filter` attribute should be under both `listField` and `listIndex`
rather than being between them. The documentation for filter mode should
similarly be after the `listIndex` documentation.

* Improve docs for `class` attr of checkbox widget

This brings the wording of the `class` attribute more in line with how
it's worded in the RadioWidget docs.

* Fix bug with list tiddlers

If neither checked nor unchecked was specified, then the behavior should
be "empty = false, non-empty = true". But if *both* are specified yet
neither is found, then the checkbox should be unchecked (false). It had
been falling through to the "non-empty = true" behavior, which was wrong.

* Improve listIndex example of checkbox widgets

* Remove unused function from test-widget.js

Co-authored-by: Tobias Beer <beertobias@gmail.com>
2022-04-02 15:16:08 +01:00
..
action-confirm.js Fix(action-confirm): check if event is defined before accessing its properties (#6063) 2021-09-22 13:43:02 +01:00
action-createtiddler.js Action-createtiddler: Ensure child widgets are refreshed before invocation 2021-06-14 18:13:51 +01:00
action-deletefield.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
action-deletetiddler.js More action-deletetiddler fixes 2014-11-09 16:53:33 +00:00
action-listops.js Remove erroneously included code 2022-03-18 12:40:12 +00:00
action-log.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
action-navigate.js tm-navigate: add separate properties to access bounds of client rectangle 2021-07-05 09:52:17 +01:00
action-popup.js Extend <-popup> to create floating popups that must be manually cleared (#5655) 2021-05-02 10:20:39 +01:00
action-sendmessage.js Fix typo in d5f72cb282 2021-10-28 09:18:54 +01:00
action-setfield.js Revert "Merge pull request #2166 from matabele/patch-5" 2016-01-06 09:38:39 +00:00
action-setmultiplefields.js Set multiple fields/variables/params using filters (#6130) 2021-10-27 11:20:11 +01:00
browse.js BrowseWidget: Add "accepts" attribute 2020-04-21 22:18:34 +01:00
button.js Fix the button default fix (#6531) 2022-03-16 11:57:56 +00:00
checkbox.js Checkbox widget: list and filter modes (#6561) 2022-04-02 15:16:08 +01:00
codeblock.js Fix refreshing of codeblock widget 2021-11-05 08:28:56 +00:00
count.js Fix count widget to return "0" for an empty filter string instead of undefined 2020-04-09 11:04:50 +01:00
diff-text.js Improve diff count for diff-text widget 2018-04-03 17:50:17 +01:00
draggable.js Extend $draggable to support an optional drag handle (#6480) 2022-02-24 11:06:18 +00:00
droppable.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
dropzone.js Fix: issues with drag and drop in Chrome 96 (#6261) 2021-11-21 20:48:16 +00:00
edit-binary.js Add download button/link to binary tiddler warning banners in view and edit mode (#4423) 2020-01-31 09:13:28 +00:00
edit-bitmap.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
edit-shortcut.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
edit-text.js Introduce text editor toolbar (#2315) 2016-04-22 08:36:29 +01:00
edit.js Add "autocomplete" attribute to <$edit> and <$edit-text> widgets 2020-11-30 18:48:04 +00:00
element.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
encrypt.js Refactor wiki.filterTiddlers() 2014-04-27 20:03:33 +01:00
entity.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
eventcatcher.js Eventcatcher widget: add "matchSelector" attribute (#6523) 2022-03-14 09:56:23 +00:00
fieldmangler.js Add support for JSON-formatted tiddler store, and make it the default (#5708) 2021-07-14 09:15:30 +01:00
fields.js Add new parameters to fields-widget and fields-operator. (#4433) 2020-04-15 12:36:48 +01:00
image.js Image widget: Add classes for loading/loaded/error 2022-01-02 17:28:54 +00:00
importvariables.js Fix: bug with importvariables widget when importing block mode widgets. fixes #6424 (#6426) 2022-01-27 17:35:18 +00:00
jsontiddler.js Fix bug with innerwiki template 2021-10-02 16:17:07 +01:00
keyboard.js Keyboard widget: provide variable for shortcut descriptor to actions. (#5782) 2021-06-14 12:03:59 +01:00
let.js Add $let widget (#6148) 2021-10-30 11:42:22 +01:00
link.js Update link-widget refresh method (#6013) 2021-10-27 11:37:08 +01:00
linkcatcher.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
list.js feat: add support for renderEnd method for storyviews in widget's render() method (#6409) 2022-01-19 19:48:02 +00:00
log.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
macrocall.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
messagecatcher.js MessageCatcher: Fix stack overflow when re-issuing a trapped message 2021-09-20 16:46:26 +01:00
navigator.js Introduce JSON parse utility function with error handling (#6401) 2022-02-21 15:29:25 +00:00
password.js Fix default password 2013-11-10 19:22:10 +00:00
qualify.js Change qualify widget parameter name to match qualify macro 2018-11-06 16:41:18 +00:00
radio.js Radio widget should use default if field/index is missing 2022-01-09 17:17:12 +00:00
range.js Add actions parameter to range-widget + docs! (#5158) 2020-12-01 18:11:09 +00:00
raw.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
reveal.js Reveal widget: fix crash when popup tiddler is refreshed but the popup is not displayed 2021-08-04 17:00:42 +01:00
scrollable.js Revert scrollable changes e49dda3b48 2022-03-29 09:49:31 +01:00
select.js Fix refreshing of select widget when attributes change (#5635) 2021-04-25 16:05:02 +01:00
setmultiplevariables.js Set multiple fields/variables/params using filters (#6130) 2021-10-27 11:20:11 +01:00
setvariable.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
text.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
tiddler.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
transclude.js Revert "Revert "Transclude widget: refresh selectively when needed (#5736)"" 2021-06-02 21:45:06 +01:00
vars.js Add $let widget (#6148) 2021-10-30 11:42:22 +01:00
view.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
widget.js Add support for directly setting style.* attributes on HTML elements (#6388) 2022-02-21 15:24:06 +00:00
wikify.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00