diff options
| author | Alessandro Chitolina <[email protected]> | 2017-09-25 09:09:01 +0200 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2019-02-20 22:05:45 +0200 |
| commit | 0263d1742ce8ad25f0f2de30beebae69b2f55f10 (patch) | |
| tree | 4f3d1b376f0050c2a74addebd32341b45d0ec38a /js/tests | |
| parent | 9744886519a834deba45b1cadbb0603ac2446102 (diff) | |
| download | bootstrap-0263d1742ce8ad25f0f2de30beebae69b2f55f10.tar.xz bootstrap-0263d1742ce8ad25f0f2de30beebae69b2f55f10.zip | |
rewritten scrollspy without jquery
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/unit/scrollspy.js | 14 | ||||
| -rw-r--r-- | js/tests/visual/scrollspy.html | 3 |
2 files changed, 10 insertions, 7 deletions
diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index 1337e585d..7470a94c2 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -80,7 +80,7 @@ $(function () { .show() .find('#scrollspy-example') .bootstrapScrollspy({ - target: '#ss-target' + target: 'ss-target' }) $scrollspy.one('scroll', function () { @@ -127,7 +127,7 @@ $(function () { .show() .find('#scrollspy-example') .bootstrapScrollspy({ - target: document.getElementById('#ss-target') + target: document.getElementById('ss-target') }) $scrollspy.one('scroll', function () { @@ -557,7 +557,7 @@ $(function () { $scrollspy .bootstrapScrollspy({ target: '#navigation', - offset: $scrollspy.position().top + offset: $scrollspy[0].offsetTop }) .one('scroll', function () { assert.strictEqual($('.active').length, 1, '"active" class on only one element present') @@ -663,11 +663,11 @@ $(function () { method: 'offset' }) } else if (type === 'data') { - $(window).trigger('load') + EventHandler.trigger(window, 'load') } var $target = $('#div-' + type + 'm-2') - var scrollspy = $content.data('bs.scrollspy') + var scrollspy = Data.getData($content[0], 'bs.scrollspy') assert.ok(scrollspy._offsets[1] === $target.offset().top, 'offset method with ' + type + ' option') assert.ok(scrollspy._offsets[1] !== $target.position().top, 'position method with ' + type + ' option') @@ -710,11 +710,11 @@ $(function () { method: 'position' }) } else if (type === 'data') { - $(window).trigger('load') + EventHandler.trigger(window, 'load') } var $target = $('#div-' + type + 'm-2') - var scrollspy = $content.data('bs.scrollspy') + var scrollspy = Data.getData($content[0], 'bs.scrollspy') assert.ok(scrollspy._offsets[1] !== $target.offset().top, 'offset method with ' + type + ' option') assert.ok(scrollspy._offsets[1] === $target.position().top, 'position method with ' + type + ' option') diff --git a/js/tests/visual/scrollspy.html b/js/tests/visual/scrollspy.html index f0149198d..d526af6d2 100644 --- a/js/tests/visual/scrollspy.html +++ b/js/tests/visual/scrollspy.html @@ -88,7 +88,10 @@ <script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script> <script src="../../../site/docs/4.2/assets/js/vendor/popper.min.js"></script> + <script src="../../dist/dom/data.js"></script> <script src="../../dist/dom/eventHandler.js"></script> + <script src="../../dist/dom/manipulator.js"></script> + <script src="../../dist/dom/selectorEngine.js"></script> <script src="../../dist/util.js"></script> <script src="../../dist/scrollspy.js"></script> <script src="../../dist/dropdown.js"></script> |
