소스 검색

Skip the nested data test on unsupposed browsers

The nested data attributes are only supported on jQuery 2.x or
browsers which support the `dataset` attributes on DOM elements.
In order to prevent test failures, and because tests cannot yet
be skipped conditionally, we just cut the test early.
Kevin Brown 10 년 전
부모
커밋
55d3c636cc
2개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      README.md
  2. 9 0
      tests/options/data-tests.js

+ 1 - 1
README.md

@@ -97,7 +97,7 @@ The license is available within the repository in the [LICENSE][license] file.
 [select2-rails]: https://github.com/argerim/select2-rails
 [symfony-select2]: https://github.com/19Gerhard85/sfSelect2WidgetsPlugin
 [symfony2-select2]: https://github.com/avocode/FormExtensions
-[travis-ci-image]: https://travis-ci.org/select2/select2.svg?branch=select2-ng
+[travis-ci-image]: https://travis-ci.org/select2/select2.svg?branch=master
 [travis-ci-status]: https://travis-ci.org/select2/select2
 [wicket]: http://wicket.apache.org
 [wicket-select2]: https://github.com/ivaynberg/wicket-select2

+ 9 - 0
tests/options/data-tests.js

@@ -15,6 +15,15 @@ test('no nesting', function (assert) {
 test('with nesting', function (assert) {
   var $test = $('<select data-first--second="test"></select>');
 
+  if ($test[0].dataset == null) {
+    assert.ok(
+      true,
+      'We can not run this test with jQuery 1.x if dataset is not implemented'
+    );
+
+    return;
+  }
+
   var options = new Options({}, $test);
 
   assert.ok(!(options.get('first-Second')));