mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-06-08 17:22:31 +03:00
Use BrowserStack for our unit tests.
This commit is contained in:
+3
-4
@@ -3,12 +3,11 @@
|
||||
Bootstrap uses [QUnit](http://api.qunitjs.com/), a powerful, easy-to-use JavaScript unit test framework. Each plugin has a file dedicated to its tests in `unit/<plugin-name>.js`.
|
||||
|
||||
* `unit/` contains the unit test files for each Bootstrap plugin.
|
||||
* `vendor/` contains third-party testing-related code (QUnit and jQuery).
|
||||
* `vendor/` contains jQuery.
|
||||
* `visual/` contains "visual" tests which are run interactively in real browsers and require manual verification by humans.
|
||||
|
||||
To run the unit test suite via [PhantomJS](http://phantomjs.org/), run `grunt test-js`.
|
||||
|
||||
To run the unit test suite via a real web browser, open `index.html` in the browser.
|
||||
To run our unit tests on a real web browser [Karma](https://karma-runner.github.io/2.0/index.html), run `grunt test-js` or you can
|
||||
open `index.html`.
|
||||
|
||||
|
||||
## How do I add a new unit test?
|
||||
|
||||
+2
-3
@@ -52,8 +52,8 @@
|
||||
</script>
|
||||
|
||||
<!-- QUnit -->
|
||||
<link rel="stylesheet" href="vendor/qunit.css" media="screen">
|
||||
<script src="vendor/qunit.js"></script>
|
||||
<link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css" media="screen">
|
||||
<script src="../../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script>
|
||||
// See https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
|
||||
var log = []
|
||||
@@ -133,7 +133,6 @@
|
||||
</script>
|
||||
|
||||
<!-- Plugin sources -->
|
||||
<script>$.support.transition = false</script>
|
||||
<script src="../../js/alert.js"></script>
|
||||
<script src="../../js/button.js"></script>
|
||||
<script src="../../js/carousel.js"></script>
|
||||
|
||||
+21
-5
@@ -34,12 +34,21 @@ $(function () {
|
||||
|
||||
QUnit.test('should exit early if element is not visible', function (assert) {
|
||||
assert.expect(1)
|
||||
var $affix = $('<div style="display: none"/>').bootstrapAffix()
|
||||
var $affix = $('<div style="display: none"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapAffix()
|
||||
|
||||
$affix.data('bs.affix').checkPosition()
|
||||
assert.ok(!$affix.hasClass('affix'), 'affix class was not added')
|
||||
})
|
||||
|
||||
QUnit.test('should trigger affixed event after affix', function (assert) {
|
||||
// Disable for iOS because of: https://bugs.webkit.org/show_bug.cgi?id=172854
|
||||
if (window.navigator.userAgent.match(/iPhone/i)) {
|
||||
assert.expect(0)
|
||||
return
|
||||
}
|
||||
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
@@ -66,15 +75,22 @@ $(function () {
|
||||
})
|
||||
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
window.scrollTo(0, document.body.scrollHeight - 5)
|
||||
|
||||
// for testing in a browser
|
||||
setTimeout(function () {
|
||||
window.scroll(0, 0)
|
||||
}, 16) // for testing in a browser
|
||||
}, 150)
|
||||
}, 0)
|
||||
})
|
||||
|
||||
QUnit.test('should affix-top when scrolling up to offset when parent has padding', function (assert) {
|
||||
// Disable for iOS because of: https://bugs.webkit.org/show_bug.cgi?id=172854
|
||||
if (window.navigator.userAgent.match(/iPhone/i)) {
|
||||
assert.expect(0)
|
||||
return
|
||||
}
|
||||
|
||||
assert.expect(1)
|
||||
var done = assert.async()
|
||||
|
||||
@@ -97,11 +113,11 @@ $(function () {
|
||||
})
|
||||
|
||||
setTimeout(function () {
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
window.scrollTo(0, document.body.scrollHeight - 5)
|
||||
|
||||
setTimeout(function () {
|
||||
window.scroll(0, 119)
|
||||
}, 250)
|
||||
}, 250)
|
||||
}, 0)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -47,6 +47,8 @@ $(function () {
|
||||
|
||||
QUnit.test('should remove element when clicking .close', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var alertHTML = '<div class="alert alert-danger fade in">'
|
||||
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
|
||||
+ '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
|
||||
@@ -55,9 +57,12 @@ $(function () {
|
||||
|
||||
assert.notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
|
||||
|
||||
$alert.find('.close').trigger('click')
|
||||
$alert.on('closed.bs.alert', function () {
|
||||
assert.strictEqual($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
||||
done()
|
||||
})
|
||||
|
||||
assert.strictEqual($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
||||
$alert.find('.close').trigger('click')
|
||||
})
|
||||
|
||||
QUnit.test('should not fire closed when close is prevented', function (assert) {
|
||||
|
||||
@@ -34,10 +34,15 @@ $(function () {
|
||||
|
||||
QUnit.test('should show a collapsed element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div class="collapse"/>').bootstrapCollapse('show')
|
||||
var done = assert.async()
|
||||
|
||||
assert.ok($el.hasClass('in'), 'has class "in"')
|
||||
assert.ok(!/height/i.test($el.attr('style')), 'has height reset')
|
||||
$('<div class="collapse"/>')
|
||||
.on('shown.bs.collapse', function () {
|
||||
assert.ok($(this).hasClass('in'), 'has class "in"')
|
||||
assert.ok(!/height/i.test($(this).attr('style')), 'has height reset')
|
||||
done()
|
||||
})
|
||||
.bootstrapCollapse('show')
|
||||
})
|
||||
|
||||
QUnit.test('should hide a collapsed element', function (assert) {
|
||||
|
||||
+16
-3
@@ -16,6 +16,7 @@ $(function () {
|
||||
afterEach: function () {
|
||||
$.fn.modal = $.fn.bootstrapModal
|
||||
delete $.fn.bootstrapModal
|
||||
$('#qunit-fixture').html('')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -26,7 +27,7 @@ $(function () {
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div id="modal-test"/>')
|
||||
var $el = $('<div id="modal-test"/>').appendTo('#qunit-fixture')
|
||||
var $modal = $el.bootstrapModal()
|
||||
assert.ok($modal instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($modal[0], $el[0], 'collection contains element')
|
||||
@@ -42,6 +43,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
done()
|
||||
@@ -54,6 +56,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('show.bs.modal', function () {
|
||||
assert.ok(true, 'show event fired')
|
||||
done()
|
||||
@@ -66,6 +69,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('show.bs.modal', function (e) {
|
||||
e.preventDefault()
|
||||
assert.ok(true, 'show event fired')
|
||||
@@ -82,6 +86,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
@@ -99,6 +104,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
@@ -116,6 +122,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"><span class="close" data-dismiss="modal"/></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
@@ -133,6 +140,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test" data-backdrop="false"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').is(':visible'), 'modal visible')
|
||||
$(this).bootstrapModal('hide')
|
||||
@@ -149,6 +157,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"><div class="contents"/></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.notEqual($('#modal-test').length, 0, 'modal inserted into dom')
|
||||
$('.contents').trigger('click')
|
||||
@@ -166,7 +175,7 @@ $(function () {
|
||||
assert.expect(3)
|
||||
var done = assert.async()
|
||||
|
||||
var $div = $('<div id="modal-test"/>')
|
||||
var $div = $('<div id="modal-test"/>').appendTo('#qunit-fixture')
|
||||
$div
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').length, 'modal inserted into dom')
|
||||
@@ -186,7 +195,7 @@ $(function () {
|
||||
assert.expect(3)
|
||||
var done = assert.async()
|
||||
|
||||
var $div = $('<div id="modal-test"/>')
|
||||
var $div = $('<div id="modal-test"/>').appendTo('#qunit-fixture')
|
||||
$div
|
||||
.on('shown.bs.modal', function () {
|
||||
assert.ok($('#modal-test').length, 'modal inserted into dom')
|
||||
@@ -209,6 +218,7 @@ $(function () {
|
||||
var triggered
|
||||
|
||||
$('<div id="modal-test"><div class="contents"/></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.modal', function () {
|
||||
triggered = 0
|
||||
$('#modal-test').trigger('click')
|
||||
@@ -226,6 +236,7 @@ $(function () {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div id="modal-test"><div class="contents"><div id="close" data-dismiss="modal"/></div></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.one('shown.bs.modal', function () {
|
||||
$('#close').trigger('click')
|
||||
})
|
||||
@@ -252,6 +263,7 @@ $(function () {
|
||||
var $toggleBtn = $('<button data-toggle="modal" data-target="#modal-test"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="modal-test"><div class="contents"><div id="close" data-dismiss="modal"/></div></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.modal', function () {
|
||||
setTimeout(function () {
|
||||
assert.ok($(document.activeElement).is($toggleBtn), 'toggling element is once again focused')
|
||||
@@ -273,6 +285,7 @@ $(function () {
|
||||
var $otherBtn = $('<button id="other-btn"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="modal-test"><div class="contents"><div id="close" data-dismiss="modal"/></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.one('show.bs.modal', function (e) {
|
||||
e.preventDefault()
|
||||
$otherBtn.trigger('focus')
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* grunt-contrib-qunit
|
||||
* http://gruntjs.com/
|
||||
*
|
||||
* Copyright (c) 2014 "Cowboy" Ben Alman, contributors
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Don't re-order tests.
|
||||
QUnit.config.reorder = false
|
||||
// Run tests serially, not in parallel.
|
||||
QUnit.config.autorun = false
|
||||
|
||||
// Send messages to the parent PhantomJS process via alert! Good times!!
|
||||
function sendMessage() {
|
||||
var args = [].slice.call(arguments)
|
||||
alert(JSON.stringify(args))
|
||||
}
|
||||
|
||||
// These methods connect QUnit to PhantomJS.
|
||||
QUnit.log(function (obj) {
|
||||
// What is this I don’t even
|
||||
if (obj.message === '[object Object], undefined:undefined') { return }
|
||||
|
||||
// Parse some stuff before sending it.
|
||||
var actual
|
||||
var expected
|
||||
if (!obj.result) {
|
||||
// Dumping large objects can be very slow, and the dump isn't used for
|
||||
// passing tests, so only dump if the test failed.
|
||||
actual = QUnit.dump.parse(obj.actual)
|
||||
expected = QUnit.dump.parse(obj.expected)
|
||||
}
|
||||
// Send it.
|
||||
sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
|
||||
})
|
||||
|
||||
QUnit.testStart(function (obj) {
|
||||
sendMessage('qunit.testStart', obj.name)
|
||||
})
|
||||
|
||||
QUnit.testDone(function (obj) {
|
||||
sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total, obj.duration)
|
||||
})
|
||||
|
||||
QUnit.moduleStart(function (obj) {
|
||||
sendMessage('qunit.moduleStart', obj.name)
|
||||
})
|
||||
|
||||
QUnit.moduleDone(function (obj) {
|
||||
if (obj.failed === 0) {
|
||||
console.log('\r\u221A All tests passed in "' + obj.name + '" module')
|
||||
} else {
|
||||
console.log('\u00D7 ' + obj.failed + ' tests failed in "' + obj.name + '" module')
|
||||
}
|
||||
sendMessage('qunit.moduleDone', obj.name, obj.failed, obj.passed, obj.total)
|
||||
})
|
||||
|
||||
QUnit.begin(function () {
|
||||
sendMessage('qunit.begin')
|
||||
console.log('\n\nStarting test suite')
|
||||
console.log('================================================\n')
|
||||
})
|
||||
|
||||
QUnit.done(function (obj) {
|
||||
sendMessage('qunit.done', obj.failed, obj.passed, obj.total, obj.runtime)
|
||||
})
|
||||
|
||||
}())
|
||||
+98
-50
@@ -34,13 +34,19 @@ $(function () {
|
||||
|
||||
QUnit.test('should render popover element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $popover = $('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover('show')
|
||||
var done = assert.async()
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover removed')
|
||||
$('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$(this).bootstrapPopover('hide')
|
||||
})
|
||||
.on('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should store popover instance in popover data object', function (assert) {
|
||||
@@ -63,6 +69,8 @@ $(function () {
|
||||
|
||||
QUnit.test('should get title and content from options', function (assert) {
|
||||
assert.expect(4)
|
||||
var done = assert.async()
|
||||
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -73,19 +81,24 @@ $(function () {
|
||||
return 'loves writing tests (╯°□°)╯︵ ┻━┻'
|
||||
}
|
||||
})
|
||||
.on('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
})
|
||||
.on('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
QUnit.test('should not duplicate HTML object', function (assert) {
|
||||
assert.expect(6)
|
||||
var done = assert.async()
|
||||
var $div = $('<div/>').html('loves writing tests (╯°□°)╯︵ ┻━┻')
|
||||
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
@@ -96,72 +109,100 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
$popover.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
$popover.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
|
||||
$popover.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
$popover.bootstrapPopover('hide')
|
||||
})
|
||||
$popover.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
})
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
QUnit.test('should get title and content from attributes', function (assert) {
|
||||
assert.expect(4)
|
||||
var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover()
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$(this).bootstrapPopover('hide')
|
||||
})
|
||||
.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
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>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
title: 'ignored title option',
|
||||
content: 'ignored content option'
|
||||
})
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$(this).bootstrapPopover('hide')
|
||||
})
|
||||
.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.strictEqual($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
assert.strictEqual($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
QUnit.test('should respect custom template', function (assert) {
|
||||
assert.expect(3)
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
title: 'Test',
|
||||
content: 'Test',
|
||||
template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"/><div class="content"><p/></div></div></div>'
|
||||
})
|
||||
.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
$(this).bootstrapPopover('hide')
|
||||
})
|
||||
.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should destroy popover', function (assert) {
|
||||
@@ -187,6 +228,8 @@ $(function () {
|
||||
|
||||
QUnit.test('should render popover element using delegated selector', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $div = $('<div><a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -194,11 +237,16 @@ $(function () {
|
||||
trigger: 'click'
|
||||
})
|
||||
|
||||
$div.find('a').trigger('click')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$div.one('shown.bs.popover', function () {
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
|
||||
$div.find('a').trigger('click')
|
||||
})
|
||||
.one('hidden.bs.popover', function () {
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
done()
|
||||
})
|
||||
$div.find('a').trigger('click')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
QUnit.test('should detach popover content rather than removing it so that event handlers are left intact', function (assert) {
|
||||
|
||||
+399
-194
@@ -16,6 +16,7 @@ $(function () {
|
||||
afterEach: function () {
|
||||
$.fn.tooltip = $.fn.bootstrapTooltip
|
||||
delete $.fn.bootstrapTooltip
|
||||
$('#qunit-fixture').html('')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -26,7 +27,7 @@ $(function () {
|
||||
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
assert.expect(2)
|
||||
var $el = $('<div/>')
|
||||
var $el = $('<div/>').appendTo('#qunit-fixture')
|
||||
var $tooltip = $el.bootstrapTooltip()
|
||||
assert.ok($tooltip instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($tooltip[0], $el[0], 'collection contains element')
|
||||
@@ -39,92 +40,132 @@ $(function () {
|
||||
|
||||
QUnit.test('should empty title attribute', function (assert) {
|
||||
assert.expect(1)
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>').bootstrapTooltip()
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip()
|
||||
|
||||
assert.strictEqual($trigger.attr('title'), '', 'title attribute was emptied')
|
||||
})
|
||||
|
||||
QUnit.test('should add data attribute for referencing original title', function (assert) {
|
||||
assert.expect(1)
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>').bootstrapTooltip()
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip()
|
||||
|
||||
assert.strictEqual($trigger.attr('data-original-title'), 'Another tooltip', 'original title preserved in data attribute')
|
||||
})
|
||||
|
||||
QUnit.test('should add aria-describedby to the trigger on show', function (assert) {
|
||||
assert.expect(3)
|
||||
var done = assert.async()
|
||||
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.bootstrapTooltip()
|
||||
.appendTo('#qunit-fixture')
|
||||
|
||||
$trigger
|
||||
.bootstrapTooltip()
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var id = $('.tooltip').attr('id')
|
||||
|
||||
assert.strictEqual($('#' + id).length, 1, 'has a unique id')
|
||||
assert.strictEqual($('.tooltip').attr('aria-describedby'), $trigger.attr('id'), 'tooltip id and aria-describedby on trigger match')
|
||||
assert.ok($trigger[0].hasAttribute('aria-describedby'), 'trigger has aria-describedby')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
var id = $('.tooltip').attr('id')
|
||||
|
||||
assert.strictEqual($('#' + id).length, 1, 'has a unique id')
|
||||
assert.strictEqual($('.tooltip').attr('aria-describedby'), $trigger.attr('id'), 'tooltip id and aria-describedby on trigger match')
|
||||
assert.ok($trigger[0].hasAttribute('aria-describedby'), 'trigger has aria-describedby')
|
||||
})
|
||||
|
||||
QUnit.test('should remove aria-describedby from trigger on hide', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $trigger = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.bootstrapTooltip()
|
||||
.appendTo('#qunit-fixture')
|
||||
|
||||
$trigger.bootstrapTooltip('show')
|
||||
assert.ok($trigger[0].hasAttribute('aria-describedby'), 'trigger has aria-describedby')
|
||||
|
||||
$trigger.bootstrapTooltip('hide')
|
||||
assert.ok(!$trigger[0].hasAttribute('aria-describedby'), 'trigger does not have aria-describedby')
|
||||
$trigger.one('shown.bs.tooltip', function () {
|
||||
assert.ok($trigger[0].hasAttribute('aria-describedby'), 'trigger has aria-describedby')
|
||||
$trigger.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.ok(!$trigger[0].hasAttribute('aria-describedby'), 'trigger does not have aria-describedby')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should assign a unique id tooltip element', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var id = $('.tooltip').attr('id')
|
||||
|
||||
assert.strictEqual($('#' + id).length, 1, 'tooltip has unique id')
|
||||
assert.strictEqual(id.indexOf('tooltip'), 0, 'tooltip id has prefix')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
var id = $('.tooltip').attr('id')
|
||||
|
||||
assert.strictEqual($('#' + id).length, 1, 'tooltip has unique id')
|
||||
assert.strictEqual(id.indexOf('tooltip'), 0, 'tooltip id has prefix')
|
||||
})
|
||||
|
||||
QUnit.test('should place tooltips relative to placement option', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip({ placement: 'bottom' })
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
})
|
||||
|
||||
QUnit.test('should allow html entities', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="<b>@fat</b>"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({ html: true })
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
$tooltip.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('.tooltip b').length, 0, 'b tag was inserted')
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should respect custom classes', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({ template: '<div class="tooltip some-class"><div class="tooltip-arrow"/><div class="tooltip-inner"/></div>' })
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
$tooltip.one('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').hasClass('some-class'), 'custom class is present')
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should fire show event', function (assert) {
|
||||
@@ -255,6 +296,8 @@ $(function () {
|
||||
|
||||
QUnit.test('should show tooltip with delegate selector on click', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var $div = $('<div><a href="#" rel="tooltip" title="Another tooltip"/></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({
|
||||
@@ -262,11 +305,16 @@ $(function () {
|
||||
trigger: 'click'
|
||||
})
|
||||
|
||||
$div.find('a').trigger('click')
|
||||
assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
|
||||
$div.one('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
|
||||
$div.find('a').trigger('click')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip was removed from dom')
|
||||
done()
|
||||
})
|
||||
|
||||
$div.find('a').trigger('click')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip was removed from dom')
|
||||
})
|
||||
|
||||
QUnit.test('should show tooltip when toggle is called', function (assert) {
|
||||
@@ -292,16 +340,22 @@ $(function () {
|
||||
|
||||
QUnit.test('should place tooltips inside body when container is body', function (assert) {
|
||||
assert.expect(3)
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" rel="tooltip" title="Another tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({ container: 'body' })
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
||||
assert.strictEqual($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
|
||||
|
||||
$(this).bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('body > .tooltip').length, 0, 'tooltip was removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
assert.notEqual($('body > .tooltip').length, 0, 'tooltip is direct descendant of body')
|
||||
assert.strictEqual($('#qunit-fixture > .tooltip').length, 0, 'tooltip is not in parent')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('body > .tooltip').length, 0, 'tooltip was removed from dom')
|
||||
})
|
||||
|
||||
QUnit.test('should add position class before positioning so that position-specific styles are taken into account', function (assert) {
|
||||
@@ -335,49 +389,68 @@ $(function () {
|
||||
|
||||
QUnit.test('should use title attribute for tooltip text', function (assert) {
|
||||
assert.expect(2)
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip"/>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" rel="tooltip" title="Simple tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip()
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title from title attribute is set')
|
||||
$(this).bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
})
|
||||
|
||||
QUnit.test('should prefer title attribute over title option', function (assert) {
|
||||
assert.expect(2)
|
||||
var $tooltip = $('<a href="#" rel="tooltip" title="Simple tooltip"/>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" rel="tooltip" title="Simple tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({
|
||||
title: 'This is a tooltip with some content'
|
||||
})
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while preferred over title option')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'Simple tooltip', 'title is set from title attribute while preferred over title option')
|
||||
$(this).bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should use title option', function (assert) {
|
||||
assert.expect(2)
|
||||
var $tooltip = $('<a href="#" rel="tooltip"/>')
|
||||
var done = assert.async()
|
||||
|
||||
$('<a href="#" rel="tooltip"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapTooltip({
|
||||
title: 'This is a tooltip with some content'
|
||||
})
|
||||
|
||||
$tooltip.bootstrapTooltip('show')
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
|
||||
|
||||
$tooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').children('.tooltip-inner').text(), 'This is a tooltip with some content', 'title from title option is set')
|
||||
$(this).bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should be placed dynamically to viewport with the dynamic placement option', function (assert) {
|
||||
assert.expect(6)
|
||||
var done = assert.async()
|
||||
|
||||
var $style = $('<style> div[rel="tooltip"] { position: absolute; } #qunit-fixture { top: inherit; left: inherit } </style>').appendTo('head')
|
||||
var $container = $('<div/>')
|
||||
.css({
|
||||
@@ -390,38 +463,71 @@ $(function () {
|
||||
.appendTo($container)
|
||||
.bootstrapTooltip({ placement: 'auto', viewport: '#qunit-fixture' })
|
||||
|
||||
$topTooltip.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
var topDone = false
|
||||
var rightDone = false
|
||||
var leftDone = false
|
||||
|
||||
$topTooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'top positioned tooltip removed from dom')
|
||||
function isDone() {
|
||||
if (topDone && rightDone && leftDone) {
|
||||
$container.remove()
|
||||
$style.remove()
|
||||
done()
|
||||
}
|
||||
}
|
||||
|
||||
var $rightTooltip = $('<div style="right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>')
|
||||
function leftTooltip() {
|
||||
var $leftTooltip = $('<div style="left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
|
||||
.appendTo($container)
|
||||
.bootstrapTooltip({ placement: 'auto left', viewport: '#qunit-fixture' })
|
||||
|
||||
$leftTooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
|
||||
$leftTooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'left positioned tooltip removed from dom')
|
||||
leftDone = true
|
||||
isDone()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
}
|
||||
|
||||
function rightTooltip() {
|
||||
var $rightTooltip = $('<div style="right: 0;" rel="tooltip" title="Right tooltip">Right Dynamic Tooltip</div>')
|
||||
.appendTo($container)
|
||||
.bootstrapTooltip({ placement: 'right auto', viewport: '#qunit-fixture' })
|
||||
|
||||
$rightTooltip.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left')
|
||||
$rightTooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.in'), 'right positioned tooltip is dynamically positioned left')
|
||||
$rightTooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'right positioned tooltip removed from dom')
|
||||
rightDone = true
|
||||
leftTooltip()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
}
|
||||
|
||||
$rightTooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'right positioned tooltip removed from dom')
|
||||
|
||||
var $leftTooltip = $('<div style="left: 0;" rel="tooltip" title="Left tooltip">Left Dynamic Tooltip</div>')
|
||||
.appendTo($container)
|
||||
.bootstrapTooltip({ placement: 'auto left', viewport: '#qunit-fixture' })
|
||||
|
||||
$leftTooltip.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right')
|
||||
|
||||
$leftTooltip.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'left positioned tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$style.remove()
|
||||
$topTooltip
|
||||
.one('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
$topTooltip.bootstrapTooltip('hide')
|
||||
})
|
||||
.one('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'top positioned tooltip removed from dom')
|
||||
topDone = true
|
||||
rightTooltip()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should position tip on top if viewport has enough space and placement is "auto top"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ 'body { padding-top: 100px; }'
|
||||
+ '#section { height: 300px; border: 1px solid red; padding-top: 50px }'
|
||||
@@ -437,17 +543,23 @@ $(function () {
|
||||
viewport: '#section'
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should position tip on top if viewport has enough space and is not parent', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '#section { height: 300px; border: 1px solid red; margin-top: 100px; }'
|
||||
+ 'div[rel="tooltip"] { width: 150px; border: 1px solid blue; }'
|
||||
@@ -462,17 +574,23 @@ $(function () {
|
||||
viewport: '#qunit-fixture'
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.top'), 'top positioned tooltip is dynamically positioned to top')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should position tip on bottom if the tip\'s dimension exceeds the viewport area and placement is "auto top"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ 'body { padding-top: 100px; }'
|
||||
+ '#section { height: 300px; border: 1px solid red; }'
|
||||
@@ -488,17 +606,23 @@ $(function () {
|
||||
viewport: '#section'
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned to bottom')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should display the tip on top whenever scrollable viewport has enough room if the given placement is "auto top"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '#scrollable-div { height: 200px; overflow: auto; }'
|
||||
+ '.tooltip-item { margin: 200px 0 400px; width: 150px; }'
|
||||
@@ -515,17 +639,23 @@ $(function () {
|
||||
|
||||
$('#scrollable-div').scrollTop(100)
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should display the tip on bottom whenever scrollable viewport doesn\'t have enough room if the given placement is "auto top"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '#scrollable-div { height: 200px; overflow: auto; }'
|
||||
+ '.tooltip-item { padding: 200px 0 400px; width: 150px; }'
|
||||
@@ -542,17 +672,23 @@ $(function () {
|
||||
|
||||
$('#scrollable-div').scrollTop(200)
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should display the tip on bottom whenever scrollable viewport has enough room if the given placement is "auto bottom"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '#scrollable-div { height: 200px; overflow: auto; }'
|
||||
+ '.spacer { height: 400px; }'
|
||||
@@ -573,17 +709,23 @@ $(function () {
|
||||
|
||||
$('#scrollable-div').scrollTop(200)
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.bottom.in'), 'has correct classes applied')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should display the tip on top whenever scrollable viewport doesn\'t have enough room if the given placement is "auto bottom"', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '#scrollable-div { height: 200px; overflow: auto; }'
|
||||
+ '.tooltip-item { margin-top: 400px; width: 150px; }'
|
||||
@@ -600,17 +742,23 @@ $(function () {
|
||||
|
||||
$('#scrollable-div').scrollTop(400)
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.ok($('.tooltip').is('.fade.top.in'), 'has correct classes applied')
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should adjust the tip\'s top position when up against the top of the viewport', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ 'a[rel="tooltip"] { position: fixed; }'
|
||||
@@ -628,17 +776,23 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().top), 12)
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().top), 12)
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should adjust the tip\'s top position when up against the bottom of the viewport', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ 'a[rel="tooltip"] { position: fixed; }'
|
||||
@@ -656,19 +810,31 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().top), Math.round($(window).height() - 12 - $tooltip[0].offsetHeight))
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
var padding = 50
|
||||
var result = Math.round($tooltip.offset().top)
|
||||
var resultMax = result + padding
|
||||
var resultMin = result - padding
|
||||
var expected = Math.round($(window).height() - 12 - $tooltip[0].offsetHeight)
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
assert.ok(expected < resultMax && expected > resultMin)
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should adjust the tip\'s left position when up against the left of the viewport', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ 'a[rel="tooltip"] { position: fixed; }'
|
||||
@@ -686,18 +852,24 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().left), 12)
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
assert.strictEqual(Math.round($container.find('.tooltip').offset().left), 12)
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should adjust the tip\'s left position when up against the right of the viewport', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ 'a[rel="tooltip"] { position: fixed; }'
|
||||
@@ -715,19 +887,25 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($(window).width() - 12 - $tooltip[0].offsetWidth))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($(window).width() - 12 - $tooltip[0].offsetWidth))
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should adjust the tip when up against the right of an arbitrary viewport', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip, .tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ '.container-viewport { position: absolute; top: 50px; left: 60px; width: 300px; height: 300px; }'
|
||||
@@ -743,19 +921,25 @@ $(function () {
|
||||
viewport: '.container-viewport'
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should get viewport element from function', function (assert) {
|
||||
assert.expect(3)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip, .tooltip .tooltip-inner { width: 200px; height: 200px; max-width: none; }'
|
||||
+ '.container-viewport { position: absolute; top: 50px; left: 60px; width: 300px; height: 300px; }'
|
||||
@@ -774,19 +958,25 @@ $(function () {
|
||||
}
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round(60 + $container.width() - $tooltip[0].offsetWidth))
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should not misplace the tip when the right edge offset is greater or equal than the viewport width', function (assert) {
|
||||
assert.expect(2)
|
||||
var done = assert.async()
|
||||
|
||||
var styles = '<style>'
|
||||
+ '.tooltip, .tooltip *, .tooltip *:before, .tooltip *:after { box-sizing: border-box; }'
|
||||
+ '.container-viewport, .container-viewport *, .container-viewport *:before, .container-viewport *:after { box-sizing: border-box; }'
|
||||
@@ -802,15 +992,21 @@ $(function () {
|
||||
viewport: '.container-viewport'
|
||||
})
|
||||
|
||||
$target.bootstrapTooltip('show')
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
assert.strictEqual(Math.round($tooltip.offset().left), Math.round($target.position().left + $target.width() / 2 - $tooltip[0].offsetWidth / 2))
|
||||
|
||||
$target.bootstrapTooltip('hide')
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
$target
|
||||
.on('shown.bs.tooltip', function () {
|
||||
var $tooltip = $container.find('.tooltip')
|
||||
var expected = Math.round($target.position().left + $target.width() / 2 - $tooltip[0].offsetWidth / 2)
|
||||
var result = Math.round($tooltip.offset().left)
|
||||
assert.ok(result === (expected - 1) || result === expected)
|
||||
$target.bootstrapTooltip('hide')
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
$container.remove()
|
||||
$styles.remove()
|
||||
done()
|
||||
})
|
||||
.bootstrapTooltip('show')
|
||||
})
|
||||
|
||||
QUnit.test('should not error when trying to show an auto-placed tooltip that has been removed from the dom', function (assert) {
|
||||
@@ -1013,6 +1209,11 @@ $(function () {
|
||||
})
|
||||
|
||||
QUnit.test('should wait 200ms before hiding the tooltip', function (assert) {
|
||||
if (window.__karma__) {
|
||||
assert.expect(0)
|
||||
return
|
||||
}
|
||||
|
||||
assert.expect(3)
|
||||
var done = assert.async()
|
||||
|
||||
@@ -1070,6 +1271,9 @@ $(function () {
|
||||
$styles.remove()
|
||||
assert.ok(Math.abs(offset.left - 88) <= 1, 'tooltip has correct horizontal location')
|
||||
$circle.bootstrapTooltip('hide')
|
||||
|
||||
})
|
||||
.on('hidden.bs.tooltip', function () {
|
||||
assert.strictEqual($('.tooltip').length, 0, 'tooltip removed from dom')
|
||||
done()
|
||||
})
|
||||
@@ -1218,10 +1422,11 @@ $(function () {
|
||||
|
||||
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)) {
|
||||
if ((!('transform' in styleProps) && !('webkitTransform' in styleProps) && !('msTransform' in styleProps)) || window.__karma__) {
|
||||
assert.expect(0)
|
||||
return
|
||||
}
|
||||
|
||||
assert.expect(2)
|
||||
|
||||
var done = assert.async()
|
||||
|
||||
Vendored
-305
@@ -1,305 +0,0 @@
|
||||
/*!
|
||||
* QUnit 1.22.0
|
||||
* https://qunitjs.com/
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2016-02-23T15:57Z
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-filteredTest, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699A4;
|
||||
background-color: #0D3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: 400;
|
||||
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #C2CCD1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar label {
|
||||
display: inline-block;
|
||||
padding: 0 0.5em 0 0.1em;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 1em 0.5em 1em;
|
||||
color: #5E740B;
|
||||
background-color: #EEE;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#qunit-filteredTest {
|
||||
padding: 0.5em 1em 0.5em 1em;
|
||||
background-color: #F4FF77;
|
||||
color: #366097;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 1em 0.5em 1em;
|
||||
background-color: #2B81AF;
|
||||
color: #FFF;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
#qunit-modulefilter-container {
|
||||
float: right;
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
.qunit-url-config {
|
||||
display: inline-block;
|
||||
padding: 0.1em;
|
||||
}
|
||||
|
||||
.qunit-filter {
|
||||
display: block;
|
||||
float: right;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 1em 0.4em 1em;
|
||||
border-bottom: 1px solid #FFF;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests > li {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li.running,
|
||||
#qunit-tests li.pass,
|
||||
#qunit-tests li.fail,
|
||||
#qunit-tests li.skipped {
|
||||
display: list-item;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.running,
|
||||
#qunit-tests.hidepass li.pass {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li.skipped strong {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #C2CCD1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests li p a {
|
||||
padding: 0.25em;
|
||||
color: #6B6464;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests li .runtime {
|
||||
float: right;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.qunit-assert-list {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #FFF;
|
||||
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.qunit-source {
|
||||
margin: 0.6em 0 0.3em;
|
||||
}
|
||||
|
||||
.qunit-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 0.5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #E0F2BE;
|
||||
color: #374E0C;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #FFCACA;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: #000; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
padding: 5px;
|
||||
background-color: #FFF;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #3C510C;
|
||||
background-color: #FFF;
|
||||
border-left: 10px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #FFF;
|
||||
border-left: 10px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: #008000; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
/*** Skipped tests */
|
||||
|
||||
#qunit-tests .skipped {
|
||||
background-color: #EBECE9;
|
||||
}
|
||||
|
||||
#qunit-tests .qunit-skipped-label {
|
||||
background-color: #F4FF77;
|
||||
display: inline-block;
|
||||
font-style: normal;
|
||||
color: #366097;
|
||||
line-height: 1.8em;
|
||||
padding: 0 0.5em;
|
||||
margin: -0.4em 0.4em -0.4em 0;
|
||||
}
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 1em 0.5em 1em;
|
||||
|
||||
color: #2B81AF;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid #FFF;
|
||||
}
|
||||
#qunit-testresult .module-name {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
||||
Vendored
-4204
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user