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
d1c0b894
Commit
d1c0b894
authored
Dec 14, 2015
by
Robert Knight
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2800 from hypothesis/2799-dont-update-wrong-annotations
Don't update annotations with contents of others
parents
9b3ef75c
b96d1749
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
annotation.js
h/static/scripts/directive/annotation.js
+3
-1
annotation-test.js
h/static/scripts/directive/test/annotation-test.js
+27
-0
No files found.
h/static/scripts/directive/annotation.js
View file @
d1c0b894
...
...
@@ -343,7 +343,9 @@ function AnnotationController(
}
function
onAnnotationUpdated
(
event
,
updatedDomainModel
)
{
updateViewModel
(
updatedDomainModel
,
vm
,
permissions
);
if
(
updatedDomainModel
.
id
===
domainModel
.
id
)
{
updateViewModel
(
updatedDomainModel
,
vm
,
permissions
);
}
}
function
onDestroy
()
{
...
...
h/static/scripts/directive/test/annotation-test.js
View file @
d1c0b894
...
...
@@ -1367,6 +1367,33 @@ describe('annotation.js', function() {
});
});
describe
(
'onAnnotationUpdated()'
,
function
()
{
it
(
'updates vm.form.text'
,
function
()
{
var
parts
=
createDirective
();
var
updatedModel
=
{
id
:
parts
.
annotation
.
id
,
text
:
'new text'
,
};
$rootScope
.
$emit
(
'annotationUpdated'
,
updatedModel
);
assert
.
equal
(
parts
.
controller
.
form
.
text
,
'new text'
);
});
it
(
'doesn
\'
t update if a different annotation was updated'
,
function
()
{
var
parts
=
createDirective
();
parts
.
controller
.
form
.
text
=
'original text'
;
var
updatedModel
=
{
id
:
'different annotation id'
,
text
:
'new text'
,
};
$rootScope
.
$emit
(
'annotationUpdated'
,
updatedModel
);
assert
.
equal
(
parts
.
controller
.
form
.
text
,
'original text'
);
});
});
describe
(
'onGroupFocused()'
,
function
()
{
it
(
'if the annotation is being edited it updates drafts'
,
function
()
{
var
parts
=
createDirective
();
...
...
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