Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
2a6207c0
Commit
2a6207c0
authored
10 years ago
by
Chris Rebert
Browse files
Options
Download
Plain Diff
Merge pull request #15904 from kkirsche/patch-8
Closes #15904
parents
19fc0143
696fc2e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/tests/unit/dropdown.js
+47
-0
js/tests/unit/dropdown.js
with
47 additions
and
0 deletions
+47
-0
js/tests/unit/dropdown.js
+
47
-
0
View file @
2a6207c0
...
...
@@ -46,6 +46,53 @@ $(function () {
assert
.
ok
(
!
$dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
"open" class added on click
'
)
})
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
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
()
var
done
=
assert
.
async
()
$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">
'
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment