1
0
mirror of synced 2024-11-22 13:06:08 +03:00
select2/tests
Kevin Brown bd7ac9df03
Results respect disabled state of <option> (#5560)
This check is in place in most other places, mostly because we have
run into widespread issues under similar circumstances and we like to
avoid those, but it was forgotten here. There also were no tests
covering this, so it was never caught.

This adds tests that ensure that the option in the results list will
be generated with the correct "disabled" state based on whether or
not it, or a parent element, is marked as disabled.

This should have been easy: just check `element.disabled`

Unfortunately the `disabled` property is not inherited within the
option chain, so if an `<optgroup>` is disabled, the `<option>`
elements or other `<optgroup>` elements held within it do not have
their `disabled` property set to `true`. As a result, we needed to
use the `matches` method to check if the `:disabled` state is
present for the element. The `matches` method is part of the official
standard, but it was not implemented under that name for a while and
as a result Internet Explorer only supports it under the prefixed
`msMatchesSelector` method and older versions of Webkit have it
implemented as `webkitMatchesSelector`. But once we use this method,
it appears to consistently return the expected results.

This `matches` method and prefixed predecessors are not supported in
IE 8, but they are supported in IE 9 and any browsers newer than
that. Instead of buulding a very hacky solution using
`querySelectorAll` that was brittle, I have chosen to act like
everyone else and pretend IE 8 no longer exists.

Fixes #3347
Closes #4818
2019-07-09 20:58:13 -04:00
..
a11y Add tests for accessible search results 2015-11-23 18:35:36 -05:00
data Test against jQuery 3.4.1 (#5531) 2019-06-25 22:05:15 -04:00
dropdown Test against jQuery 3.4.1 (#5531) 2019-06-25 22:05:15 -04:00
integration Fix tag creation being broken in 4.0.7 (#5558) 2019-07-09 19:13:03 -04:00
options Add computedstyle option for calculating the width (#5559) 2019-07-09 19:44:33 -04:00
results Results respect disabled state of <option> (#5560) 2019-07-09 20:58:13 -04:00
selection #4530 Add tooltip (title) to the 'remove all' 'X' icon. (#5291) 2018-09-15 16:22:54 -03:00
utils Combine tests into common files 2015-02-13 23:29:56 -05:00
vendor Test against jQuery 3.4.1 (#5531) 2019-06-25 22:05:15 -04:00
helpers.js Update grunt-contrib-qunit to latest version (#5530) 2019-06-04 22:43:52 -04:00
integration-jq1.html Restore compatibility with data-* attributes in jQuery 2.x (#5486) 2019-04-27 22:20:56 -04:00
integration-jq2.html Restore compatibility with data-* attributes in jQuery 2.x (#5486) 2019-04-27 22:20:56 -04:00
integration-jq3.html Test against jQuery 3.4.1 (#5531) 2019-06-25 22:05:15 -04:00
unit-jq1.html Results respect disabled state of <option> (#5560) 2019-07-09 20:58:13 -04:00
unit-jq2.html Results respect disabled state of <option> (#5560) 2019-07-09 20:58:13 -04:00
unit-jq3.html Results respect disabled state of <option> (#5560) 2019-07-09 20:58:13 -04:00