Skip to content
GitLab
Explore
Projects
Groups
Snippets
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
dcf9aabc
Commit
dcf9aabc
authored
13 years ago
by
Jacob Thornton
Browse files
Options
Download
Email Patches
Plain Diff
get all spec passing again
parent
0afba386
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
js/tests/index.html
+1
-1
js/tests/index.html
js/tests/unit/bootstrap-modal.js
+21
-18
js/tests/unit/bootstrap-modal.js
js/tests/unit/bootstrap-popover.js
+16
-11
js/tests/unit/bootstrap-popover.js
js/tests/unit/bootstrap-twipsy.js
+8
-8
js/tests/unit/bootstrap-twipsy.js
with
46 additions
and
38 deletions
+46
-38
js/tests/index.html
+
1
-
1
View file @
dcf9aabc
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
<link
rel=
"stylesheet"
href=
"vendor/qunit.css"
type=
"text/css"
media=
"screen"
/>
<link
rel=
"stylesheet"
href=
"vendor/qunit.css"
type=
"text/css"
media=
"screen"
/>
<script
src=
"vendor/qunit.js"
></script>
<script
src=
"vendor/qunit.js"
></script>
<!-- plugin sources -->
<!--
plugin sources -->
<script
src=
"../../js/bootstrap-alerts.js"
></script>
<script
src=
"../../js/bootstrap-alerts.js"
></script>
<script
src=
"../../js/bootstrap-dropdown.js"
></script>
<script
src=
"../../js/bootstrap-dropdown.js"
></script>
<script
src=
"../../js/bootstrap-modal.js"
></script>
<script
src=
"../../js/bootstrap-modal.js"
></script>
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/bootstrap-modal.js
+
21
-
18
View file @
dcf9aabc
...
@@ -16,36 +16,37 @@ $(function () {
...
@@ -16,36 +16,37 @@ $(function () {
ok
(
$
.
fn
.
modal
.
defaults
,
'
default object exposed
'
)
ok
(
$
.
fn
.
modal
.
defaults
,
'
default object exposed
'
)
})
})
test
(
"
should insert into dom when
modal:show event
is called
"
,
function
()
{
test
(
"
should insert into dom when
show method
is called
"
,
function
()
{
stop
()
stop
()
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
div
div
.
modal
()
.
modal
()
.
trigger
(
"
modal
:
show
"
)
.
modal
(
"
show
"
)
.
bind
(
"
modal:
shown
"
,
function
()
{
.
bind
(
"
shown
"
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
start
()
start
()
div
.
remove
()
div
.
remove
()
})
})
})
})
test
(
"
should
remove from dom when modal:
hide is called
"
,
function
()
{
test
(
"
should
hide modal when
hide is called
"
,
function
()
{
stop
()
stop
()
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
div
div
.
modal
()
.
modal
()
.
trigger
(
"
modal:show
"
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
modal:shown
"
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
div
.
trigger
(
"
modal
:
hide
"
)
div
.
modal
(
"
hide
"
)
})
})
.
bind
(
"
modal:
hidden
"
,
function
()
{
.
bind
(
"
hidden
"
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
length
,
'
modal removed from dom
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal hidden
'
)
start
()
start
()
div
.
remove
()
div
.
remove
()
})
})
.
modal
(
"
show
"
)
})
})
test
(
"
should toggle when toggle is called
"
,
function
()
{
test
(
"
should toggle when toggle is called
"
,
function
()
{
...
@@ -54,16 +55,17 @@ $(function () {
...
@@ -54,16 +55,17 @@ $(function () {
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
var
div
=
$
(
"
<div id='modal-test'></div>
"
)
div
div
.
modal
()
.
modal
()
.
trigger
(
"
modal:toggle
"
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
modal:shown
"
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
div
.
trigger
(
"
modal
:
toggle
"
)
div
.
modal
(
"
toggle
"
)
})
})
.
bind
(
"
modal:
hidden
"
,
function
()
{
.
bind
(
"
hidden
"
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
length
,
'
modal removed from dom
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal hidden
'
)
start
()
start
()
div
.
remove
()
div
.
remove
()
})
})
.
modal
(
"
toggle
"
)
})
})
test
(
"
should remove from dom when click .close
"
,
function
()
{
test
(
"
should remove from dom when click .close
"
,
function
()
{
...
@@ -72,15 +74,16 @@ $(function () {
...
@@ -72,15 +74,16 @@ $(function () {
var
div
=
$
(
"
<div id='modal-test'><span class='close'></span></div>
"
)
var
div
=
$
(
"
<div id='modal-test'><span class='close'></span></div>
"
)
div
div
.
modal
()
.
modal
()
.
trigger
(
"
modal:toggle
"
)
.
bind
(
"
shown
"
,
function
()
{
.
bind
(
"
modal:shown
"
,
function
()
{
ok
(
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal visible
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
ok
(
$
(
'
#modal-test
'
).
length
,
'
modal insterted into dom
'
)
div
.
find
(
'
.close
'
).
click
()
div
.
find
(
'
.close
'
).
click
()
})
})
.
bind
(
"
modal:
hidden
"
,
function
()
{
.
bind
(
"
hidden
"
,
function
()
{
ok
(
!
$
(
'
#modal-test
'
).
length
,
'
modal removed from dom
'
)
ok
(
!
$
(
'
#modal-test
'
).
is
(
"
:visible
"
),
'
modal hidden
'
)
start
()
start
()
div
.
remove
()
div
.
remove
()
})
})
.
modal
(
"
toggle
"
)
})
})
})
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/tests/unit/bootstrap-popover.js
+
16
-
11
View file @
dcf9aabc
...
@@ -14,20 +14,20 @@ $(function () {
...
@@ -14,20 +14,20 @@ $(function () {
test
(
"
should render popover element
"
,
function
()
{
test
(
"
should render popover element
"
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#"
data-
title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
()
.
popover
()
.
trigger
(
'
popover
:
show
'
)
.
popover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
popover
.
trigger
(
'
popover
:
hide
'
)
popover
.
popover
(
'
hide
'
)
ok
(
!
$
(
"
.popover
"
).
length
,
'
popover removed
'
)
ok
(
!
$
(
"
.popover
"
).
length
,
'
popover removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
test
(
"
should store popover instance in popover data object
"
,
function
()
{
test
(
"
should store popover instance in popover data object
"
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#"
data-
title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
popover
()
.
popover
()
ok
(
!!
popover
.
data
(
'
popover
'
),
'
popover instance exists
'
)
ok
(
!!
popover
.
data
(
'
popover
'
),
'
popover instance exists
'
)
...
@@ -38,32 +38,37 @@ $(function () {
...
@@ -38,32 +38,37 @@ $(function () {
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
({
.
popover
({
title
:
'
@fat
'
title
:
function
()
{
,
content
:
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
return
'
@fat
'
}
,
content
:
function
()
{
return
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
}
})
})
.
trigger
(
'
popover:show
'
)
popover
.
popover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
popover
.
trigger
(
'
popover
:
hide
'
)
popover
.
popover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
test
(
"
should get title and content from attributes
"
,
function
()
{
test
(
"
should get title and content from attributes
"
,
function
()
{
$
.
support
.
transition
=
false
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#"
data-
title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
var
popover
=
$
(
'
<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
()
.
popover
()
.
trigger
(
'
popover
:
show
'
)
.
popover
(
'
show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
"
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
"
,
'
content correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
"
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
"
,
'
content correctly inserted
'
)
popover
.
trigger
(
'
popover
:
hide
'
)
popover
.
popover
(
'
hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/bootstrap-twipsy.js
+
8
-
8
View file @
dcf9aabc
...
@@ -31,10 +31,10 @@ $(function () {
...
@@ -31,10 +31,10 @@ $(function () {
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="Another twipsy"></a>
'
)
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="Another twipsy"></a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
twipsy
({
placement
:
'
below
'
})
.
twipsy
({
placement
:
'
below
'
})
.
trigger
(
'
twipsy
:
show
'
)
.
twipsy
(
'
show
'
)
ok
(
$
(
"
.twipsy
"
).
hasClass
(
'
fade below in
'
),
'
has correct classes applied
'
)
ok
(
$
(
"
.twipsy
"
).
hasClass
(
'
fade below in
'
),
'
has correct classes applied
'
)
twipsy
.
trigger
(
'
twipsy
:
hide
'
)
twipsy
.
twipsy
(
'
hide
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
...
@@ -44,10 +44,10 @@ $(function () {
...
@@ -44,10 +44,10 @@ $(function () {
var
twipsy
=
$
(
'
<a href="#" rel="twipsy"></a>
'
)
var
twipsy
=
$
(
'
<a href="#" rel="twipsy"></a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
twipsy
({
fallback
:
'
@fat
'
})
.
twipsy
({
fallback
:
'
@fat
'
})
.
trigger
(
'
twipsy
:
show
'
)
.
twipsy
(
'
show
'
)
equals
(
$
(
"
.twipsy
"
).
text
(),
"
@fat
"
,
'
has correct default text
'
)
equals
(
$
(
"
.twipsy
"
).
text
(),
"
@fat
"
,
'
has correct default text
'
)
twipsy
.
trigger
(
'
twipsy
:
hide
'
)
twipsy
.
twipsy
(
'
hide
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
...
@@ -57,10 +57,10 @@ $(function () {
...
@@ -57,10 +57,10 @@ $(function () {
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="<b>@fat</b>"></a>
'
)
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="<b>@fat</b>"></a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
twipsy
()
.
twipsy
()
.
trigger
(
'
twipsy
:
show
'
)
.
twipsy
(
'
show
'
)
ok
(
!
$
(
'
.twipsy b
'
).
length
,
'
b tag was not inserted
'
)
ok
(
!
$
(
'
.twipsy b
'
).
length
,
'
b tag was not inserted
'
)
twipsy
.
trigger
(
'
twipsy
:
hide
'
)
twipsy
.
twipsy
(
'
hide
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
...
@@ -70,10 +70,10 @@ $(function () {
...
@@ -70,10 +70,10 @@ $(function () {
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="<b>@fat</b>"></a>
'
)
var
twipsy
=
$
(
'
<a href="#" rel="twipsy" title="<b>@fat</b>"></a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
twipsy
({
html
:
true
})
.
twipsy
({
html
:
true
})
.
trigger
(
'
twipsy
:
show
'
)
.
twipsy
(
'
show
'
)
ok
(
$
(
'
.twipsy b
'
).
length
,
'
b tag was inserted
'
)
ok
(
$
(
'
.twipsy b
'
).
length
,
'
b tag was inserted
'
)
twipsy
.
trigger
(
'
twipsy
:
hide
'
)
twipsy
.
twipsy
(
'
hide
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
ok
(
!
$
(
"
.twipsy
"
).
length
,
'
twipsy removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
$
(
'
#qunit-runoff
'
).
empty
()
})
})
...
...
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
Menu
Explore
Projects
Groups
Snippets