Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
cde59e0a
Commit
cde59e0a
authored
Feb 17, 2015
by
csillag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify test cases
parent
2fbae287
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
texthighlight-test.coffee
tests/js/plugin/texthighlight-test.coffee
+11
-16
No files found.
tests/js/plugin/texthighlight-test.coffee
View file @
cde59e0a
...
@@ -10,7 +10,6 @@ th.pluginInit()
...
@@ -10,7 +10,6 @@ th.pluginInit()
describe
'Annotator.Plugin.TextHighlight'
,
->
describe
'Annotator.Plugin.TextHighlight'
,
->
sandbox
=
null
sandbox
=
null
jqElement
=
null
scrollTarget
=
null
scrollTarget
=
null
createTestHighlight
=
->
createTestHighlight
=
->
...
@@ -29,14 +28,13 @@ describe 'Annotator.Plugin.TextHighlight', ->
...
@@ -29,14 +28,13 @@ describe 'Annotator.Plugin.TextHighlight', ->
beforeEach
->
beforeEach
->
sandbox
=
sinon
.
sandbox
.
create
()
sandbox
=
sinon
.
sandbox
.
create
()
sandbox
.
stub
Annotator
.
TextHighlight
,
'highlightRange'
,
sandbox
.
stub
Annotator
.
TextHighlight
,
'highlightRange'
,
(
normedRange
,
cssClass
)
->
"test highlight span"
(
normedRange
,
cssClass
)
->
hl
=
document
.
createElement
"hl"
hl
.
appendChild
document
.
createTextNode
"test highlight span"
hl
sandbox
.
stub
Annotator
.
$
.
fn
,
"init"
,
(
selector
,
context
)
->
Annotator
.
$
.
fn
.
scrollintoview
=
sinon
.
spy
(
options
)
->
jqElement
=
scrollTarget
=
this
[
0
]
selector
:
selector
data
:
sinon
.
spy
()
scrollintoview
:
sinon
.
spy
(
options
)
->
scrollTarget
=
this
.
selector
options
?
.
complete
?
()
options
?
.
complete
?
()
afterEach
->
afterEach
->
...
@@ -50,22 +48,19 @@ describe 'Annotator.Plugin.TextHighlight', ->
...
@@ -50,22 +48,19 @@ describe 'Annotator.Plugin.TextHighlight', ->
it
'stores the created highlight spans in _highlights'
,
->
it
'stores the created highlight spans in _highlights'
,
->
hl
=
createTestHighlight
()
hl
=
createTestHighlight
()
assert
.
equal
hl
.
_highlights
,
"test highlight span"
assert
.
equal
hl
.
_highlights
.
textContent
,
"test highlight span"
it
"wraps a jQuery element around the highlight span"
,
->
hl
=
createTestHighlight
()
assert
.
equal
jqElement
.
selector
,
"test highlight span"
it
"assigns the annotation as data to the highlight span"
,
->
it
"assigns the annotation as data to the highlight span"
,
->
hl
=
createTestHighlight
()
hl
=
createTestHighlight
()
assert
.
calledWith
jqElement
.
data
,
"annotation"
,
"test annotation"
annotation
=
$
(
hl
.
_highlights
).
data
"annotation"
assert
.
equal
annotation
,
"test annotation"
describe
"scrollIntoView"
,
->
describe
"scrollIntoView"
,
->
it
'calls jQuery scrollintoview'
,
->
it
'calls jQuery scrollintoview'
,
->
hl
=
createTestHighlight
()
hl
=
createTestHighlight
()
hl
.
scrollIntoView
()
hl
.
scrollIntoView
()
assert
.
called
jqElement
.
scrollintoview
assert
.
called
Annotator
.
$
.
fn
.
scrollintoview
it
'scrolls to the created highlight span'
,
->
it
'scrolls to the created highlight span'
,
->
hl
=
createTestHighlight
()
hl
=
createTestHighlight
()
...
...
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