1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-16 10:34:07 +02:00

Add Util.jQuery which will detect jQuery instead of relying on global $ (#24513)

This commit is contained in:
Johann-S
2017-10-23 09:35:27 +02:00
committed by XhmikosR
parent 0d71a8a738
commit 1487c3a994
14 changed files with 38 additions and 11 deletions

View File

@@ -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">

19
js/tests/unit/util.js Normal file
View File

@@ -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
})
})