1
0
mirror of synced 2024-11-22 13:06:08 +03:00
select2/tests
Kevin Brown 1f3eceba5a
Fix generated options not receiving result IDs (#5586)
In order to enable the ability to uniquely identify a result by an ID
in the DOM, we generate a new ID for the result based on a combination
of things, including the container ID prefix that is generated and
used elsewhere in Select2. This has worked fairly well for use cases
including attaching Select2 to an existing `<select>` and loading in
options from a remote data set.

Unfortunately, because this process relied on the container ID being
used as a prefix, this failed for options which were automatically
generated on initialization using the `data:` option to Select2.
These were not being generated with an ID because at the time that
they were being generated, the data adapter was not aware of the
container it was being used in. This broke some accessibility features
because we had a mix of options in the results list with IDs, and
some without, so we fixed the ordering to make this work.

Option generation no longer happens when the data adapter is first
initialized, which is where it was previously happening, and instead
it now occurs when the data adapter is bound to the container. This
allows us to ensure that the data adapter is always aware of the
container it is being associated with, so now it will be able to
generate the result IDs.

This also fixes the tests for the array adapter as well as the
legacy `<input />` adapter so they properly bind to a container
during the test. This was causing test failures becuase the options
which would previously be generated during initialization were no
longer appearing.

Fixes #4350
2019-07-27 16:37:57 -04:00
..
a11y Mirror disabled state through aria-disabled on selection (#5579) 2019-07-21 11:44:09 -04:00
data Fix generated options not receiving result IDs (#5586) 2019-07-27 16:37:57 -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 Convert source and tests to unix newlines 2019-07-20 23:01:38 -04:00
selection Do not propagate click when search box is not empty (#5580) 2019-07-21 13:04:51 -04: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 Convert source and tests to unix newlines 2019-07-20 23:01:38 -04:00
unit-jq2.html Convert source and tests to unix newlines 2019-07-20 23:01:38 -04:00
unit-jq3.html Convert source and tests to unix newlines 2019-07-20 23:01:38 -04:00