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
32241a7f
Commit
32241a7f
authored
Mar 08, 2021
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for handling of `$tag` in AnnotationSync
Check that non-empty tags are assigned when expected.
parent
0a28a16d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
annotation-sync-test.js
src/annotator/test/annotation-sync-test.js
+22
-2
No files found.
src/annotator/test/annotation-sync-test.js
View file @
32241a7f
...
...
@@ -114,7 +114,9 @@ describe('AnnotationSync', function () {
context
(
'when "beforeAnnotationCreated" is emitted'
,
function
()
{
it
(
'calls bridge.call() passing the event'
,
function
()
{
const
ann
=
{
id
:
1
};
// nb. Setting an empty `$tag` here matches what `Guest#createAnnotation`
// does.
const
ann
=
{
id
:
1
,
$tag
:
''
};
createAnnotationSync
();
options
.
emit
(
'beforeAnnotationCreated'
,
ann
);
...
...
@@ -126,7 +128,16 @@ describe('AnnotationSync', function () {
});
});
context
(
'if the annotation has a $tag'
,
function
()
{
it
(
'assigns a non-empty tag to the annotation'
,
()
=>
{
const
ann
=
{
id
:
1
,
$tag
:
''
};
createAnnotationSync
();
options
.
emit
(
'beforeAnnotationCreated'
,
ann
);
assert
.
notEmpty
(
ann
.
$tag
);
});
context
(
'if the annotation already has a $tag'
,
function
()
{
it
(
'does not call bridge.call()'
,
function
()
{
const
ann
=
{
id
:
1
,
$tag
:
'tag1'
};
createAnnotationSync
();
...
...
@@ -135,6 +146,15 @@ describe('AnnotationSync', function () {
assert
.
notCalled
(
fakeBridge
.
call
);
});
it
(
'does not modify the tag'
,
()
=>
{
const
ann
=
{
id
:
1
,
$tag
:
'sometag'
};
createAnnotationSync
();
options
.
emit
(
'beforeAnnotationCreated'
,
ann
);
assert
.
equal
(
ann
.
$tag
,
'sometag'
);
});
});
});
});
...
...
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