mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-19 03:41:19 +02:00
Merge branch 'master' into v4
Conflicts: .travis.yml Gruntfile.js bower.json dist/css/bootstrap.css dist/css/bootstrap.css.map dist/css/bootstrap.min.css dist/js/bootstrap.js dist/js/bootstrap.min.js docs/_data/glyphicons.yml docs/_includes/components/breadcrumbs.html docs/_includes/components/button-dropdowns.html docs/_includes/components/button-groups.html docs/_includes/components/dropdowns.html docs/_includes/components/glyphicons.html docs/_includes/components/labels.html docs/_includes/components/list-group.html docs/_includes/components/media.html docs/_includes/components/navs.html docs/_includes/components/panels.html docs/_includes/components/progress-bars.html docs/_includes/components/thumbnails.html docs/_includes/components/wells.html docs/_includes/css/buttons.html docs/_includes/css/forms.html docs/_includes/css/helpers.html docs/_includes/css/images.html docs/_includes/css/less.html docs/_includes/customizer-variables.html docs/_includes/getting-started/accessibility.html docs/_includes/getting-started/browser-device-support.html docs/_includes/getting-started/community.html docs/_includes/getting-started/examples.html docs/_includes/getting-started/grunt.html docs/_includes/getting-started/license.html docs/_includes/getting-started/template.html docs/_includes/header.html docs/_includes/js/affix.html docs/_includes/js/alerts.html docs/_includes/js/carousel.html docs/_includes/js/collapse.html docs/_includes/js/dropdowns.html docs/_includes/js/modal.html docs/_includes/js/overview.html docs/_includes/js/popovers.html docs/_includes/js/scrollspy.html docs/_includes/js/tabs.html docs/_includes/js/tooltips.html docs/_includes/js/transitions.html docs/_includes/nav/javascript.html docs/_layouts/default.html docs/assets/css/docs.min.css docs/assets/css/src/docs.css docs/assets/js/customize.min.js docs/assets/js/docs.min.js docs/assets/js/raw-files.min.js docs/assets/js/vendor/FileSaver.js docs/assets/js/vendor/autoprefixer.js docs/assets/js/vendor/uglify.min.js docs/dist/css/bootstrap.css docs/dist/css/bootstrap.css.map docs/dist/css/bootstrap.min.css docs/dist/js/bootstrap.min.js docs/examples/blog/index.html docs/examples/carousel/index.html docs/examples/cover/index.html docs/examples/dashboard/index.html docs/examples/narrow-jumbotron/narrow-jumbotron.css docs/examples/navbar-fixed-top/index.html docs/examples/navbar-static-top/index.html docs/examples/non-responsive/index.html docs/examples/non-responsive/non-responsive.css docs/examples/theme/index.html grunt/configBridge.json js/affix.js js/carousel.js js/collapse.js js/dropdown.js js/modal.js js/popover.js js/scrollspy.js js/tab.js js/tests/unit/affix.js js/tests/unit/button.js js/tests/unit/carousel.js js/tests/unit/modal.js js/tests/unit/tooltip.js js/tooltip.js less/badges.less less/glyphicons.less less/type.less less/variables.less package.json scss/_dropdown.scss scss/_forms.scss test-infra/npm-shrinkwrap.json
This commit is contained in:
@@ -12,10 +12,6 @@
|
||||
<link rel="stylesheet" href="vendor/qunit.css" media="screen">
|
||||
<script src="vendor/qunit.js"></script>
|
||||
<style>
|
||||
#qunit-tests > li.pass {
|
||||
display: none;/* Make it easier to see failing tests in Sauce screencasts */
|
||||
}
|
||||
|
||||
#qunit-fixture {
|
||||
top: 0;
|
||||
left: 0;
|
||||
@@ -43,12 +39,12 @@
|
||||
|
||||
QUnit.testStart(function (testDetails) {
|
||||
$(window).scrollTop(0)
|
||||
QUnit.log = function (details) {
|
||||
QUnit.log(function (details) {
|
||||
if (!details.result) {
|
||||
details.name = testDetails.name
|
||||
log.push(details)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// Cleanup
|
||||
|
@@ -1,35 +1,35 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('alert plugin')
|
||||
QUnit.module('alert plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).alert, 'alert method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).alert, 'alert method is defined')
|
||||
})
|
||||
|
||||
module('alert', {
|
||||
setup: function () {
|
||||
QUnit.module('alert', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapAlert = $.fn.alert.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.alert = $.fn.bootstrapAlert
|
||||
delete $.fn.bootstrapAlert
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.alert, undefined, 'alert was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.alert, undefined, 'alert was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $alert = $el.bootstrapAlert()
|
||||
ok($alert instanceof $, 'returns jquery collection')
|
||||
strictEqual($alert[0], $el[0], 'collection contains element')
|
||||
assert.ok($alert instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($alert[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should fade element out on clicking .close', function () {
|
||||
QUnit.test('should fade element out on clicking .close', function (assert) {
|
||||
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>'
|
||||
@@ -38,33 +38,33 @@ $(function () {
|
||||
|
||||
$alert.find('.close').click()
|
||||
|
||||
equal($alert.hasClass('in'), false, 'remove .in class on .close click')
|
||||
assert.strictEqual($alert.hasClass('in'), false, 'remove .in class on .close click')
|
||||
})
|
||||
|
||||
test('should remove element when clicking .close', function () {
|
||||
QUnit.test('should remove element when clicking .close', function (assert) {
|
||||
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>'
|
||||
+ '</div>'
|
||||
var $alert = $(alertHTML).appendTo('#qunit-fixture').bootstrapAlert()
|
||||
|
||||
notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
|
||||
assert.notEqual($('#qunit-fixture').find('.alert').length, 0, 'element added to dom')
|
||||
|
||||
$alert.find('.close').click()
|
||||
|
||||
equal($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
||||
assert.strictEqual($('#qunit-fixture').find('.alert').length, 0, 'element removed from dom')
|
||||
})
|
||||
|
||||
test('should not fire closed when close is prevented', function (assert) {
|
||||
QUnit.test('should not fire closed when close is prevented', function (assert) {
|
||||
var done = assert.async()
|
||||
$('<div class="alert"/>')
|
||||
.on('close.bs.alert', function (e) {
|
||||
e.preventDefault()
|
||||
ok(true, 'close event fired')
|
||||
assert.ok(true, 'close event fired')
|
||||
done()
|
||||
})
|
||||
.on('closed.bs.alert', function () {
|
||||
ok(false, 'closed event fired')
|
||||
assert.ok(false, 'closed event fired')
|
||||
})
|
||||
.bootstrapAlert('close')
|
||||
})
|
||||
|
@@ -1,78 +1,78 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('collapse plugin')
|
||||
QUnit.module('collapse plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).collapse, 'collapse method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).collapse, 'collapse method is defined')
|
||||
})
|
||||
|
||||
module('collapse', {
|
||||
setup: function () {
|
||||
QUnit.module('collapse', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapCollapse = $.fn.collapse.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.collapse = $.fn.bootstrapCollapse
|
||||
delete $.fn.bootstrapCollapse
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.collapse, undefined, 'collapse was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.collapse, undefined, 'collapse was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $collapse = $el.bootstrapCollapse()
|
||||
ok($collapse instanceof $, 'returns jquery collection')
|
||||
strictEqual($collapse[0], $el[0], 'collection contains element')
|
||||
assert.ok($collapse instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($collapse[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should show a collapsed element', function () {
|
||||
QUnit.test('should show a collapsed element', function (assert) {
|
||||
var $el = $('<div class="collapse"/>').bootstrapCollapse('show')
|
||||
|
||||
ok($el.hasClass('in'), 'has class "in"')
|
||||
ok(!/height/i.test($el.attr('style')), 'has height reset')
|
||||
assert.ok($el.hasClass('in'), 'has class "in"')
|
||||
assert.ok(!/height/i.test($el.attr('style')), 'has height reset')
|
||||
})
|
||||
|
||||
test('should hide a collapsed element', function () {
|
||||
QUnit.test('should hide a collapsed element', function (assert) {
|
||||
var $el = $('<div class="collapse"/>').bootstrapCollapse('hide')
|
||||
|
||||
ok(!$el.hasClass('in'), 'does not have class "in"')
|
||||
ok(/height/i.test($el.attr('style')), 'has height set')
|
||||
assert.ok(!$el.hasClass('in'), 'does not have class "in"')
|
||||
assert.ok(/height/i.test($el.attr('style')), 'has height set')
|
||||
})
|
||||
|
||||
test('should not fire shown when show is prevented', function (assert) {
|
||||
QUnit.test('should not fire shown when show is prevented', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div class="collapse"/>')
|
||||
.on('show.bs.collapse', function (e) {
|
||||
e.preventDefault()
|
||||
ok(true, 'show event fired')
|
||||
assert.ok(true, 'show event fired')
|
||||
done()
|
||||
})
|
||||
.on('shown.bs.collapse', function () {
|
||||
ok(false, 'shown event fired')
|
||||
assert.ok(false, 'shown event fired')
|
||||
})
|
||||
.bootstrapCollapse('show')
|
||||
})
|
||||
|
||||
test('should reset style to auto after finishing opening collapse', function (assert) {
|
||||
QUnit.test('should reset style to auto after finishing opening collapse', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div class="collapse" style="height: 0px"/>')
|
||||
.on('show.bs.collapse', function () {
|
||||
equal(this.style.height, '0px', 'height is 0px')
|
||||
assert.strictEqual(this.style.height, '0px', 'height is 0px')
|
||||
})
|
||||
.on('shown.bs.collapse', function () {
|
||||
strictEqual(this.style.height, '', 'height is auto')
|
||||
assert.strictEqual(this.style.height, '', 'height is auto')
|
||||
done()
|
||||
})
|
||||
.bootstrapCollapse('show')
|
||||
})
|
||||
|
||||
test('should remove "collapsed" class from target when collapse is shown', function (assert) {
|
||||
QUnit.test('should remove "collapsed" class from target when collapse is shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" class="collapsed" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
@@ -80,14 +80,14 @@ $(function () {
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.collapse', function () {
|
||||
ok(!$target.hasClass('collapsed'))
|
||||
assert.ok(!$target.hasClass('collapsed'), 'target does not have collapsed class')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
test('should add "collapsed" class to target when collapse is hidden', function (assert) {
|
||||
QUnit.test('should add "collapsed" class to target when collapse is hidden', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
@@ -95,22 +95,56 @@ $(function () {
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.collapse', function () {
|
||||
ok($target.hasClass('collapsed'))
|
||||
assert.ok($target.hasClass('collapsed'), 'target has collapsed class')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
test('should not close a collapse when initialized with "show" if already shown', function (assert) {
|
||||
QUnit.test('should remove "collapsed" class from all triggers targeting the collapse when the collapse is shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
expect(0)
|
||||
var $target = $('<a data-toggle="collapse" class="collapsed" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
var $alt = $('<a data-toggle="collapse" class="collapsed" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.collapse', function () {
|
||||
assert.ok(!$target.hasClass('collapsed'), 'target trigger does not have collapsed class')
|
||||
assert.ok(!$alt.hasClass('collapsed'), 'alt trigger does not have collapsed class')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
QUnit.test('should add "collapsed" class to all triggers targeting the collapse when the collapse is hidden', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
var $alt = $('<a data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.collapse', function () {
|
||||
assert.ok($target.hasClass('collapsed'), 'target has collapsed class')
|
||||
assert.ok($alt.hasClass('collapsed'), 'alt trigger has collapsed class')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
QUnit.test('should not close a collapse when initialized with "show" if already shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
assert.expect(0)
|
||||
|
||||
var $test = $('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hide.bs.collapse', function () {
|
||||
ok(false)
|
||||
assert.ok(false)
|
||||
})
|
||||
|
||||
$test.bootstrapCollapse('show')
|
||||
@@ -118,15 +152,15 @@ $(function () {
|
||||
setTimeout(done, 0)
|
||||
})
|
||||
|
||||
test('should open a collapse when initialized with "show" if not already shown', function (assert) {
|
||||
QUnit.test('should open a collapse when initialized with "show" if not already shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
expect(1)
|
||||
assert.expect(1)
|
||||
|
||||
var $test = $('<div id="test1" />')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('show.bs.collapse', function () {
|
||||
ok(true)
|
||||
assert.ok(true)
|
||||
})
|
||||
|
||||
$test.bootstrapCollapse('show')
|
||||
@@ -134,7 +168,7 @@ $(function () {
|
||||
setTimeout(done, 0)
|
||||
})
|
||||
|
||||
test('should remove "collapsed" class from active accordion target', function (assert) {
|
||||
QUnit.test('should remove "collapsed" class from active accordion target', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var accordionHTML = '<div class="panel-group" id="accordion">'
|
||||
@@ -157,9 +191,9 @@ $(function () {
|
||||
$('<div id="body3"/>')
|
||||
.appendTo($groups.eq(2))
|
||||
.on('shown.bs.collapse', function () {
|
||||
ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
|
||||
ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
|
||||
ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
|
||||
assert.ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
|
||||
assert.ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
|
||||
assert.ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -167,7 +201,7 @@ $(function () {
|
||||
$target3.click()
|
||||
})
|
||||
|
||||
test('should allow dots in data-parent', function (assert) {
|
||||
QUnit.test('should allow dots in data-parent', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var accordionHTML = '<div class="panel-group accordion">'
|
||||
@@ -190,9 +224,9 @@ $(function () {
|
||||
$('<div id="body3"/>')
|
||||
.appendTo($groups.eq(2))
|
||||
.on('shown.bs.collapse', function () {
|
||||
ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
|
||||
ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
|
||||
ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
|
||||
assert.ok($target1.hasClass('collapsed'), 'inactive target 1 does have class "collapsed"')
|
||||
assert.ok($target2.hasClass('collapsed'), 'inactive target 2 does have class "collapsed"')
|
||||
assert.ok(!$target3.hasClass('collapsed'), 'active target 3 does not have class "collapsed"')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -200,7 +234,7 @@ $(function () {
|
||||
$target3.click()
|
||||
})
|
||||
|
||||
test('should set aria-expanded="true" on target when collapse is shown', function (assert) {
|
||||
QUnit.test('should set aria-expanded="true" on target when collapse is shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" class="collapsed" href="#test1" aria-expanded="false"/>').appendTo('#qunit-fixture')
|
||||
@@ -208,14 +242,14 @@ $(function () {
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.collapse', function () {
|
||||
equal($target.attr('aria-expanded'), 'true', 'aria-expanded on target is "true"')
|
||||
assert.strictEqual($target.attr('aria-expanded'), 'true', 'aria-expanded on target is "true"')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
test('should set aria-expanded="false" on target when collapse is hidden', function (assert) {
|
||||
QUnit.test('should set aria-expanded="false" on target when collapse is hidden', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
|
||||
@@ -223,14 +257,48 @@ $(function () {
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.collapse', function () {
|
||||
equal($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
|
||||
assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
test('should change aria-expanded from active accordion target to "false" and set the newly active one to "true"', function (assert) {
|
||||
QUnit.test('should set aria-expanded="true" on all triggers targeting the collapse when the collapse is shown', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" class="collapsed" href="#test1" aria-expanded="false"/>').appendTo('#qunit-fixture')
|
||||
var $alt = $('<a data-toggle="collapse" class="collapsed" href="#test1" aria-expanded="false"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.collapse', function () {
|
||||
assert.strictEqual($target.attr('aria-expanded'), 'true', 'aria-expanded on target is "true"')
|
||||
assert.strictEqual($alt.attr('aria-expanded'), 'true', 'aria-expanded on alt is "true"')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
QUnit.test('should set aria-expanded="false" on all triggers targeting the collapse when the collapse is hidden', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
|
||||
var $alt = $('<a data-toggle="collapse" href="#test1" aria-expanded="true"/>').appendTo('#qunit-fixture')
|
||||
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.collapse', function () {
|
||||
assert.strictEqual($target.attr('aria-expanded'), 'false', 'aria-expanded on target is "false"')
|
||||
assert.strictEqual($alt.attr('aria-expanded'), 'false', 'aria-expanded on alt is "false"')
|
||||
done()
|
||||
})
|
||||
|
||||
$target.click()
|
||||
})
|
||||
|
||||
QUnit.test('should change aria-expanded from active accordion target to "false" and set the newly active one to "true"', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var accordionHTML = '<div class="panel-group" id="accordion">'
|
||||
@@ -253,9 +321,9 @@ $(function () {
|
||||
$('<div id="body3" aria-expanded="false"/>')
|
||||
.appendTo($groups.eq(2))
|
||||
.on('shown.bs.collapse', function () {
|
||||
equal($target1.attr('aria-expanded'), 'false', 'inactive target 1 has aria-expanded="false"')
|
||||
equal($target2.attr('aria-expanded'), 'false', 'inactive target 2 has aria-expanded="false"')
|
||||
equal($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
||||
assert.strictEqual($target1.attr('aria-expanded'), 'false', 'inactive target 1 has aria-expanded="false"')
|
||||
assert.strictEqual($target2.attr('aria-expanded'), 'false', 'inactive target 2 has aria-expanded="false"')
|
||||
assert.strictEqual($target3.attr('aria-expanded'), 'true', 'active target 3 has aria-expanded="false"')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -263,7 +331,7 @@ $(function () {
|
||||
$target3.click()
|
||||
})
|
||||
|
||||
test('should not fire show event if show is prevented because other element is still transitioning', function (assert) {
|
||||
QUnit.test('should not fire show event if show is prevented because other element is still transitioning', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var accordionHTML = '<div id="accordion">'
|
||||
@@ -293,12 +361,12 @@ $(function () {
|
||||
$target1.click()
|
||||
|
||||
setTimeout(function () {
|
||||
ok(!showFired, 'show event didn\'t fire')
|
||||
assert.ok(!showFired, 'show event did not fire')
|
||||
done()
|
||||
}, 1)
|
||||
})
|
||||
|
||||
test('should add "collapsed" class to target when collapse is hidden via manual invocation', function (assert) {
|
||||
QUnit.test('should add "collapsed" class to target when collapse is hidden via manual invocation', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
@@ -306,13 +374,13 @@ $(function () {
|
||||
$('<div id="test1" class="in"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('hidden.bs.collapse', function () {
|
||||
ok($target.hasClass('collapsed'))
|
||||
assert.ok($target.hasClass('collapsed'))
|
||||
done()
|
||||
})
|
||||
.bootstrapCollapse('hide')
|
||||
})
|
||||
|
||||
test('should remove "collapsed" class from target when collapse is shown via manual invocation', function (assert) {
|
||||
QUnit.test('should remove "collapsed" class from target when collapse is shown via manual invocation', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var $target = $('<a data-toggle="collapse" class="collapsed" href="#test1"/>').appendTo('#qunit-fixture')
|
||||
@@ -320,7 +388,7 @@ $(function () {
|
||||
$('<div id="test1"/>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.on('shown.bs.collapse', function () {
|
||||
ok(!$target.hasClass('collapsed'))
|
||||
assert.ok(!$target.hasClass('collapsed'))
|
||||
done()
|
||||
})
|
||||
.bootstrapCollapse('show')
|
||||
|
@@ -1,35 +1,35 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('dropdowns plugin')
|
||||
QUnit.module('dropdowns plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).dropdown, 'dropdown method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).dropdown, 'dropdown method is defined')
|
||||
})
|
||||
|
||||
module('dropdowns', {
|
||||
setup: function () {
|
||||
QUnit.module('dropdowns', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapDropdown = $.fn.dropdown.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.dropdown = $.fn.bootstrapDropdown
|
||||
delete $.fn.bootstrapDropdown
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.dropdown, undefined, 'dropdown was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.dropdown, undefined, 'dropdown was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $dropdown = $el.bootstrapDropdown()
|
||||
ok($dropdown instanceof $, 'returns jquery collection')
|
||||
strictEqual($dropdown[0], $el[0], 'collection contains element')
|
||||
assert.ok($dropdown instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($dropdown[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should not open dropdown if target is disabled via attribute', function () {
|
||||
QUnit.test('should not open dropdown if target is disabled via attribute', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>'
|
||||
@@ -43,10 +43,59 @@ $(function () {
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().click()
|
||||
|
||||
ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
})
|
||||
|
||||
test('should not open dropdown if target is disabled via class', function () {
|
||||
QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">Dropdown</a>'
|
||||
+ '<ul class="dropdown-menu">'
|
||||
+ '<li><a href="#">Secondary link</a></li>'
|
||||
+ '<li><a href="#">Something else here</a></li>'
|
||||
+ '<li class="divider"/>'
|
||||
+ '<li><a href="#">Another link</a></li>'
|
||||
+ '</ul>'
|
||||
+ '</li>'
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML)
|
||||
.find('[data-toggle="dropdown"]')
|
||||
.bootstrapDropdown()
|
||||
.click()
|
||||
|
||||
assert.strictEqual($dropdown.attr('aria-expanded'), 'true', 'aria-expanded is set to string "true" on click')
|
||||
})
|
||||
|
||||
QUnit.test('should set aria-expanded="false" on target when dropdown menu is hidden', function (assert) {
|
||||
var done = assert.async()
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" aria-expanded="false" data-toggle="dropdown">Dropdown</a>'
|
||||
+ '<ul class="dropdown-menu">'
|
||||
+ '<li><a href="#">Secondary link</a></li>'
|
||||
+ '<li><a href="#">Something else here</a></li>'
|
||||
+ '<li class="divider"/>'
|
||||
+ '<li><a href="#">Another link</a></li>'
|
||||
+ '</ul>'
|
||||
+ '</li>'
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML)
|
||||
.appendTo('#qunit-fixture')
|
||||
.find('[data-toggle="dropdown"]')
|
||||
.bootstrapDropdown()
|
||||
|
||||
$dropdown
|
||||
.parent('.dropdown')
|
||||
.on('hidden.bs.dropdown', function () {
|
||||
assert.strictEqual($dropdown.attr('aria-expanded'), 'false', 'aria-expanded is set to string "false" on hide')
|
||||
done()
|
||||
})
|
||||
|
||||
$dropdown.click()
|
||||
$(document.body).click()
|
||||
})
|
||||
|
||||
QUnit.test('should not open dropdown if target is disabled via class', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>'
|
||||
@@ -60,10 +109,10 @@ $(function () {
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().click()
|
||||
|
||||
ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
})
|
||||
|
||||
test('should add class open to menu if clicked', function () {
|
||||
QUnit.test('should add class open to menu if clicked', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
@@ -77,10 +126,10 @@ $(function () {
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().click()
|
||||
|
||||
ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
})
|
||||
|
||||
test('should test if element has a # before assuming it\'s a selector', function () {
|
||||
QUnit.test('should test if element has a # before assuming it\'s a selector', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="/foo/" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
@@ -94,11 +143,11 @@ $(function () {
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().click()
|
||||
|
||||
ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
})
|
||||
|
||||
|
||||
test('should remove "open" class if body is clicked', function () {
|
||||
QUnit.test('should remove "open" class if body is clicked', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
@@ -116,12 +165,12 @@ $(function () {
|
||||
.bootstrapDropdown()
|
||||
.click()
|
||||
|
||||
ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
assert.ok($dropdown.parent('.dropdown').hasClass('open'), '"open" class added on click')
|
||||
$(document.body).click()
|
||||
ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class removed')
|
||||
assert.ok(!$dropdown.parent('.dropdown').hasClass('open'), '"open" class removed')
|
||||
})
|
||||
|
||||
test('should remove "open" class if body is clicked, with multiple dropdowns', function () {
|
||||
QUnit.test('should remove "open" class if body is clicked, with multiple dropdowns', function (assert) {
|
||||
var dropdownHTML = '<ul class="nav">'
|
||||
+ '<li><a href="#menu1">Menu 1</a></li>'
|
||||
+ '<li class="dropdown" id="testmenu">'
|
||||
@@ -142,22 +191,22 @@ $(function () {
|
||||
var $first = $dropdowns.first()
|
||||
var $last = $dropdowns.last()
|
||||
|
||||
strictEqual($dropdowns.length, 2, 'two dropdowns')
|
||||
assert.strictEqual($dropdowns.length, 2, 'two dropdowns')
|
||||
|
||||
$first.click()
|
||||
strictEqual($first.parents('.open').length, 1, '"open" class added on click')
|
||||
strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
|
||||
assert.strictEqual($first.parents('.open').length, 1, '"open" class added on click')
|
||||
assert.strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
|
||||
$(document.body).click()
|
||||
strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
|
||||
assert.strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
|
||||
|
||||
$last.click()
|
||||
strictEqual($last.parent('.open').length, 1, '"open" class added on click')
|
||||
strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
|
||||
assert.strictEqual($last.parent('.open').length, 1, '"open" class added on click')
|
||||
assert.strictEqual($('#qunit-fixture .open').length, 1, 'only one dropdown is open')
|
||||
$(document.body).click()
|
||||
strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
|
||||
assert.strictEqual($('#qunit-fixture .open').length, 0, '"open" class removed')
|
||||
})
|
||||
|
||||
test('should fire show and hide event', function (assert) {
|
||||
QUnit.test('should fire show and hide event', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
@@ -179,10 +228,10 @@ $(function () {
|
||||
$dropdown
|
||||
.parent('.dropdown')
|
||||
.on('show.bs.dropdown', function () {
|
||||
ok(true, 'show was fired')
|
||||
assert.ok(true, 'show was fired')
|
||||
})
|
||||
.on('hide.bs.dropdown', function () {
|
||||
ok(true, 'hide was fired')
|
||||
assert.ok(true, 'hide was fired')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -191,7 +240,7 @@ $(function () {
|
||||
})
|
||||
|
||||
|
||||
test('should fire shown and hidden event', function (assert) {
|
||||
QUnit.test('should fire shown and hidden event', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
@@ -213,10 +262,10 @@ $(function () {
|
||||
$dropdown
|
||||
.parent('.dropdown')
|
||||
.on('shown.bs.dropdown', function () {
|
||||
ok(true, 'shown was fired')
|
||||
assert.ok(true, 'shown was fired')
|
||||
})
|
||||
.on('hidden.bs.dropdown', function () {
|
||||
ok(true, 'hidden was fired')
|
||||
assert.ok(true, 'hidden was fired')
|
||||
done()
|
||||
})
|
||||
|
||||
@@ -224,7 +273,7 @@ $(function () {
|
||||
$(document.body).click()
|
||||
})
|
||||
|
||||
test('should ignore keyboard events within <input>s and <textarea>s', function (assert) {
|
||||
QUnit.test('should ignore keyboard events within <input>s and <textarea>s', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
@@ -251,13 +300,13 @@ $(function () {
|
||||
$dropdown
|
||||
.parent('.dropdown')
|
||||
.on('shown.bs.dropdown', function () {
|
||||
ok(true, 'shown was fired')
|
||||
assert.ok(true, 'shown was fired')
|
||||
|
||||
$input.focus().trigger($.Event('keydown', { which: 38 }))
|
||||
ok($(document.activeElement).is($input), 'input still focused')
|
||||
assert.ok($(document.activeElement).is($input), 'input still focused')
|
||||
|
||||
$textarea.focus().trigger($.Event('keydown', { which: 38 }))
|
||||
ok($(document.activeElement).is($textarea), 'textarea still focused')
|
||||
assert.ok($(document.activeElement).is($textarea), 'textarea still focused')
|
||||
|
||||
done()
|
||||
})
|
||||
@@ -265,4 +314,25 @@ $(function () {
|
||||
$dropdown.click()
|
||||
})
|
||||
|
||||
QUnit.test('should skip disabled element when using keyboard navigation', function (assert) {
|
||||
var dropdownHTML = '<ul class="tabs">'
|
||||
+ '<li class="dropdown">'
|
||||
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||
+ '<ul class="dropdown-menu" role="menu">'
|
||||
+ '<li class="disabled"><a href="#">Disabled link</a></li>'
|
||||
+ '<li><a href="#">Another link</a></li>'
|
||||
+ '</ul>'
|
||||
+ '</li>'
|
||||
+ '</ul>'
|
||||
var $dropdown = $(dropdownHTML)
|
||||
.appendTo('#qunit-fixture')
|
||||
.find('[data-toggle="dropdown"]')
|
||||
.bootstrapDropdown()
|
||||
.click()
|
||||
|
||||
$dropdown.trigger($.Event('keydown', { which: 40 }))
|
||||
$dropdown.trigger($.Event('keydown', { which: 40 }))
|
||||
|
||||
assert.ok(!$(document.activeElement).parent().is('.disabled'), '.disabled is not focused')
|
||||
})
|
||||
})
|
||||
|
@@ -31,8 +31,8 @@
|
||||
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.jsDump.parse(obj.actual)
|
||||
expected = QUnit.jsDump.parse(obj.expected)
|
||||
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)
|
||||
|
@@ -1,61 +1,61 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('popover plugin')
|
||||
QUnit.module('popover plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).popover, 'popover method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).popover, 'popover method is defined')
|
||||
})
|
||||
|
||||
module('popover', {
|
||||
setup: function () {
|
||||
QUnit.module('popover', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapPopover = $.fn.popover.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.popover = $.fn.bootstrapPopover
|
||||
delete $.fn.bootstrapPopover
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.popover, undefined, 'popover was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.popover, undefined, 'popover was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $popover = $el.bootstrapPopover()
|
||||
ok($popover instanceof $, 'returns jquery collection')
|
||||
strictEqual($popover[0], $el[0], 'collection contains element')
|
||||
assert.ok($popover instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($popover[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should render popover element', function () {
|
||||
QUnit.test('should render popover element', function (assert) {
|
||||
var $popover = $('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover('show')
|
||||
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
$popover.bootstrapPopover('hide')
|
||||
equal($('.popover').length, 0, 'popover removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover removed')
|
||||
})
|
||||
|
||||
test('should store popover instance in popover data object', function () {
|
||||
QUnit.test('should store popover instance in popover data object', function (assert) {
|
||||
var $popover = $('<a href="#" title="mdo" data-content="https://twitter.com/mdo">@mdo</a>').bootstrapPopover()
|
||||
|
||||
ok($popover.data('bs.popover'), 'popover instance exists')
|
||||
assert.ok($popover.data('bs.popover'), 'popover instance exists')
|
||||
})
|
||||
|
||||
test('should store popover trigger in popover instance data object', function () {
|
||||
QUnit.test('should store popover trigger in popover instance data object', function (assert) {
|
||||
var $popover = $('<a href="#" title="ResentedHook">@ResentedHook</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover()
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
ok($('.popover').data('bs.popover'), 'popover trigger stored in instance data')
|
||||
assert.ok($('.popover').data('bs.popover'), 'popover trigger stored in instance data')
|
||||
})
|
||||
|
||||
test('should get title and content from options', function () {
|
||||
QUnit.test('should get title and content from options', function (assert) {
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -69,15 +69,15 @@ $(function () {
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
equal($('.popover .popover-title').text(), '@fat', 'title correctly inserted')
|
||||
equal($('.popover .popover-content').text(), 'loves writing tests (╯°□°)╯︵ ┻━┻', 'content correctly inserted')
|
||||
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')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
test('should not duplicate HTML object', function () {
|
||||
QUnit.test('should not duplicate HTML object', function (assert) {
|
||||
var $div = $('<div/>').html('loves writing tests (╯°□°)╯︵ ┻━┻')
|
||||
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
@@ -89,36 +89,36 @@ $(function () {
|
||||
})
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.equal($('.popover .popover-content').html(), $div, 'content correctly inserted')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
test('should get title and content from attributes', function () {
|
||||
QUnit.test('should get title and content from attributes', function (assert) {
|
||||
var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover()
|
||||
.bootstrapPopover('show')
|
||||
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
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')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
|
||||
test('should get title and content from attributes ignoring options passed via js', function () {
|
||||
QUnit.test('should get title and content from attributes ignoring options passed via js', function (assert) {
|
||||
var $popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -127,15 +127,15 @@ $(function () {
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
equal($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
equal($('.popover .popover-content').text(), 'loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻', 'content correctly inserted')
|
||||
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')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
test('should respect custom template', function () {
|
||||
QUnit.test('should respect custom template', function (assert) {
|
||||
var $popover = $('<a href="#">@fat</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -146,34 +146,34 @@ $(function () {
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.ok($('.popover').hasClass('foobar'), 'custom class is present')
|
||||
|
||||
$popover.bootstrapPopover('hide')
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
test('should destroy popover', function () {
|
||||
QUnit.test('should destroy popover', function (assert) {
|
||||
var $popover = $('<div/>')
|
||||
.bootstrapPopover({
|
||||
trigger: 'hover'
|
||||
})
|
||||
.on('click.foo', $.noop)
|
||||
|
||||
ok($popover.data('bs.popover'), 'popover has data')
|
||||
ok($._data($popover[0], 'events').mouseover && $._data($popover[0], 'events').mouseout, 'popover has hover event')
|
||||
equal($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
||||
assert.ok($popover.data('bs.popover'), 'popover has data')
|
||||
assert.ok($._data($popover[0], 'events').mouseover && $._data($popover[0], 'events').mouseout, 'popover has hover event')
|
||||
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover has extra click.foo event')
|
||||
|
||||
$popover.bootstrapPopover('show')
|
||||
$popover.bootstrapPopover('destroy')
|
||||
|
||||
ok(!$popover.hasClass('in'), 'popover is hidden')
|
||||
ok(!$popover.data('popover'), 'popover does not have data')
|
||||
equal($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
|
||||
ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
|
||||
assert.ok(!$popover.hasClass('in'), 'popover is hidden')
|
||||
assert.ok(!$popover.data('popover'), 'popover does not have data')
|
||||
assert.strictEqual($._data($popover[0], 'events').click[0].namespace, 'foo', 'popover still has click.foo')
|
||||
assert.ok(!$._data($popover[0], 'events').mouseover && !$._data($popover[0], 'events').mouseout, 'popover does not have any events')
|
||||
})
|
||||
|
||||
test('should render popover element using delegated selector', function () {
|
||||
QUnit.test('should render popover element using delegated selector', function (assert) {
|
||||
var $div = $('<div><a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a></div>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.bootstrapPopover({
|
||||
@@ -182,13 +182,13 @@ $(function () {
|
||||
})
|
||||
|
||||
$div.find('a').click()
|
||||
notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
assert.notEqual($('.popover').length, 0, 'popover was inserted')
|
||||
|
||||
$div.find('a').click()
|
||||
equal($('.popover').length, 0, 'popover was removed')
|
||||
assert.strictEqual($('.popover').length, 0, 'popover was removed')
|
||||
})
|
||||
|
||||
test('should detach popover content rather than removing it so that event handlers are left intact', function (assert) {
|
||||
QUnit.test('should detach popover content rather than removing it so that event handlers are left intact', function (assert) {
|
||||
var $content = $('<div class="content-with-handler"><a class="btn btn-warning">Button with event handler</a></div>').appendTo('#qunit-fixture')
|
||||
|
||||
var handlerCalled = false
|
||||
@@ -216,7 +216,7 @@ $(function () {
|
||||
.one('shown.bs.popover', function () {
|
||||
$('.content-with-handler .btn').click()
|
||||
$div.bootstrapPopover('destroy')
|
||||
ok(handlerCalled, 'content\'s event handler still present')
|
||||
assert.ok(handlerCalled, 'content\'s event handler still present')
|
||||
done()
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
@@ -225,4 +225,11 @@ $(function () {
|
||||
})
|
||||
.bootstrapPopover('show')
|
||||
})
|
||||
|
||||
QUnit.test('should throw an error when initializing popover on the document object without specifying a delegation selector', function (assert) {
|
||||
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!'))
|
||||
})
|
||||
|
||||
})
|
||||
|
@@ -1,35 +1,35 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('scrollspy plugin')
|
||||
QUnit.module('scrollspy plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).scrollspy, 'scrollspy method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).scrollspy, 'scrollspy method is defined')
|
||||
})
|
||||
|
||||
module('scrollspy', {
|
||||
setup: function () {
|
||||
QUnit.module('scrollspy', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapScrollspy = $.fn.scrollspy.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.scrollspy = $.fn.bootstrapScrollspy
|
||||
delete $.fn.bootstrapScrollspy
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.scrollspy, undefined, 'scrollspy was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.scrollspy, undefined, 'scrollspy was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $scrollspy = $el.bootstrapScrollspy()
|
||||
ok($scrollspy instanceof $, 'returns jquery collection')
|
||||
strictEqual($scrollspy[0], $el[0], 'collection contains element')
|
||||
assert.ok($scrollspy instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($scrollspy[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should only switch "active" class on current target', function (assert) {
|
||||
QUnit.test('should only switch "active" class on current target', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var sectionHTML = '<div id="root" class="active">'
|
||||
@@ -66,14 +66,14 @@ $(function () {
|
||||
.bootstrapScrollspy({ target: '#ss-target' })
|
||||
|
||||
$scrollspy.on('scroll.bs.scrollspy', function () {
|
||||
ok($section.hasClass('active'), '"active" class still on root node')
|
||||
assert.ok($section.hasClass('active'), '"active" class still on root node')
|
||||
done()
|
||||
})
|
||||
|
||||
$scrollspy.scrollTop(350)
|
||||
})
|
||||
|
||||
test('should correctly select middle navigation option when large offset is used', function (assert) {
|
||||
QUnit.test('should correctly select middle navigation option when large offset is used', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var sectionHTML = '<div id="header" style="height: 500px;"></div>'
|
||||
@@ -97,16 +97,16 @@ $(function () {
|
||||
$scrollspy.bootstrapScrollspy({ target: '#navigation', offset: $scrollspy.position().top })
|
||||
|
||||
$scrollspy.on('scroll.bs.scrollspy', function () {
|
||||
ok(!$section.find('#one-link').parent().hasClass('active'), '"active" class removed from first section')
|
||||
ok($section.find('#two-link').parent().hasClass('active'), '"active" class on middle section')
|
||||
ok(!$section.find('#three-link').parent().hasClass('active'), '"active" class not on last section')
|
||||
assert.ok(!$section.find('#one-link').parent().hasClass('active'), '"active" class removed from first section')
|
||||
assert.ok($section.find('#two-link').parent().hasClass('active'), '"active" class on middle section')
|
||||
assert.ok(!$section.find('#three-link').parent().hasClass('active'), '"active" class not on last section')
|
||||
done()
|
||||
})
|
||||
|
||||
$scrollspy.scrollTop(550)
|
||||
})
|
||||
|
||||
test('should add the active class to the correct element', function (assert) {
|
||||
QUnit.test('should add the active class to the correct element', function (assert) {
|
||||
var navbarHtml =
|
||||
'<nav class="navbar">'
|
||||
+ '<ul class="nav">'
|
||||
@@ -130,7 +130,7 @@ $(function () {
|
||||
var scrollHeight = Math.ceil($content.scrollTop() + $(target).position().top)
|
||||
var done = assert.async()
|
||||
$content.one('scroll', function () {
|
||||
ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
assert.ok($(element).hasClass('active'), 'target:' + target + ', element' + element)
|
||||
done()
|
||||
deferred.resolve()
|
||||
})
|
||||
@@ -142,7 +142,7 @@ $(function () {
|
||||
.then(function () { return testElementIsActiveAfterScroll('#li-2', '#div-2') })
|
||||
})
|
||||
|
||||
test('should clear selection if above the first section', function (assert) {
|
||||
QUnit.test('should clear selection if above the first section', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var sectionHTML = '<div id="header" style="height: 500px;"></div>'
|
||||
@@ -170,12 +170,12 @@ $(function () {
|
||||
offset: $scrollspy.position().top
|
||||
})
|
||||
.one('scroll.bs.scrollspy', function () {
|
||||
strictEqual($('.active').length, 1, '"active" class on only one element present')
|
||||
strictEqual($('.active').has('#two-link').length, 1, '"active" class on second section')
|
||||
assert.strictEqual($('.active').length, 1, '"active" class on only one element present')
|
||||
assert.strictEqual($('.active').has('#two-link').length, 1, '"active" class on second section')
|
||||
|
||||
$scrollspy
|
||||
.one('scroll.bs.scrollspy', function () {
|
||||
strictEqual($('.active').length, 0, 'selection cleared')
|
||||
assert.strictEqual($('.active').length, 0, 'selection cleared')
|
||||
done()
|
||||
})
|
||||
.scrollTop(0)
|
||||
|
@@ -1,35 +1,35 @@
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
module('tabs plugin')
|
||||
QUnit.module('tabs plugin')
|
||||
|
||||
test('should be defined on jquery object', function () {
|
||||
ok($(document.body).tab, 'tabs method is defined')
|
||||
QUnit.test('should be defined on jquery object', function (assert) {
|
||||
assert.ok($(document.body).tab, 'tabs method is defined')
|
||||
})
|
||||
|
||||
module('tabs', {
|
||||
setup: function () {
|
||||
QUnit.module('tabs', {
|
||||
beforeEach: function () {
|
||||
// Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
|
||||
$.fn.bootstrapTab = $.fn.tab.noConflict()
|
||||
},
|
||||
teardown: function () {
|
||||
afterEach: function () {
|
||||
$.fn.tab = $.fn.bootstrapTab
|
||||
delete $.fn.bootstrapTab
|
||||
}
|
||||
})
|
||||
|
||||
test('should provide no conflict', function () {
|
||||
strictEqual($.fn.tab, undefined, 'tab was set back to undefined (org value)')
|
||||
QUnit.test('should provide no conflict', function (assert) {
|
||||
assert.strictEqual($.fn.tab, undefined, 'tab was set back to undefined (org value)')
|
||||
})
|
||||
|
||||
test('should return jquery collection containing the element', function () {
|
||||
QUnit.test('should return jquery collection containing the element', function (assert) {
|
||||
var $el = $('<div/>')
|
||||
var $tab = $el.bootstrapTab()
|
||||
ok($tab instanceof $, 'returns jquery collection')
|
||||
strictEqual($tab[0], $el[0], 'collection contains element')
|
||||
assert.ok($tab instanceof $, 'returns jquery collection')
|
||||
assert.strictEqual($tab[0], $el[0], 'collection contains element')
|
||||
})
|
||||
|
||||
test('should activate element by tab id', function () {
|
||||
QUnit.test('should activate element by tab id', function (assert) {
|
||||
var tabsHTML = '<ul class="tabs">'
|
||||
+ '<li><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
@@ -38,13 +38,13 @@ $(function () {
|
||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||
|
||||
$(tabsHTML).find('li:last a').bootstrapTab('show')
|
||||
equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||
|
||||
$(tabsHTML).find('li:first a').bootstrapTab('show')
|
||||
equal($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||
})
|
||||
|
||||
test('should activate element by tab id', function () {
|
||||
QUnit.test('should activate element by tab id', function (assert) {
|
||||
var pillsHTML = '<ul class="pills">'
|
||||
+ '<li><a href="#home">Home</a></li>'
|
||||
+ '<li><a href="#profile">Profile</a></li>'
|
||||
@@ -53,28 +53,28 @@ $(function () {
|
||||
$('<ul><li id="home"/><li id="profile"/></ul>').appendTo('#qunit-fixture')
|
||||
|
||||
$(pillsHTML).find('li:last a').bootstrapTab('show')
|
||||
equal($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'profile')
|
||||
|
||||
$(pillsHTML).find('li:first a').bootstrapTab('show')
|
||||
equal($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||
assert.strictEqual($('#qunit-fixture').find('.active').attr('id'), 'home')
|
||||
})
|
||||
|
||||
test('should not fire shown when show is prevented', function (assert) {
|
||||
QUnit.test('should not fire shown when show is prevented', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
$('<div class="tab"/>')
|
||||
.on('show.bs.tab', function (e) {
|
||||
e.preventDefault()
|
||||
ok(true, 'show event fired')
|
||||
assert.ok(true, 'show event fired')
|
||||
done()
|
||||
})
|
||||
.on('shown.bs.tab', function () {
|
||||
ok(false, 'shown event fired')
|
||||
assert.ok(false, 'shown event fired')
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
})
|
||||
|
||||
test('show and shown events should reference correct relatedTarget', function (assert) {
|
||||
QUnit.test('show and shown events should reference correct relatedTarget', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var dropHTML = '<ul class="drop">'
|
||||
@@ -92,16 +92,16 @@ $(function () {
|
||||
.end()
|
||||
.find('ul > li:last a')
|
||||
.on('show.bs.tab', function (e) {
|
||||
equal(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||
assert.strictEqual(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||
})
|
||||
.on('shown.bs.tab', function (e) {
|
||||
equal(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||
assert.strictEqual(e.relatedTarget.hash, '#1-1', 'references correct element as relatedTarget')
|
||||
done()
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
})
|
||||
|
||||
test('should fire hide and hidden events', function (assert) {
|
||||
QUnit.test('should fire hide and hidden events', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var tabsHTML = '<ul class="tabs">'
|
||||
@@ -112,7 +112,7 @@ $(function () {
|
||||
$(tabsHTML)
|
||||
.find('li:first a')
|
||||
.on('hide.bs.tab', function () {
|
||||
ok(true, 'hide event fired')
|
||||
assert.ok(true, 'hide event fired')
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
.end()
|
||||
@@ -122,7 +122,7 @@ $(function () {
|
||||
$(tabsHTML)
|
||||
.find('li:first a')
|
||||
.on('hidden.bs.tab', function () {
|
||||
ok(true, 'hidden event fired')
|
||||
assert.ok(true, 'hidden event fired')
|
||||
done()
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
@@ -131,7 +131,7 @@ $(function () {
|
||||
.bootstrapTab('show')
|
||||
})
|
||||
|
||||
test('should not fire hidden when hide is prevented', function (assert) {
|
||||
QUnit.test('should not fire hidden when hide is prevented', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var tabsHTML = '<ul class="tabs">'
|
||||
@@ -143,11 +143,11 @@ $(function () {
|
||||
.find('li:first a')
|
||||
.on('hide.bs.tab', function (e) {
|
||||
e.preventDefault()
|
||||
ok(true, 'hide event fired')
|
||||
assert.ok(true, 'hide event fired')
|
||||
done()
|
||||
})
|
||||
.on('hidden.bs.tab', function () {
|
||||
ok(false, 'hidden event fired')
|
||||
assert.ok(false, 'hidden event fired')
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
.end()
|
||||
@@ -155,7 +155,7 @@ $(function () {
|
||||
.bootstrapTab('show')
|
||||
})
|
||||
|
||||
test('hide and hidden events contain correct relatedTarget', function (assert) {
|
||||
QUnit.test('hide and hidden events contain correct relatedTarget', function (assert) {
|
||||
var done = assert.async()
|
||||
|
||||
var tabsHTML = '<ul class="tabs">'
|
||||
@@ -166,10 +166,10 @@ $(function () {
|
||||
$(tabsHTML)
|
||||
.find('li:first a')
|
||||
.on('hide.bs.tab', function (e) {
|
||||
equal(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
assert.strictEqual(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
})
|
||||
.on('hidden.bs.tab', function (e) {
|
||||
equal(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
assert.strictEqual(e.relatedTarget.hash, '#profile', 'references correct element as relatedTarget')
|
||||
done()
|
||||
})
|
||||
.bootstrapTab('show')
|
||||
@@ -178,7 +178,7 @@ $(function () {
|
||||
.bootstrapTab('show')
|
||||
})
|
||||
|
||||
test('selected tab should have aria-expanded', function () {
|
||||
QUnit.test('selected tab should have aria-expanded', function (assert) {
|
||||
var tabsHTML = '<ul class="nav nav-tabs">'
|
||||
+ '<li class="active"><a href="#home" toggle="tab" aria-expanded="true">Home</a></li>'
|
||||
+ '<li><a href="#profile" toggle="tab" aria-expanded="false">Profile</a></li>'
|
||||
@@ -186,20 +186,20 @@ $(function () {
|
||||
var $tabs = $(tabsHTML).appendTo('#qunit-fixture')
|
||||
|
||||
$tabs.find('li:first a').bootstrapTab('show')
|
||||
equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
|
||||
$tabs.find('li:last a').click()
|
||||
equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'after click, shown tab has aria-expanded = true')
|
||||
equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after click, hidden tab has aria-expanded = false')
|
||||
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'after click, shown tab has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after click, hidden tab has aria-expanded = false')
|
||||
|
||||
$tabs.find('li:first a').bootstrapTab('show')
|
||||
equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'shown tab has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'hidden tab has aria-expanded = false')
|
||||
|
||||
$tabs.find('li:first a').click()
|
||||
equal($tabs.find('.active a').attr('aria-expanded'), 'true', 'after second show event, shown tab still has aria-expanded = true')
|
||||
equal($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after second show event, hidden tab has aria-expanded = false')
|
||||
assert.strictEqual($tabs.find('.active a').attr('aria-expanded'), 'true', 'after second show event, shown tab still has aria-expanded = true')
|
||||
assert.strictEqual($tabs.find('li:not(.active) a').attr('aria-expanded'), 'false', 'after second show event, hidden tab has aria-expanded = false')
|
||||
})
|
||||
|
||||
})
|
||||
|
4
js/tests/vendor/qunit.css
vendored
4
js/tests/vendor/qunit.css
vendored
@@ -1,12 +1,12 @@
|
||||
/*!
|
||||
* QUnit 1.17.0
|
||||
* QUnit 1.17.1
|
||||
* http://qunitjs.com/
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2015-01-19T11:58Z
|
||||
* Date: 2015-01-20T19:39Z
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
6
js/tests/vendor/qunit.js
vendored
6
js/tests/vendor/qunit.js
vendored
@@ -1,12 +1,12 @@
|
||||
/*!
|
||||
* QUnit 1.17.0
|
||||
* QUnit 1.17.1
|
||||
* http://qunitjs.com/
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2015-01-19T11:58Z
|
||||
* Date: 2015-01-20T19:39Z
|
||||
*/
|
||||
|
||||
(function( window ) {
|
||||
@@ -2522,7 +2522,7 @@ function toolbarModuleFilter() {
|
||||
moduleFilter = document.createElement( "span" ),
|
||||
moduleFilterHtml = toolbarModuleFilterHtml();
|
||||
|
||||
if ( !moduleFilterHtml ) {
|
||||
if ( !toolbar || !moduleFilterHtml ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user