aboutsummaryrefslogtreecommitdiff
path: root/js/tests/unit/button.js
AgeCommit message (Collapse)AuthorFilesLines
2021-09-15Remove unneeded conditionalXhmikosR1-5/+3
2021-09-15tests: comply to the new rulesXhmikosR1-63/+63
Use `assert.strictEqual`/`assert.true`/`assert.false`
2020-10-02buttons plugin : avoid multiple change event trigger (#31000)Laussel Loïc1-0/+26
- add unit test to count how many events are thrown when widget contains multiple tags inside label - add a parameter to toggle, if click event is provided onto an input then don't trigger another change event already thrown by the browser - simplify the case where toggle interface is called click provide from input itself OR it's a button without label. If label is present, then browser propagate click event from childrens through label and then cause multiple calls to toggle - the test assumes that `.btn` class is always set onto the label if there's one, otherwise need to update this plugin and look for label around the input Test with keyboard, mouse and js click call Co-authored-by: XhmikosR <[email protected]>
2020-06-10avoid preventing input event onclick (#30992)Laussel Loïc1-0/+40
* instead of stopping event if onclick is triggered on input, call toggle method only if its not on checkbox inside a label * add unit test * add a dedicated test to ensure click event is forward to label Co-authored-by: XhmikosR <[email protected]>
2020-03-16fix `$().button('toggle')` not working for checkbox inside label (#30388)Laussel Loïc1-1/+29
2019-07-10Ensure button plugin sets/removes active class correctly on page load (#28952)Patrick H. Lauke1-10/+70
* Ensure correct active class is set on button toggles/checkboxes/radios on page load Sanity check, ensures that the UI visually matches the actual values/states of controls. Also ensures that if any autocomplete/autofill happened, this is visually accounted for by having the correct class set. Includes unit tests (and `autocomplete` has been removed from these as it's no longer necessary) * Remove now unnecessary autocomplete attribute As the attribute was there to force/ensure that the visual presentation matched the state, and this is now taken care of programmatically, there's no need to unnecessarily suppress autocomplete...let them autocomplete if they want to...
2019-06-18Fix keyboard handling of button-style checkbox/radio button groups (#28834)Patrick H. Lauke1-28/+133
- adds more defensive checks to make sure no unnecessary toggling happens on disabled buttons; this also fixes an up-to-now undiscovered bug where a toggle button with `.disabled` class would still have its `aria-pressed` toggled - adds a set of explicit tests for the above case of disabled buttons and `aria-pressed` - remove a now irrelevant (or at least very nonsensical) test for `<label>` containing both an actionable and a `hidden` `<input>` - expand the test for disabled checkbox to also explicitly test starting conditions (used mainly in my debugging) - ensure that `$btn[0].click()` is used to click checkboxes in tests, rather than the `click()` on the jquery object which is simply a shorthand for `trigger('click')` and does not actually trigger the browser default behavior - remove the `preventDefault()` from the button handling, which was preventing correct keyboard functionality for checkboxes/radio buttons - add extra logic to the button.js code to handle checkboxes correctly and avoid double-triggering as a result of mouse interactions (which saw the checkboxes being toggled twice, thus returning them to their original state) - add logic that prevents the `checked` property from being added incorrectly for any inputs other than radio buttons and checkboxes - added more tests (including the most basic test for a properly triggered fake checkbox button) - work around Firefox bug #1540995 (which this code was hitting after removing the `preventDefault()`, due to Firefox's incorrect toggling of disabled checkboxes when programmatically (but not manually) activated with a `click()` event
2018-12-10Change button checkbox/radios to ignore hidden input fields (#27802)Mike Vastola1-0/+23
2018-05-22chore(deps): update qunit and karma-qunitJohann-S1-0/+1
2018-04-10v4 improve coverage (#25945)Johann-S1-0/+23
* Improve code coverage for our Button plugin * improve coverage for our Alert plugin * test tooltip update method * test update and dispose for dropdown * increase code coverage requirements
2018-01-11Comply to the new rules.XhmikosR1-27/+26
2017-11-07Fix test failure with jQuery 1.9.1 (#24706)XhmikosR1-1/+1
2017-08-23Tweak ESLint rules.XhmikosR1-1/+1
2017-04-26Fix Toggle buttons don't honor [disabled] or .disabledAnna1-0/+17
2017-04-10Only change aria-pressed if it's not an input-based radio or checkbox groupPatrick H. Lauke1-0/+18
* Only change aria-pressed if it's not an input-based radio or checkbox group aria-pressed="true"/aria-pressed="false" is really only useful for making on/off toggles out of, say, `<button>` elements. the attribute is useless (and potentially confusing/conflicting) on, say, `<label>` elements for an existing `<input type="radio">` or similar. * Add unit test for buttons.js and radio/checkbox inputs in button groups
2017-01-04Close #21090 - Fix aria-pressed attribute for buttons in container with ↵Johann-S1-0/+11
data-toggle='buttons'
2016-11-26Merge pull request #18900 from vlastikcz/v4-dev-buttonChangeMark Otto1-0/+20
Button toggling - trigger change event on input. Fixes #16673, fixes #17599.
2016-11-24Make JS compliant with the new ESLint rules.Bardi Harborow1-1/+1
2016-01-14Button toggling - trigger change event on inputKotas Vlastimil1-0/+20
Bootstrap’s .button styles can be applied to other elements, such as labels, to provide checkbox or radio style button toggling. When the checkbox or radio state is changed, there should be triggered the change event. Currently, the change event is triggered on the Button, which is not correct. Only input fields do support the change event.
2015-05-07button -> es6fat1-58/+0
2015-05-06remove closureness from pluginsfat1-53/+107
2015-02-11bootstrap onto closurefat1-55/+0
2015-01-20update JS unit tests to future-proof QUnit 1.16.0 APIChris Rebert1-13/+13
[skip validator]
2014-10-29Merge pull request #14457 from hnrch02/button-set-val-after-event-loopHeinrich Fenkart1-5/+5
Change value of stateful button after event loop
2014-10-22Add `aria-pressed` to single toggle buttonsPatrick H. Lauke1-1/+19
also includes tiny fix/clarification to two existing unit tests for the .active class, adding data-toggle=“button” explicitly to the tested buttons Closes #14819.
2014-08-26Change value of stateful button after event loopHeinrich Fenkart1-5/+5
Fixes #14450
2014-07-06Move to leading plusesHeinrich Fenkart1-11/+11
2014-07-06Clean button unit tests upHeinrich Fenkart1-78/+78
2014-06-06Comply to the new style.XhmikosR1-7/+8
2014-05-05Allow for resetText of a button to be a falsey value; fixes #13466Heinrich Fenkart1-0/+20
2014-04-21#11464 - Fix JS noConflict mode - Refactor all plugins to use an internal ↵Collin Donahue-Oponski1-12/+21
reference to the jQuery plugin, because in noConflict mode you can never expect to be defined on the jQuery object
2014-04-09JS: remove unused variables.XhmikosR1-1/+0
2014-02-14Re-indent test files.XhmikosR1-118/+118
2013-12-16Require comma on left sideZlatan Vasović1-5/+5
2013-12-08Use single quotes consistently.XhmikosR1-10/+10
2013-11-10Add unit test for #9920Nathan Muir1-0/+6
Merges #10385
2013-10-25QUnit.equals() is deprecated; use QUnit.equal() insteadChris Rebert1-5/+5
2013-07-26Replace Makefile with GruntJSJohn-Philip Johansson1-7/+8
A rebase (against soon-to-be 3.0.0-rc.1) & squash of https://github.com/twbs/bootstrap/pull/7786 AKA https://github.com/twitter/bootstrap/pull/7786 originally by @seriema @mokkabonna @jojohess Rebased by @cvrebert
2013-07-18cleaner way of preventing double click events + clean up tests for jshintfat1-12/+12
2013-07-18get button js working with actual form elements p coollfat1-10/+23
2013-05-16change namespace back to dot notation and someother js shizzlefat1-1/+1
2013-05-16a bunch javascript junkfat1-0/+102