diff options
| author | Johann-S <[email protected]> | 2017-10-23 09:35:27 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2017-10-23 10:35:27 +0300 |
| commit | 1487c3a9947b0eb55c61b5d93ff9f0c69a812aeb (patch) | |
| tree | 5f05dafe9448cb79d9ea8ffa2dc86a15d3f59ea6 /js/tests | |
| parent | 0d71a8a738688455746e91f7806fa0515c96d263 (diff) | |
| download | bootstrap-1487c3a9947b0eb55c61b5d93ff9f0c69a812aeb.tar.xz bootstrap-1487c3a9947b0eb55c61b5d93ff9f0c69a812aeb.zip | |
Add `Util.jQuery` which will detect jQuery instead of relying on global `$` (#24513)
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/index.html | 1 | ||||
| -rw-r--r-- | js/tests/unit/util.js | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/js/tests/index.html b/js/tests/index.html index 2383fce6e..0385b8a2b 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -119,6 +119,7 @@ <script src="unit/tab.js"></script> <script src="unit/tooltip.js"></script> <script src="unit/popover.js"></script> + <script src="unit/util.js"></script> </head> <body> <div id="qunit-container"> diff --git a/js/tests/unit/util.js b/js/tests/unit/util.js new file mode 100644 index 000000000..c3412041e --- /dev/null +++ b/js/tests/unit/util.js @@ -0,0 +1,19 @@ +$(function () { + 'use strict' + + QUnit.module('Util') + + QUnit.test('Util.jQuery should find window.jQuery if window.$ is not available', function (assert) { + assert.expect(1) + delete window.$ + assert.strictEqual(Util.jQuery, window.jQuery) + window.$ = Util.jQuery + }) + + QUnit.test('Util.jQuery should find window.$ if window.jQuery is not available', function (assert) { + assert.expect(1) + delete window.jQuery + assert.strictEqual(Util.jQuery, window.$) + window.jQuery = Util.jQuery + }) +}) |
