Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mirador-video-annotations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Loïs Poujade
mirador-video-annotations
Commits
2cddf26d
Commit
2cddf26d
authored
Oct 11, 2020
by
Jack Reed
Committed by
Chris Beer
Oct 13, 2020
Browse files
Options
Downloads
Patches
Plain Diff
Add tests around sagas updates for window
parent
fd2ba187
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
__tests__/src/sagas/windows.test.js
+44
-0
44 additions, 0 deletions
__tests__/src/sagas/windows.test.js
src/state/sagas/windows.js
+1
-2
1 addition, 2 deletions
src/state/sagas/windows.js
with
45 additions
and
2 deletions
__tests__/src/sagas/windows.test.js
+
44
−
0
View file @
2cddf26d
...
...
@@ -17,6 +17,7 @@ import {
}
from
'
../../../src/state/selectors
'
;
import
{
fetchManifests
}
from
'
../../../src/state/sagas/iiif
'
;
import
{
determineAndShowCollectionDialog
,
fetchWindowManifest
,
setWindowDefaultSearchQuery
,
setWindowStartingCanvas
,
...
...
@@ -30,6 +31,7 @@ import {
setCollectionPath
,
}
from
'
../../../src/state/sagas/windows
'
;
import
fixture
from
'
../../fixtures/version-2/019.json
'
;
import
collectionFixture
from
'
../../fixtures/version-2/collection.json
'
;
describe
(
'
window-level sagas
'
,
()
=>
{
describe
(
'
fetchWindowManifest
'
,
()
=>
{
...
...
@@ -40,10 +42,12 @@ describe('window-level sagas', () => {
manifestId
:
'
manifest.json
'
,
},
};
const
manifest
=
Utils
.
parseManifest
(
fixture
);
return
expectSaga
(
fetchWindowManifest
,
action
)
.
provide
([
[
select
(
getManifests
),
{}],
[
select
(
getManifestoInstance
,
{
manifestId
:
'
manifest.json
'
}),
manifest
],
[
call
(
fetchManifests
,
'
manifest.json
'
),
{}],
[
call
(
setWindowStartingCanvas
,
action
)],
[
call
(
setWindowDefaultSearchQuery
,
action
)],
...
...
@@ -66,9 +70,11 @@ describe('window-level sagas', () => {
[
call
(
setWindowStartingCanvas
,
action
)],
[
call
(
setWindowDefaultSearchQuery
,
action
)],
[
call
(
setCollectionPath
,
{
manifestId
:
'
manifest.json
'
,
windowId
:
'
x
'
})],
[
call
(
determineAndShowCollectionDialog
,
'
manifest.json
'
,
'
x
'
)],
])
.
call
(
setWindowStartingCanvas
,
action
)
.
call
(
setWindowDefaultSearchQuery
,
action
)
.
call
(
determineAndShowCollectionDialog
,
'
manifest.json
'
,
'
x
'
)
.
run
();
});
});
...
...
@@ -434,4 +440,42 @@ describe('window-level sagas', () => {
.
run
();
});
});
describe
(
'
determineAndShowCollectionDialog
'
,
()
=>
{
it
(
'
shows the collection dialog if it is a collection
'
,
()
=>
{
const
manifest
=
Utils
.
parseManifest
(
collectionFixture
);
return
expectSaga
(
determineAndShowCollectionDialog
,
'
manifest.json
'
,
'
x
'
)
.
provide
([
[
select
(
getManifestoInstance
,
{
manifestId
:
'
manifest.json
'
}),
manifest
],
])
.
put
.
like
({
action
:
{
collectionPath
:
[],
manifestId
:
'
manifest.json
'
,
type
:
'
mirador/SHOW_WINDOW_COLLECTION_DIALOG
'
,
windowId
:
'
x
'
,
},
})
.
run
();
});
it
(
'
does nothing if not a collection
'
,
()
=>
{
const
manifest
=
Utils
.
parseManifest
(
fixture
);
return
expectSaga
(
determineAndShowCollectionDialog
,
'
manifest.json
'
,
'
x
'
)
.
provide
([
[
select
(
getManifestoInstance
,
{
manifestId
:
'
manifest.json
'
}),
manifest
],
])
.
not
.
put
.
like
({
action
:
{
collectionPath
:
[],
manifestId
:
'
manifest.json
'
,
type
:
'
mirador/SHOW_WINDOW_COLLECTION_DIALOG
'
,
windowId
:
'
x
'
,
},
})
.
run
();
});
});
});
This diff is collapsed.
Click to expand it.
src/state/sagas/windows.js
+
1
−
2
View file @
2cddf26d
...
...
@@ -235,8 +235,7 @@ export function* fetchInfoResponses({ visibleCanvases: visibleCanvasIds, windowI
/** */
export
function
*
determineAndShowCollectionDialog
(
manifestId
,
windowId
)
{
const
manifestoInstance
=
yield
select
(
getManifestoInstance
,
{
manifestId
});
const
isCollection
=
manifestoInstance
.
isCollection
();
if
(
isCollection
)
{
if
(
manifestoInstance
&&
manifestoInstance
.
isCollection
())
{
yield
put
(
showWindowCollectionDialog
(
manifestId
,
[],
windowId
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment