* Add data attribute support to button widget
* Fix typo
* Refactor ready for making mechanism more generic
* Apply more generic implementation to multiplate widgets
* Refactor to use existing widget.assignAttributes() method
* Fix typo
* Clarify docs
* Update docs
* Update select widget to support style.* attributes
* Remove obsolete comment
* Fixes refresh issues for checkbox and links widgets for data attributes (#7846)
* fix: refresh issues with checkbox and links widgets
* fix: indenting
* Feat: add support for data attributes to Draggable and Droppable widgets (#7845)
* Docs clarification
* docs: add style and data attributes to Draggable and Droppable widget docs (#7850)
* Refactors Select widget to directly create DOM node (#7848)
* fix: refactored SelectWidget to directly create DOM nodes
* fix: refactored SelectWidget to directly create DOM nodes
* fix: improve refresh handling for select widget
* Fixes issues in the PR "Button widget data attributes" (#7852)
* fix: fixed ordered attributes handling and improved tests to catch event attributes
* fix: clean up code from testing
* fix: more tests and refactoring
* fix: use lowercase when checking for event attribute prefix
* fix: use lowercase when checking for event attribute prefix
* fix: changed comment wording
* fix: minor refactoring
* refactor: for brevity
---------
Co-authored-by: Saq Imtiaz <saq.imtiaz@gmail.com>
* Restructure and optimize `CheckboxWidget` docs
* Minor improvements
* Use new tab macros and some reformatting
* Fix bug in widget-attr-link tooltip
* Minor layout tweaks
* First try at a Widget Documentation Style Guide
* Add new tabs-related macros to overview
* Update CSS, add tm-scroll and rename macros
* Avoid RSoE with tm-scroll, improve CSS for tab-links
* Handle doc-tab-links within tab tiddlers better
* Reflect macro name changes in their docs
* Update Widget Doc Style Guide
* Documentation for indeterminate checkboxes
* Unit tests for indeterminate checkboxes
* Implement indeterminate checkboxes
* Simplify indeterminate checkbox example
* Slightly simplify refresh logic for indeterminate
That five-line if statement can be turned into a simple assignment.
* Use "yes" and "no" for checkbox indeterminate attr
This makes the "indeterminate" attribute of the checkbox widget work the
same way as other boolean attributes of other widgets.
* Fix bug with invertTag attribute
One place in the checkbox widget code was checking invertTag for
Javascript truthiness rather than the value "yes", which could have
produced incorrect results if anyone wrote invertTag="no". Fixed.
* 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>
See discussion at https://groups.google.com/d/msgid/tiddlywiki/526754d5-8786-49cd-aaa1-c77311670116%40googlegroups.com:
The history here is that in v5.1.14 we added an "actions" attribute to the checkbox widget that specified an action string to be specified whenever the state of the checkbox changed. The same action string is executed regardless of whether the checkbox was checked or unchecked.
Then in v5.1.16 we merged https://github.com/Jermolene/TiddlyWiki5/pull/3182 which added the "uncheckactions" attribute. The difference between the two is that the uncheckactions are only executed if the checkbox is unchecked. The main "actions" attribute is executed before any actions in "uncheckactions", which makes it possible to arrange things so that the "actions" attribute sets things to the checked state while the "uncheckactions" attribute overwrites those changes to set things to the unchecked state.
In retrospect, it would have made more sense to have also added a "checkactions" attribute that was executed only if the checkbox was checked. I'll investigate adding it for v5.1.20.