Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qunit update + fix Saucelabs test on Edge #22822

Merged
merged 3 commits into from
Jun 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (grunt) {
concurrency: 10,
maxRetries: 3,
maxPollRetries: 4,
urls: ['http://127.0.0.1:3000/js/tests/index.html?hidepassed'],
urls: ['http://localhost:3000/js/tests/index.html?hidepassed'],
browsers: grunt.file.readYAML('build/sauce_browsers.yml')
}
}
Expand Down
34 changes: 23 additions & 11 deletions js/tests/unit/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ $(function () {
})

QUnit.test('should not open dropdown if target is disabled via attribute', function (assert) {
assert.expect(0)
assert.expect(1)
var done = assert.async()
var dropdownHTML = '<div class="tabs">'
+ '<div class="dropdown">'
+ '<button disabled href="#" class="btn dropdown-toggle" data-toggle="dropdown">Dropdown</button>'
Expand All @@ -57,10 +58,13 @@ $(function () {
+ '</div>'
+ '</div>'
+ '</div>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
setTimeout(function () {
assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
}, 300)
$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.on('click', function () {
assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
done()
})
$dropdown.trigger($.Event('click'))
})

QUnit.test('should set aria-expanded="true" on target when dropdown menu is shown', function (assert) {
Expand All @@ -77,7 +81,10 @@ $(function () {
+ '</div>'
+ '</div>'
+ '</div>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown()
var $dropdown = $(dropdownHTML)
.appendTo('#qunit-fixture')
.find('[data-toggle="dropdown"]')
.bootstrapDropdown()
$dropdown
.parent('.dropdown')
.on('shown.bs.dropdown', function () {
Expand Down Expand Up @@ -118,7 +125,8 @@ $(function () {
})

QUnit.test('should not open dropdown if target is disabled via class', function (assert) {
assert.expect(0)
assert.expect(1)
var done = assert.async()
var dropdownHTML = '<div class="tabs">'
+ '<div class="dropdown">'
+ '<button href="#" class="btn dropdown-toggle disabled" data-toggle="dropdown">Dropdown</button>'
Expand All @@ -130,10 +138,14 @@ $(function () {
+ '</div>'
+ '</div>'
+ '</div>'
var $dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').bootstrapDropdown().trigger('click')
setTimeout(function () {
assert.ok(!$dropdown.parent('.dropdown').hasClass('show'), '"show" class added on click')
}, 300)

$(dropdownHTML).appendTo('#qunit-fixture')
var $dropdown = $('#qunit-fixture').find('[data-toggle="dropdown"]').bootstrapDropdown()
$dropdown.on('click', function () {
assert.ok(!$dropdown.parent('.dropdown').hasClass('show'))
done()
})
$dropdown.trigger($.Event('click'))
})

QUnit.test('should add class show to menu if clicked', function (assert) {
Expand Down
4 changes: 2 additions & 2 deletions js/tests/vendor/qunit.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* QUnit 2.3.2
* QUnit 2.3.3
* https://qunitjs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2017-04-18T02:19Z
* Date: 2017-06-02T14:07Z
*/

/** Font Family and Sizes */
Expand Down
Loading