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
b6ae16c1
Commit
b6ae16c1
authored
Nov 27, 2014
by
gergely-ujvari
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1725 from hypothesis/improve-show-diff
Improve visual diff code
parents
3983f7dd
b596d927
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
annotation.coffee
h/static/scripts/directives/annotation.coffee
+1
-2
annotation-test.coffee
tests/js/directives/annotation-test.coffee
+11
-0
No files found.
h/static/scripts/directives/annotation.coffee
View file @
b6ae16c1
...
@@ -133,8 +133,7 @@ AnnotationController = [
...
@@ -133,8 +133,7 @@ AnnotationController = [
# hasDiff is set to true is there are any targets with a difference
# hasDiff is set to true is there are any targets with a difference
# shouldShowDiff is set to true if there are some meaningful differences
# shouldShowDiff is set to true if there are some meaningful differences
# - that is, more than just uppercase / lowercase
# - that is, more than just uppercase / lowercase
diffFromTargets = (targets) ->
diffFromTargets = (targets = []) ->
return {hasDiff: false, shouldShowDiff: false} unless targets?
hasDiff = targets.some (t) ->
hasDiff = targets.some (t) ->
t.diffHTML?
t.diffHTML?
shouldShowDiff = hasDiff and targets.some (t) ->
shouldShowDiff = hasDiff and targets.some (t) ->
...
...
tests/js/directives/annotation-test.coffee
View file @
b6ae16c1
...
@@ -127,6 +127,17 @@ describe 'h.directives.annotation', ->
...
@@ -127,6 +127,17 @@ describe 'h.directives.annotation', ->
controller
.
render
()
controller
.
render
()
assert
.
isNull
(
controller
.
document
)
assert
.
isNull
(
controller
.
document
)
describe
'when there are no targets'
,
->
beforeEach
->
annotation
.
target
=
[]
controller
.
render
()
targets
=
controller
.
annotation
.
target
it
'sets `hasDiff` to false and `showDiff` to undefined'
,
->
controller
.
render
()
assert
.
isFalse
(
controller
.
hasDiff
)
assert
.
isUndefined
(
controller
.
showDiff
)
describe
'when a single target has text identical to what was in the selectors'
,
->
describe
'when a single target has text identical to what was in the selectors'
,
->
it
'sets `showDiff` to undefined and `hasDiff` to false'
,
->
it
'sets `showDiff` to undefined and `hasDiff` to false'
,
->
controller
.
render
()
controller
.
render
()
...
...
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