diff options
| author | fat <[email protected]> | 2015-05-12 14:28:11 -0700 |
|---|---|---|
| committer | fat <[email protected]> | 2015-05-12 14:35:00 -0700 |
| commit | a58febf71a5eac2161ce2db08c7d723755ed1163 (patch) | |
| tree | 6c7356af40f579034ef6cc85976922a3de6ea457 /js/tests | |
| parent | 3452e8dc8336c7a4151bcccdb9d3d4202f06f294 (diff) | |
| download | bootstrap-a58febf71a5eac2161ce2db08c7d723755ed1163.tar.xz bootstrap-a58febf71a5eac2161ce2db08c7d723755ed1163.zip | |
popover passing as well
Diffstat (limited to 'js/tests')
| -rw-r--r-- | js/tests/index.html | 10 | ||||
| -rw-r--r-- | js/tests/unit/popover.js | 25 | ||||
| -rw-r--r-- | js/tests/unit/tooltip.js | 16 | ||||
| -rw-r--r-- | js/tests/visual/popover.html | 10 |
4 files changed, 23 insertions, 38 deletions
diff --git a/js/tests/index.html b/js/tests/index.html index 2491d8d86..0e2bdd012 100644 --- a/js/tests/index.html +++ b/js/tests/index.html @@ -141,11 +141,9 @@ <script src="../../js/dist/scrollspy.js"></script> <script src="../../js/dist/tab.js"></script> <script src="../../js/dist/tooltip.js"></script> + <script src="../../js/dist/popover.js"></script> - <!-- Old Plugin sources --> - <!-- <script src="../../js/popover.js"></script> --> - - <!-- Unit tests + <!-- Unit tests --> <script src="unit/alert.js"></script> <script src="unit/button.js"></script> <script src="unit/carousel.js"></script> @@ -153,9 +151,9 @@ <script src="unit/dropdown.js"></script> <script src="unit/modal.js"></script> <script src="unit/scrollspy.js"></script> - <script src="unit/tab.js"></script> --> + <script src="unit/tab.js"></script> <script src="unit/tooltip.js"></script> - <!-- <script src="unit/popover.js"></script> --> + <script src="unit/popover.js"></script> </head> <body> diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index a25df3a58..01c6a97cb 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -16,6 +16,7 @@ $(function () { afterEach: function () { $.fn.popover = $.fn.bootstrapPopover delete $.fn.bootstrapPopover + $('.popover').remove() } }) @@ -81,6 +82,7 @@ $(function () { assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted') $popover.bootstrapPopover('hide') + assert.strictEqual($('.popover').length, 0, 'popover was removed') }) @@ -91,6 +93,7 @@ $(function () { var $popover = $('<a href="#">@fat</a>') .appendTo('#qunit-fixture') .bootstrapPopover({ + html: true, content: function () { return $div } @@ -98,14 +101,14 @@ $(function () { $popover.bootstrapPopover('show') assert.notEqual($('.popover').length, 0, 'popover was inserted') - assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted') + assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted') $popover.bootstrapPopover('hide') assert.strictEqual($('.popover').length, 0, 'popover was removed') $popover.bootstrapPopover('show') assert.notEqual($('.popover').length, 0, 'popover was inserted') - assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted') + assert.equal($('.popover .popover-content').html(), $div[0].outerHTML, 'content correctly inserted') $popover.bootstrapPopover('hide') assert.strictEqual($('.popover').length, 0, 'popover was removed') @@ -126,7 +129,6 @@ $(function () { assert.strictEqual($('.popover').length, 0, 'popover was removed') }) - QUnit.test('should get title and content from attributes ignoring options passed via js', function (assert) { assert.expect(4) var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>') @@ -240,13 +242,6 @@ $(function () { .bootstrapPopover('show') }) - QUnit.test('should throw an error when initializing popover on the document object without specifying a delegation selector', function (assert) { - assert.expect(1) - assert.throws(function () { - $(document).bootstrapPopover({ title: 'What am I on?', content: 'My selector is missing' }) - }, new Error('`selector` option must be specified when initializing popover on the window.document object!')) - }) - QUnit.test('should do nothing when an attempt is made to hide an uninitialized popover', function (assert) { assert.expect(1) @@ -259,16 +254,6 @@ $(function () { assert.strictEqual($popover.data('bs.popover'), undefined, 'should not initialize the popover') }) - QUnit.test('should throw an error when template contains multiple top-level elements', function (assert) { - assert.expect(1) - assert.throws(function () { - $('<span data-toggle="popover" data-title="some title" data-content="some content">some text</span>') - .appendTo('#qunit-fixture') - .bootstrapPopover({ template: '<div>Foo</div><div>Bar</div>' }) - .bootstrapPopover('show') - }, new Error('popover `template` option must consist of exactly 1 top-level element!')) - }) - QUnit.test('should fire inserted event', function (assert) { assert.expect(2) var done = assert.async() diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 8f2cbc3e8..f3df4d828 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -89,11 +89,11 @@ $(function () { assert.strictEqual(id.indexOf('tooltip'), 0, 'tooltip id has prefix') }) - QUnit.test('should place tooltips relative to attachment option', function (assert) { + QUnit.test('should place tooltips relative to placement option', function (assert) { assert.expect(2) var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>') .appendTo('#qunit-fixture') - .bootstrapTooltip({ attachment: 'bottom' }) + .bootstrapTooltip({ placement: 'bottom' }) $tooltip.bootstrapTooltip('show') @@ -321,7 +321,7 @@ $(function () { var $target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"/>') .appendTo($container) .bootstrapTooltip({ - attachment: 'right', + placement: 'right', }) .bootstrapTooltip('show') @@ -389,7 +389,7 @@ $(function () { .one('show.bs.tooltip', function () { $(this).remove() }) - .bootstrapTooltip({ attachment: 'top' }) + .bootstrapTooltip({ placement: 'top' }) try { $tooltip.bootstrapTooltip('show') @@ -426,7 +426,7 @@ $(function () { .find('a') .css('margin-top', 200) .bootstrapTooltip({ - attachment: 'top', + placement: 'top', animate: false }) .bootstrapTooltip('show') @@ -609,7 +609,7 @@ $(function () { assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom') done() }) - .bootstrapTooltip({ attachment: 'top', trigger: 'manual' }) + .bootstrapTooltip({ placement: 'top', trigger: 'manual' }) $circle.bootstrapTooltip('show') }) @@ -621,7 +621,7 @@ $(function () { return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>' } - var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>') + var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>') .appendTo('#qunit-fixture') $tooltip.bootstrapTooltip({ @@ -649,7 +649,7 @@ $(function () { return '<p id="tt-content">' + uid + '</p><p>' + uid + '</p><p>' + uid + '</p>' } - var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-attachment="top">some text</span>') + var $tooltip = $('<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>') .appendTo('#qunit-fixture') $tooltip.bootstrapTooltip({ diff --git a/js/tests/visual/popover.html b/js/tests/visual/popover.html index 0e84f5cee..ac6557256 100644 --- a/js/tests/visual/popover.html +++ b/js/tests/visual/popover.html @@ -5,7 +5,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Popover</title> - <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css"> + <link rel="stylesheet" href="../../../dist/css/bootstrap.css"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> @@ -39,9 +39,11 @@ <!-- JavaScript Includes --> <script src="../vendor/jquery.min.js"></script> -<script src="../../transition.js"></script> -<script src="../../tooltip.js"></script> -<script src="../../popover.js"></script> +<script src="../vendor/tether.min.js"></script> +<script src="../../dist/util.js"></script> +<script src="../../dist/tooltip.js"></script> +<script src="../../dist/popover.js"></script> + <!-- JavaScript Test --> <script> |
