From 9cbd041f6b0b24db4feadc08a4ab967512bd448a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 27 Feb 2019 13:20:25 +0200 Subject: [PATCH] tests: add tests for plugins version. (#28366) --- js/tests/unit/alert.js | 9 ++------- js/tests/unit/button.js | 9 ++------- js/tests/unit/carousel.js | 3 +-- js/tests/unit/collapse.js | 5 +++++ js/tests/unit/dropdown.js | 5 +++++ js/tests/unit/modal.js | 5 +++++ js/tests/unit/popover.js | 5 +++++ js/tests/unit/scrollspy.js | 5 +++++ js/tests/unit/tab.js | 7 +++++++ js/tests/unit/tooltip.js | 5 +++++ 10 files changed, 42 insertions(+), 16 deletions(-) diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 17d7be01eb..4fa9ca19f7 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -116,13 +116,8 @@ $(function () { assert.ok(Alert._getInstance($alert[0]) === null) }) - QUnit.test('should return alert version', function (assert) { + QUnit.test('should return the version', function (assert) { assert.expect(1) - - if (typeof Alert !== 'undefined') { - assert.ok(typeof Alert.VERSION === 'string') - } else { - assert.notOk() - } + assert.strictEqual(typeof Alert.VERSION, 'string') }) }) diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index a1d15116b1..bd393078ba 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -218,13 +218,8 @@ $(function () { assert.ok(Button._getInstance($button[0]) === null) }) - QUnit.test('should return button version', function (assert) { + QUnit.test('should return the version', function (assert) { assert.expect(1) - - if (typeof Button !== 'undefined') { - assert.ok(typeof Button.VERSION === 'string') - } else { - assert.notOk() - } + assert.strictEqual(typeof Button.VERSION, 'string') }) }) diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js index d8f7e6dc0b..a45ef4564c 100644 --- a/js/tests/unit/carousel.js +++ b/js/tests/unit/carousel.js @@ -46,9 +46,8 @@ $(function () { assert.strictEqual(typeof $.fn.carousel, 'undefined', 'carousel was set back to undefined (orig value)') }) - QUnit.test('should return version', function (assert) { + QUnit.test('should return the version', function (assert) { assert.expect(1) - assert.strictEqual(typeof Carousel.VERSION, 'string') }) diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js index c59af20624..b21c18b8ec 100644 --- a/js/tests/unit/collapse.js +++ b/js/tests/unit/collapse.js @@ -897,4 +897,9 @@ $(function () { $collapse2.bootstrapCollapse('toggle') }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Collapse.VERSION, 'string') + }) }) diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index aa52bfe7ab..d1f13c8eec 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -1423,4 +1423,9 @@ $(function () { assert.strictEqual(offset.offset, myOffset) assert.ok(typeof offset.fn === 'undefined') }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Dropdown.VERSION, 'string') + }) }) diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js index 6939c5e5bf..6025a65708 100644 --- a/js/tests/unit/modal.js +++ b/js/tests/unit/modal.js @@ -796,4 +796,9 @@ $(function () { }) .bootstrapModal('show') }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Modal.VERSION, 'string') + }) }) diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index bc94a17978..ac5c547573 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -466,4 +466,9 @@ $(function () { $popover[0].click() }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Popover.VERSION, 'string') + }) }) diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index cf05397301..1530676998 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -727,4 +727,9 @@ $(function () { testOffsetMethod('js') testOffsetMethod('data') }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof ScrollSpy.VERSION, 'string') + }) }) diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index 58a225f164..114e976100 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -1,6 +1,8 @@ $(function () { 'use strict' + var Tab = typeof window.bootstrap !== 'undefined' ? window.bootstrap.Tab : window.Tab + QUnit.module('tabs plugin') QUnit.test('should be defined on jquery object', function (assert) { @@ -520,4 +522,9 @@ $(function () { $('#secondNav')[0].click() }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Tab.VERSION, 'string') + }) }) diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index b542cbfb19..3bc91046b4 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -1249,4 +1249,9 @@ $(function () { assert.strictEqual(tooltip.config.sanitize, true) }) + + QUnit.test('should return the version', function (assert) { + assert.expect(1) + assert.strictEqual(typeof Tooltip.VERSION, 'string') + }) })