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
57d1e2c9
Commit
57d1e2c9
authored
Jun 28, 2017
by
Juan Corona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for when a frame is destroyed
parent
db578451
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
frames-test.js
src/sidebar/reducers/test/frames-test.js
+13
-0
frame-sync-test.js
src/sidebar/test/frame-sync-test.js
+18
-1
No files found.
src/sidebar/reducers/test/frames-test.js
View file @
57d1e2c9
...
...
@@ -21,6 +21,19 @@ describe('frames reducer', function () {
});
});
describe
(
'#destroyFrame'
,
function
()
{
it
(
'removes the frame from the list of connected frames'
,
function
()
{
var
frameList
=
[{
uri
:
'http://example.com'
},
{
uri
:
'http://example.org'
}];
var
state
=
init
();
frameList
.
forEach
(
function
(
frame
)
{
state
=
update
(
state
,
actions
.
connectFrame
(
frame
));
});
assert
.
deepEqual
(
frames
.
frames
(
state
),
frameList
);
var
updatedState
=
update
(
state
,
actions
.
destroyFrame
(
frameList
[
0
]));
assert
.
deepEqual
(
frames
.
frames
(
updatedState
),
[
frameList
[
1
]]);
});
});
describe
(
'#updateFrameAnnotationFetchStatus'
,
function
()
{
it
(
'updates the isAnnotationFetchComplete status of the frame'
,
function
()
{
var
frame
=
{
...
...
src/sidebar/test/frame-sync-test.js
View file @
57d1e2c9
...
...
@@ -39,6 +39,12 @@ var fixtures = {
link
:
[{
href
:
'http://example.org/paper.pdf'
},
{
href
:
'urn:1234'
}],
},
},
// The entry in the list of frames currently connected
framesListEntry
:
{
uri
:
'http://example.com'
,
isAnnotationFetchComplete
:
true
,
},
};
describe
(
'FrameSync'
,
function
()
{
...
...
@@ -55,9 +61,10 @@ describe('FrameSync', function () {
beforeEach
(
function
()
{
fakeAnnotationUI
=
fakeStore
({
annotations
:
[]},
{
connectFrame
:
sinon
.
stub
(),
destroyFrame
:
sinon
.
stub
(),
findIDsForTags
:
sinon
.
stub
(),
focusAnnotations
:
sinon
.
stub
(),
frames
:
sinon
.
stub
().
returns
([
{
uri
:
'http://example.com'
,
isAnnotationFetchComplete
:
true
}
]),
frames
:
sinon
.
stub
().
returns
([
fixtures
.
framesListEntry
]),
selectAnnotations
:
sinon
.
stub
(),
selectTab
:
sinon
.
stub
(),
toggleSelectedAnnotations
:
sinon
.
stub
(),
...
...
@@ -214,6 +221,16 @@ describe('FrameSync', function () {
});
});
context
(
'when a frame is destroyed'
,
function
()
{
var
frameUri
=
fixtures
.
framesListEntry
.
uri
;
it
(
"adds the page's metadata to the frames list"
,
function
()
{
fakeBridge
.
emit
(
'destroyFrame'
,
frameUri
);
assert
.
calledWith
(
fakeAnnotationUI
.
destroyFrame
,
fixtures
.
framesListEntry
);
});
});
describe
(
'on "showAnnotations" message'
,
function
()
{
it
(
'selects annotations which have an ID'
,
function
()
{
fakeAnnotationUI
.
findIDsForTags
.
returns
([
'id1'
,
'id2'
,
'id3'
]);
...
...
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