From 69de65180f750cadf5f96a774d2524f69d19beab Mon Sep 17 00:00:00 2001 From: Johann-S Date: Fri, 14 Apr 2017 13:30:55 +0200 Subject: Fix unit tests + Update Popper to 1.6.0 --- js/tests/unit/tooltip.js | 64 +++++------------------------------------------- 1 file changed, 6 insertions(+), 58 deletions(-) (limited to 'js/tests/unit/tooltip.js') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index 0bb90156b9..f47a97e30c 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -383,8 +383,6 @@ $(function () { var $tooltip = $($(this).data('bs.tooltip').tip) assert.ok($tooltip.hasClass('bs-tooltip-right')) assert.ok($tooltip.attr('style') === undefined) - $(this).bootstrapTooltip('hide') - $container.remove() $styles.remove() done() }) @@ -475,32 +473,19 @@ $(function () { }) .appendTo('#qunit-fixture') - $('#qunit-fixture').css({ - position : 'relative', - top : '0px', - left : '0px' - }) - - var $trigger = $container + $container .find('a') .css('margin-top', 200) .bootstrapTooltip({ placement: 'top', animate: false }) - .bootstrapTooltip('show') - - var $tooltip = $($trigger.data('bs.tooltip').tip) - - setTimeout(function () { - assert.ok(Math.round($tooltip.offset().top + $tooltip.outerHeight()) <= Math.round($trigger.offset().top)) - $('#qunit-fixture').css({ - position : 'absolute', - top : '-10000px', - left : '-10000px' + .on('shown.bs.tooltip', function () { + var $tooltip = $($(this).data('bs.tooltip').tip) + assert.ok(Math.round($tooltip.offset().top + $tooltip.outerHeight()) >= Math.round($(this).offset().top)) + done() }) - done() - }, 0) + .bootstrapTooltip('show') }) QUnit.test('should show tooltip if leave event hasn\'t occurred before delay expires', function (assert) { @@ -702,43 +687,6 @@ $(function () { assert.strictEqual(currentUid, $('#tt-content').text()) }) - QUnit.test('should correctly position tooltips on transformed elements', function (assert) { - var styleProps = document.documentElement.style - if (!('transform' in styleProps) && !('webkitTransform' in styleProps) && !('msTransform' in styleProps)) { - assert.expect(0) - return - } - assert.expect(2) - - var done = assert.async() - - var styles = '' - var $styles = $(styles).appendTo('head') - - var $element = $('
').appendTo('#qunit-fixture') - - $element - .on('shown.bs.tooltip', function () { - var offset = $('.tooltip').offset() - $styles.remove() - assert.ok(Math.abs(offset.left - 88) <= 1, 'tooltip has correct horizontal location') - assert.ok(Math.abs(offset.top - 126) <= 1, 'tooltip has correct vertical location') - $element.bootstrapTooltip('hide') - done() - }) - .bootstrapTooltip({ - trigger: 'manual' - }) - - $element.bootstrapTooltip('show') - }) - QUnit.test('should do nothing when an attempt is made to hide an uninitialized tooltip', function (assert) { assert.expect(1) -- cgit v1.2.3