1
0
mirror of synced 2024-11-22 13:06:08 +03:00
select2/tests
Kevin Brown 55f995ea21 Fixed data-ajax-url fallback
This fixes the fallback path for the `data-ajax-url` attribute on
elements.  As this attribute was previously supported in Select2,
the attribute has been migrated to the new, nested format of the
url and triggers a deprecation warning when it is used.  Because
of a fix to the `data-*` attribute parsing made in a9f6d64 that
allowed for nested attributes to be parsed correctly in modern
browsers under jQuery 1.x, the deprecation warning would be
triggered but the attribute would no longer actually be used.

This also fixes some of the `.data` calls to use the camel cased
version of the key instead of the dashed version, which is the
preferred key and will be enforced in future versions of jQuery
as the only way to access data attributes.

Now in situations where the `dataset` attribute is used by Select2,
it combines the results of both `$e.data()` and `e.dataset` when
generating the object containing all of the options.  This will
the `dataset` fix to still be used, while also still relying on
jQuery to do additional parsing on any options that it can.

The `dataset` fix is now only used on jQuery 1.x, as that is the
only version of jQuery affected by the dash issue.  This is done
using version number parsing on the `$.fn.jquery` property that is
defined by jQuery.  As this property is not defined in Zepto and
many other jQuery compatible checks, we only include the fallback
if the property is available.  This assumes that any jQuery
compatible libraries that are in use will not include the same dash
issue, which we believe is a safe assumption given that it did not
match the HTML `dataset` specification.

This also adds a few tests to ensure that the deprecated attributes
still continue to function.

This closes https://github.com/select2/select2/issues/3086.
2015-02-27 20:11:13 -05:00
..
a11y Clone the tabindex from the original select 2015-02-13 23:57:18 -05:00
data Added tests for the <input /> element 2015-02-27 18:37:06 -05:00
dropdown Combine tests into common files 2015-02-13 23:29:56 -05:00
options Fixed data-ajax-url fallback 2015-02-27 20:11:13 -05:00
selection Combine tests into common files 2015-02-13 23:29:56 -05:00
utils Combine tests into common files 2015-02-13 23:29:56 -05:00
vendor Added Utils.Decorate and tests 2014-10-21 21:43:56 -04:00
data.html Added tests for the <input /> element 2015-02-27 18:37:06 -05:00
dropdown.html Combine tests into common files 2015-02-13 23:29:56 -05:00
helpers.js Hook up with SauceLabs 2015-02-13 21:59:09 -05:00
options.html Combine tests into common files 2015-02-13 23:29:56 -05:00
selection.html Combine tests into common files 2015-02-13 23:29:56 -05:00
utils.html Combine tests into common files 2015-02-13 23:29:56 -05:00