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
1041977d
Commit
1041977d
authored
Sep 10, 2011
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish up rounding out tests for all js plugins
parent
48aa2093
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
25 deletions
+82
-25
js/bootstrap-popover.js
js/bootstrap-popover.js
+2
-2
js/bootstrap-twipsy.js
js/bootstrap-twipsy.js
+9
-10
js/tests/unit/bootstrap-popover.js
js/tests/unit/bootstrap-popover.js
+71
-13
No files found.
js/bootstrap-popover.js
View file @
1041977d
...
...
@@ -59,10 +59,10 @@
$
.
fn
.
popover
=
function
(
options
)
{
if
(
typeof
options
==
'
object
'
)
options
=
$
.
extend
({},
$
.
fn
.
popover
.
defaults
,
options
)
$
.
fn
.
twipsy
.
initWith
.
call
(
this
,
options
,
Popover
)
$
.
fn
.
twipsy
.
initWith
.
call
(
this
,
options
,
Popover
,
'
popover
'
)
return
this
}
$
.
fn
.
popover
.
defaults
=
$
.
extend
({}
,
$
.
fn
.
twipsy
.
defaults
,
{
content
:
'
'
,
placement
:
'
right
'
})
$
.
fn
.
popover
.
defaults
=
$
.
extend
({}
,
$
.
fn
.
twipsy
.
defaults
,
{
content
:
'
content
'
,
placement
:
'
right
'
})
})(
jQuery
||
ender
)
\ No newline at end of file
js/bootstrap-twipsy.js
View file @
1041977d
...
...
@@ -187,35 +187,34 @@
* ======================== */
$
.
fn
.
twipsy
=
function
(
options
)
{
$
.
fn
.
twipsy
.
initWith
.
call
(
this
,
options
,
Twipsy
)
$
.
fn
.
twipsy
.
initWith
.
call
(
this
,
options
,
Twipsy
,
'
twipsy
'
)
return
this
}
$
.
fn
.
twipsy
.
initWith
=
function
(
options
,
Constructor
)
{
$
.
fn
.
twipsy
.
initWith
=
function
(
options
,
Constructor
,
name
)
{
var
twipsy
,
binder
,
eventIn
,
eventOut
if
(
options
===
true
)
{
return
this
.
data
(
'
twipsy
'
)
return
this
.
data
(
name
)
}
else
if
(
typeof
options
==
'
string
'
)
{
twipsy
=
this
.
data
(
'
twipsy
'
)
twipsy
=
this
.
data
(
name
)
if
(
twipsy
)
{
twipsy
[
options
]()
}
return
this
}
options
=
$
.
extend
({},
$
.
fn
.
twipsy
.
defaults
,
options
)
options
=
$
.
extend
({},
$
.
fn
[
name
]
.
defaults
,
options
)
function
get
(
ele
)
{
var
twipsy
=
$
.
data
(
ele
,
'
twipsy
'
)
var
twipsy
=
$
.
data
(
ele
,
name
)
if
(
!
twipsy
)
{
twipsy
=
new
Constructor
(
ele
,
$
.
fn
.
twipsy
.
elementOptions
(
ele
,
options
))
$
.
data
(
ele
,
'
twipsy
'
,
twipsy
)
$
.
data
(
ele
,
name
,
twipsy
)
}
return
twipsy
...
...
@@ -264,8 +263,8 @@
this
[
binder
](
eventIn
,
enter
)[
binder
](
eventOut
,
leave
)
}
this
.
bind
(
'
twipsy
:show
'
,
enter
)
this
.
bind
(
'
twipsy
:hide
'
,
leave
)
this
.
bind
(
name
+
'
:show
'
,
enter
)
this
.
bind
(
name
+
'
:hide
'
,
leave
)
return
this
}
...
...
js/tests/unit/bootstrap-popover.js
View file @
1041977d
// $(function () {
//
// module("bootstrap-popover")
//
// test("should be defined on jquery object", function () {
// ok($(document.body).popover, 'popover method is defined')
// })
//
// test("should return element", function () {
// ok($(document.body).popover()[0] == document.body, 'document.body returned')
// })
//
// })
\ No newline at end of file
$
(
function
()
{
module
(
"
bootstrap-popover
"
)
test
(
"
should be defined on jquery object
"
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
popover
,
'
popover method is defined
'
)
})
test
(
"
should return element
"
,
function
()
{
var
div
=
$
(
'
<div></div>
'
)
ok
(
div
.
popover
()
==
div
,
'
document.body returned
'
)
})
test
(
"
should render popover element
"
,
function
()
{
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" data-title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
()
.
trigger
(
'
popover:show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
popover
.
trigger
(
'
popover:hide
'
)
ok
(
!
$
(
"
.popover
"
).
length
,
'
popover removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
})
test
(
"
should store popover instance in popover data object
"
,
function
()
{
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" data-title="mdo" data-content="http://twitter.com/mdo">@mdo</a>
'
)
.
popover
()
ok
(
!!
popover
.
data
(
'
popover
'
),
'
popover instance exists
'
)
})
test
(
"
should get title and content from options
"
,
function
()
{
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
({
title
:
'
@fat
'
,
content
:
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
})
.
trigger
(
'
popover:show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@fat
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
,
'
content correctly inserted
'
)
popover
.
trigger
(
'
popover:hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
})
test
(
"
should get title and content from attributes
"
,
function
()
{
$
.
support
.
transition
=
false
var
popover
=
$
(
'
<a href="#" data-title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>
'
)
.
appendTo
(
'
#qunit-runoff
'
)
.
popover
()
.
trigger
(
'
popover:show
'
)
ok
(
$
(
'
.popover
'
).
length
,
'
popover was inserted
'
)
equals
(
$
(
'
.popover .title
'
).
text
(),
'
@mdo
'
,
'
title correctly inserted
'
)
equals
(
$
(
'
.popover .content
'
).
text
(),
"
loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻
"
,
'
content correctly inserted
'
)
popover
.
trigger
(
'
popover:hide
'
)
ok
(
!
$
(
'
.popover
'
).
length
,
'
popover was removed
'
)
$
(
'
#qunit-runoff
'
).
empty
()
})
})
\ No newline at end of file
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