Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
9c75c855
Commit
9c75c855
authored
Feb 23, 2015
by
Chris Rebert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JS unit tests: equal() => strictEqual()
[skip validator]
parent
118b8c26
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
90 deletions
+90
-90
js/tests/unit/alert.js
js/tests/unit/alert.js
+2
-2
js/tests/unit/button.js
js/tests/unit/button.js
+12
-12
js/tests/unit/carousel.js
js/tests/unit/carousel.js
+3
-3
js/tests/unit/collapse.js
js/tests/unit/collapse.js
+6
-6
js/tests/unit/popover.js
js/tests/unit/popover.js
+16
-16
js/tests/unit/tab.js
js/tests/unit/tab.js
+16
-16
js/tests/unit/tooltip.js
js/tests/unit/tooltip.js
+35
-35
No files found.
js/tests/unit/alert.js
View file @
9c75c855
...
@@ -38,7 +38,7 @@ $(function () {
...
@@ -38,7 +38,7 @@ $(function () {
$alert
.
find
(
'
.close
'
).
click
()
$alert
.
find
(
'
.close
'
).
click
()
assert
.
e
qual
(
$alert
.
hasClass
(
'
in
'
),
false
,
'
remove .in class on .close click
'
)
assert
.
strictE
qual
(
$alert
.
hasClass
(
'
in
'
),
false
,
'
remove .in class on .close click
'
)
})
})
QUnit
.
test
(
'
should remove element when clicking .close
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should remove element when clicking .close
'
,
function
(
assert
)
{
...
@@ -52,7 +52,7 @@ $(function () {
...
@@ -52,7 +52,7 @@ $(function () {
$alert
.
find
(
'
.close
'
).
click
()
$alert
.
find
(
'
.close
'
).
click
()
assert
.
e
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
'
).
length
,
0
,
'
element removed from dom
'
)
assert
.
strictE
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert
'
).
length
,
0
,
'
element removed from dom
'
)
})
})
QUnit
.
test
(
'
should not fire closed when close is prevented
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should not fire closed when close is prevented
'
,
function
(
assert
)
{
...
...
js/tests/unit/button.js
View file @
9c75c855
...
@@ -31,11 +31,11 @@ $(function () {
...
@@ -31,11 +31,11 @@ $(function () {
QUnit
.
test
(
'
should return set state to loading
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should return set state to loading
'
,
function
(
assert
)
{
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
assert
.
e
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
var
done
=
assert
.
async
()
var
done
=
assert
.
async
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
assert
.
e
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
done
()
done
()
...
@@ -44,18 +44,18 @@ $(function () {
...
@@ -44,18 +44,18 @@ $(function () {
QUnit
.
test
(
'
should return reset state
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should return reset state
'
,
function
(
assert
)
{
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat">mdo</button>
'
)
assert
.
e
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
var
doneOne
=
assert
.
async
()
var
doneOne
=
assert
.
async
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
assert
.
e
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
doneOne
()
doneOne
()
var
doneTwo
=
assert
.
async
()
var
doneTwo
=
assert
.
async
()
$btn
.
bootstrapButton
(
'
reset
'
)
$btn
.
bootstrapButton
(
'
reset
'
)
setTimeout
(
function
()
{
setTimeout
(
function
()
{
assert
.
e
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
mdo
'
,
'
btn text equals mdo
'
)
assert
.
ok
(
!
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is not disabled
'
)
assert
.
ok
(
!
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is not disabled
'
)
assert
.
ok
(
!
$btn
.
hasClass
(
'
disabled
'
),
'
btn does not have disabled class
'
)
assert
.
ok
(
!
$btn
.
hasClass
(
'
disabled
'
),
'
btn does not have disabled class
'
)
doneTwo
()
doneTwo
()
...
@@ -65,18 +65,18 @@ $(function () {
...
@@ -65,18 +65,18 @@ $(function () {
QUnit
.
test
(
'
should work with an empty string as reset state
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should work with an empty string as reset state
'
,
function
(
assert
)
{
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat"/>
'
)
var
$btn
=
$
(
'
<button class="btn" data-loading-text="fat"/>
'
)
assert
.
e
qual
(
$btn
.
html
(),
''
,
'
btn text equals ""
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
''
,
'
btn text equals ""
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
$btn
.
bootstrapButton
(
'
loading
'
)
var
doneOne
=
assert
.
async
()
var
doneOne
=
assert
.
async
()
setTimeout
(
function
()
{
setTimeout
(
function
()
{
assert
.
e
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
'
fat
'
,
'
btn text equals fat
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is disabled
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
assert
.
ok
(
$btn
.
hasClass
(
'
disabled
'
),
'
btn has disabled class
'
)
doneOne
()
doneOne
()
var
doneTwo
=
assert
.
async
()
var
doneTwo
=
assert
.
async
()
$btn
.
bootstrapButton
(
'
reset
'
)
$btn
.
bootstrapButton
(
'
reset
'
)
setTimeout
(
function
()
{
setTimeout
(
function
()
{
assert
.
e
qual
(
$btn
.
html
(),
''
,
'
btn text equals ""
'
)
assert
.
strictE
qual
(
$btn
.
html
(),
''
,
'
btn text equals ""
'
)
assert
.
ok
(
!
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is not disabled
'
)
assert
.
ok
(
!
$btn
[
0
].
hasAttribute
(
'
disabled
'
),
'
btn is not disabled
'
)
assert
.
ok
(
!
$btn
.
hasClass
(
'
disabled
'
),
'
btn does not have disabled class
'
)
assert
.
ok
(
!
$btn
.
hasClass
(
'
disabled
'
),
'
btn does not have disabled class
'
)
doneTwo
()
doneTwo
()
...
@@ -104,9 +104,9 @@ $(function () {
...
@@ -104,9 +104,9 @@ $(function () {
QUnit
.
test
(
'
should toggle aria-pressed
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should toggle aria-pressed
'
,
function
(
assert
)
{
var
$btn
=
$
(
'
<button class="btn" data-toggle="button" aria-pressed="false">redux</button>
'
)
var
$btn
=
$
(
'
<button class="btn" data-toggle="button" aria-pressed="false">redux</button>
'
)
assert
.
e
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
false
'
,
'
btn aria-pressed state is false
'
)
assert
.
strictE
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
false
'
,
'
btn aria-pressed state is false
'
)
$btn
.
bootstrapButton
(
'
toggle
'
)
$btn
.
bootstrapButton
(
'
toggle
'
)
assert
.
e
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
true
'
,
'
btn aria-pressed state is true
'
)
assert
.
strictE
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
true
'
,
'
btn aria-pressed state is true
'
)
})
})
QUnit
.
test
(
'
should toggle aria-pressed when btn children are clicked
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should toggle aria-pressed when btn children are clicked
'
,
function
(
assert
)
{
...
@@ -115,9 +115,9 @@ $(function () {
...
@@ -115,9 +115,9 @@ $(function () {
$btn
$btn
.
append
(
$inner
)
.
append
(
$inner
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
assert
.
e
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
false
'
,
'
btn aria-pressed state is false
'
)
assert
.
strictE
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
false
'
,
'
btn aria-pressed state is false
'
)
$inner
.
click
()
$inner
.
click
()
assert
.
e
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
true
'
,
'
btn aria-pressed state is true
'
)
assert
.
strictE
qual
(
$btn
.
attr
(
'
aria-pressed
'
),
'
true
'
,
'
btn aria-pressed state is true
'
)
})
})
QUnit
.
test
(
'
should toggle active when btn children are clicked within btn-group
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should toggle active when btn children are clicked within btn-group
'
,
function
(
assert
)
{
...
...
js/tests/unit/carousel.js
View file @
9c75c855
...
@@ -327,19 +327,19 @@ $(function () {
...
@@ -327,19 +327,19 @@ $(function () {
$carousel
.
appendTo
(
'
body
'
)
$carousel
.
appendTo
(
'
body
'
)
$
(
'
[data-slide]
'
).
first
().
click
()
$
(
'
[data-slide]
'
).
first
().
click
()
assert
.
e
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
)
assert
.
strictE
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
)
$carousel
.
remove
()
$carousel
.
remove
()
$carousel
.
appendTo
(
'
body
'
).
attr
(
'
data-modal
'
,
'
foobar
'
)
$carousel
.
appendTo
(
'
body
'
).
attr
(
'
data-modal
'
,
'
foobar
'
)
$
(
'
[data-slide]
'
).
first
().
click
()
$
(
'
[data-slide]
'
).
first
().
click
()
assert
.
e
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
,
'
even if there is an data-modal attribute set
'
)
assert
.
strictE
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
,
'
even if there is an data-modal attribute set
'
)
$carousel
.
remove
()
$carousel
.
remove
()
$carousel
.
appendTo
(
'
body
'
)
$carousel
.
appendTo
(
'
body
'
)
$
(
'
[data-slide]
'
).
first
().
click
()
$
(
'
[data-slide]
'
).
first
().
click
()
$carousel
.
attr
(
'
data-interval
'
,
1860
)
$carousel
.
attr
(
'
data-interval
'
,
1860
)
$
(
'
[data-slide]
'
).
first
().
click
()
$
(
'
[data-slide]
'
).
first
().
click
()
assert
.
e
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
,
'
attributes should be read only on initialization
'
)
assert
.
strictE
qual
(
$carousel
.
data
(
'
bs.carousel
'
).
options
.
interval
,
1814
,
'
attributes should be read only on initialization
'
)
$carousel
.
remove
()
$carousel
.
remove
()
$carousel
.
attr
(
'
data-interval
'
,
false
)
$carousel
.
attr
(
'
data-interval
'
,
false
)
...
...
js/tests/unit/collapse.js
View file @
9c75c855
...
@@ -63,7 +63,7 @@ $(function () {
...
@@ -63,7 +63,7 @@ $(function () {
$
(
'
<div class="collapse" style="height: 0px"/>
'
)
$
(
'
<div class="collapse" style="height: 0px"/>
'
)
.
on
(
'
show.bs.collapse
'
,
function
()
{
.
on
(
'
show.bs.collapse
'
,
function
()
{
assert
.
e
qual
(
this
.
style
.
height
,
'
0px
'
,
'
height is 0px
'
)
assert
.
strictE
qual
(
this
.
style
.
height
,
'
0px
'
,
'
height is 0px
'
)
})
})
.
on
(
'
shown.bs.collapse
'
,
function
()
{
.
on
(
'
shown.bs.collapse
'
,
function
()
{
assert
.
strictEqual
(
this
.
style
.
height
,
''
,
'
height is auto
'
)
assert
.
strictEqual
(
this
.
style
.
height
,
''
,
'
height is auto
'
)
...
@@ -208,7 +208,7 @@ $(function () {
...
@@ -208,7 +208,7 @@ $(function () {
$
(
'
<div id="test1"/>
'
)
$
(
'
<div id="test1"/>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
on
(
'
shown.bs.collapse
'
,
function
()
{
.
on
(
'
shown.bs.collapse
'
,
function
()
{
assert
.
e
qual
(
$target
.
attr
(
'
aria-expanded
'
),
'
true
'
,
'
aria-expanded on target is "true"
'
)
assert
.
strictE
qual
(
$target
.
attr
(
'
aria-expanded
'
),
'
true
'
,
'
aria-expanded on target is "true"
'
)
done
()
done
()
})
})
...
@@ -223,7 +223,7 @@ $(function () {
...
@@ -223,7 +223,7 @@ $(function () {
$
(
'
<div id="test1" class="in"/>
'
)
$
(
'
<div id="test1" class="in"/>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
on
(
'
hidden.bs.collapse
'
,
function
()
{
.
on
(
'
hidden.bs.collapse
'
,
function
()
{
assert
.
e
qual
(
$target
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
aria-expanded on target is "false"
'
)
assert
.
strictE
qual
(
$target
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
aria-expanded on target is "false"
'
)
done
()
done
()
})
})
...
@@ -253,9 +253,9 @@ $(function () {
...
@@ -253,9 +253,9 @@ $(function () {
$
(
'
<div id="body3" aria-expanded="false"/>
'
)
$
(
'
<div id="body3" aria-expanded="false"/>
'
)
.
appendTo
(
$groups
.
eq
(
2
))
.
appendTo
(
$groups
.
eq
(
2
))
.
on
(
'
shown.bs.collapse
'
,
function
()
{
.
on
(
'
shown.bs.collapse
'
,
function
()
{
assert
.
e
qual
(
$target1
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
inactive target 1 has aria-expanded="false"
'
)
assert
.
strictE
qual
(
$target1
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
inactive target 1 has aria-expanded="false"
'
)
assert
.
e
qual
(
$target2
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
inactive target 2 has aria-expanded="false"
'
)
assert
.
strictE
qual
(
$target2
.
attr
(
'
aria-expanded
'
),
'
false
'
,
'
inactive target 2 has aria-expanded="false"
'
)
assert
.
e
qual
(
$target3
.
attr
(
'
aria-expanded
'
),
'
true
'
,
'
active target 3 has aria-expanded="false"
'
)
assert
.
strictE
qual
(
$target3
.
attr
(
'
aria-expanded
'
),
'
true
'
,
'
active target 3 has aria-expanded="false"
'
)
done
()
done
()
})
})
...
...
js/tests/unit/popover.js
View file @
9c75c855
...
@@ -36,7 +36,7 @@ $(function () {
...
@@ -36,7 +36,7 @@ $(function () {
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover removed
'
)
})
})
QUnit
.
test
(
'
should store popover instance in popover data object
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should store popover instance in popover data object
'
,
function
(
assert
)
{
...
@@ -70,11 +70,11 @@ $(function () {
...
@@ -70,11 +70,11 @@ $(function () {
$popover
.
bootstrapPopover
(
'
show
'
)
$popover
.
bootstrapPopover
(
'
show
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
})
})
QUnit
.
test
(
'
should not duplicate HTML object
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should not duplicate HTML object
'
,
function
(
assert
)
{
...
@@ -93,14 +93,14 @@ $(function () {
...
@@ -93,14 +93,14 @@ $(function () {
assert
.
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
assert
.
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
$popover
.
bootstrapPopover
(
'
show
'
)
$popover
.
bootstrapPopover
(
'
show
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
assert
.
equal
(
$
(
'
.popover .popover-content
'
).
html
(),
$div
,
'
content correctly inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
})
})
QUnit
.
test
(
'
should get title and content from attributes
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should get title and content from attributes
'
,
function
(
assert
)
{
...
@@ -110,11 +110,11 @@ $(function () {
...
@@ -110,11 +110,11 @@ $(function () {
.
bootstrapPopover
(
'
show
'
)
.
bootstrapPopover
(
'
show
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
})
})
...
@@ -128,11 +128,11 @@ $(function () {
...
@@ -128,11 +128,11 @@ $(function () {
.
bootstrapPopover
(
'
show
'
)
.
bootstrapPopover
(
'
show
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
assert
.
e
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
assert
.
strictE
qual
(
$
(
'
.popover .popover-content
'
).
text
(),
'
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
'
,
'
content correctly inserted
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
})
})
QUnit
.
test
(
'
should respect custom template
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should respect custom template
'
,
function
(
assert
)
{
...
@@ -150,7 +150,7 @@ $(function () {
...
@@ -150,7 +150,7 @@ $(function () {
assert
.
ok
(
$
(
'
.popover
'
).
hasClass
(
'
foobar
'
),
'
custom class is present
'
)
assert
.
ok
(
$
(
'
.popover
'
).
hasClass
(
'
foobar
'
),
'
custom class is present
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
$popover
.
bootstrapPopover
(
'
hide
'
)
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
})
})
QUnit
.
test
(
'
should destroy popover
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should destroy popover
'
,
function
(
assert
)
{
...
@@ -162,14 +162,14 @@ $(function () {
...
@@ -162,14 +162,14 @@ $(function () {
assert
.
ok
(
$popover
.
data
(
'
bs.popover
'
),
'
popover has data
'
)
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
.
ok
(
$
.
_data
(
$popover
[
0
],
'
events
'
).
mouseover
&&
$
.
_data
(
$popover
[
0
],
'
events
'
).
mouseout
,
'
popover has hover event
'
)
assert
.
e
qual
(
$
.
_data
(
$popover
[
0
],
'
events
'
).
click
[
0
].
namespace
,
'
foo
'
,
'
popover has extra click.foo event
'
)
assert
.
strictE
qual
(
$
.
_data
(
$popover
[
0
],
'
events
'
).
click
[
0
].
namespace
,
'
foo
'
,
'
popover has extra click.foo event
'
)
$popover
.
bootstrapPopover
(
'
show
'
)
$popover
.
bootstrapPopover
(
'
show
'
)
$popover
.
bootstrapPopover
(
'
destroy
'
)
$popover
.
bootstrapPopover
(
'
destroy
'
)
assert
.
ok
(
!
$popover
.
hasClass
(
'
in
'
),
'
popover is hidden
'
)
assert
.
ok
(
!
$popover
.
hasClass
(
'
in
'
),
'
popover is hidden
'
)
assert
.
ok
(
!
$popover
.
data
(
'
popover
'
),
'
popover does not have data
'
)
assert
.
ok
(
!
$popover
.
data
(
'
popover
'
),
'
popover does not have data
'
)
assert
.
e
qual
(
$
.
_data
(
$popover
[
0
],
'
events
'
).
click
[
0
].
namespace
,
'
foo
'
,
'
popover still has click.foo
'
)
assert
.
strictE
qual
(
$
.
_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
'
)
assert
.
ok
(
!
$
.
_data
(
$popover
[
0
],
'
events
'
).
mouseover
&&
!
$
.
_data
(
$popover
[
0
],
'
events
'
).
mouseout
,
'
popover does not have any events
'
)
})
})
...
@@ -185,7 +185,7 @@ $(function () {
...
@@ -185,7 +185,7 @@ $(function () {
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
assert
.
notEqual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was inserted
'
)
$div
.
find
(
'
a
'
).
click
()
$div
.
find
(
'
a
'
).
click
()
assert
.
e
qual
(
$
(
'
.popover
'
).
length
,
0
,
'
popover was removed
'
)
assert
.
strictE
qual
(
$
(
'
.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
)
{
QUnit
.
test
(
'
should detach popover content rather than removing it so that event handlers are left intact
'
,
function
(
assert
)
{
...
...
js/tests/unit/tab.js
View file @
9c75c855
...
@@ -38,10 +38,10 @@ $(function () {
...
@@ -38,10 +38,10 @@ $(function () {
$
(
'
<ul><li id="home"/><li id="profile"/></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
'
<ul><li id="home"/><li id="profile"/></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
tabsHTML
).
find
(
'
li:last a
'
).
bootstrapTab
(
'
show
'
)
$
(
tabsHTML
).
find
(
'
li:last a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
assert
.
strictE
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
$
(
tabsHTML
).
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
$
(
tabsHTML
).
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
assert
.
strictE
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
})
QUnit
.
test
(
'
should activate element by tab id
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should activate element by tab id
'
,
function
(
assert
)
{
...
@@ -53,10 +53,10 @@ $(function () {
...
@@ -53,10 +53,10 @@ $(function () {
$
(
'
<ul><li id="home"/><li id="profile"/></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
'
<ul><li id="home"/><li id="profile"/></ul>
'
).
appendTo
(
'
#qunit-fixture
'
)
$
(
pillsHTML
).
find
(
'
li:last a
'
).
bootstrapTab
(
'
show
'
)
$
(
pillsHTML
).
find
(
'
li:last a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
assert
.
strictE
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
profile
'
)
$
(
pillsHTML
).
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
$
(
pillsHTML
).
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
assert
.
strictE
qual
(
$
(
'
#qunit-fixture
'
).
find
(
'
.active
'
).
attr
(
'
id
'
),
'
home
'
)
})
})
QUnit
.
test
(
'
should not fire shown when show is prevented
'
,
function
(
assert
)
{
QUnit
.
test
(
'
should not fire shown when show is prevented
'
,
function
(
assert
)
{
...
@@ -92,10 +92,10 @@ $(function () {
...
@@ -92,10 +92,10 @@ $(function () {
.
end
()
.
end
()
.
find
(
'
ul > li:last a
'
)
.
find
(
'
ul > li:last a
'
)
.
on
(
'
show.bs.tab
'
,
function
(
e
)
{
.
on
(
'
show.bs.tab
'
,
function
(
e
)
{
assert
.
e
qual
(
e
.
relatedTarget
.
hash
,
'
#1-1
'
,
'
references correct element as relatedTarget
'
)
assert
.
strictE
qual
(
e
.
relatedTarget
.
hash
,
'
#1-1
'
,
'
references correct element as relatedTarget
'
)
})
})
.
on
(
'
shown.bs.tab
'
,
function
(
e
)
{
.
on
(
'
shown.bs.tab
'
,
function
(
e
)
{
assert
.
e
qual
(
e
.
relatedTarget
.
hash
,
'
#1-1
'
,
'
references correct element as relatedTarget
'
)
assert
.
strictE
qual
(
e
.
relatedTarget
.
hash
,
'
#1-1
'
,
'
references correct element as relatedTarget
'
)
done
()
done
()
})
})
.
bootstrapTab
(
'
show
'
)
.
bootstrapTab
(
'
show
'
)
...
@@ -166,10 +166,10 @@ $(function () {
...
@@ -166,10 +166,10 @@ $(function () {
$
(
tabsHTML
)
$
(
tabsHTML
)
.
find
(
'
li:first a
'
)
.
find
(
'
li:first a
'
)
.
on
(
'
hide.bs.tab
'
,
function
(
e
)
{
.
on
(
'
hide.bs.tab
'
,
function
(
e
)
{
assert
.
e
qual
(
e
.
relatedTarget
.
hash
,
'
#profile
'
,
'
references correct element as relatedTarget
'
)
assert
.
strictE
qual
(
e
.
relatedTarget
.
hash
,
'
#profile
'
,
'
references correct element as relatedTarget
'
)
})
})
.
on
(
'
hidden.bs.tab
'
,
function
(
e
)
{
.
on
(
'
hidden.bs.tab
'
,
function
(
e
)
{
assert
.
e
qual
(
e
.
relatedTarget
.
hash
,
'
#profile
'
,
'
references correct element as relatedTarget
'
)
assert
.
strictE
qual
(
e
.
relatedTarget
.
hash
,
'
#profile
'
,
'
references correct element as relatedTarget
'
)
done
()
done
()
})
})
.
bootstrapTab
(
'
show
'
)
.
bootstrapTab
(
'
show
'
)
...
@@ -186,20 +186,20 @@ $(function () {
...
@@ -186,20 +186,20 @@ $(function () {
var
$tabs
=
$
(
tabsHTML
).
appendTo
(
'
#qunit-fixture
'
)
var
$tabs
=
$
(
tabsHTML
).
appendTo
(
'
#qunit-fixture
'
)
$tabs
.
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
$tabs
.
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
shown tab has aria-expanded = true
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
shown tab has aria-expanded = true
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
hidden tab has aria-expanded = false
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
hidden tab has aria-expanded = false
'
)
$tabs
.
find
(
'
li:last a
'
).
click
()
$tabs
.
find
(
'
li:last a
'
).
click
()
assert
.
e
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
after click, shown tab has aria-expanded = true
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
after click, shown tab has aria-expanded = true
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
after click, hidden tab has aria-expanded = false
'
)
assert
.
strictE
qual
(
$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
'
)
$tabs
.
find
(
'
li:first a
'
).
bootstrapTab
(
'
show
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
shown tab has aria-expanded = true
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
shown tab has aria-expanded = true
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
hidden tab has aria-expanded = false
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
hidden tab has aria-expanded = false
'
)
$tabs
.
find
(
'
li:first a
'
).
click
()
$tabs
.
find
(
'
li:first a
'
).
click
()
assert
.
e
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
after second show event, shown tab still has aria-expanded = true
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
.active a
'
).
attr
(
'
aria-expanded
'
),
'
true
'
,
'
after second show event, shown tab still has aria-expanded = true
'
)
assert
.
e
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
after second show event, hidden tab has aria-expanded = false
'
)
assert
.
strictE
qual
(
$tabs
.
find
(
'
li:not(.active) a
'
).
attr
(
'
aria-expanded
'
),
'
false
'
,
'
after second show event, hidden tab has aria-expanded = false
'
)
})
})
})
})
js/tests/unit/tooltip.js
View file @
9c75c855
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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