Close viewer after viewing a single story
This commit is contained in:
parent
5ccfabeb0c
commit
42362a2772
2 changed files with 24 additions and 0 deletions
|
@ -842,6 +842,15 @@ const viewStory: ViewStoryActionCreatorType = (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storyViewMode === StoryViewModeType.Single) {
|
||||||
|
// Close the viewer we were just looking at a single story.
|
||||||
|
dispatch({
|
||||||
|
type: VIEW_STORY,
|
||||||
|
payload: undefined,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// When paging through all sent stories
|
// When paging through all sent stories
|
||||||
// Note the order is reversed[1][2] here because we sort the stories by
|
// Note the order is reversed[1][2] here because we sort the stories by
|
||||||
// recency in descending order but the story viewer plays them in
|
// recency in descending order but the story viewer plays them in
|
||||||
|
|
|
@ -130,6 +130,21 @@ describe('both/state/ducks/stories', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('closes the viewer when viewing a single story', () => {
|
||||||
|
const dispatch = sinon.spy();
|
||||||
|
|
||||||
|
viewStory({
|
||||||
|
storyId: UUID.generate().toString(),
|
||||||
|
storyViewMode: StoryViewModeType.Single,
|
||||||
|
viewDirection: StoryViewDirectionType.Next,
|
||||||
|
})(dispatch, getEmptyRootState, null);
|
||||||
|
|
||||||
|
sinon.assert.calledWith(dispatch, {
|
||||||
|
type: 'stories/VIEW_STORY',
|
||||||
|
payload: undefined,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('does not find a story', () => {
|
it('does not find a story', () => {
|
||||||
const dispatch = sinon.spy();
|
const dispatch = sinon.spy();
|
||||||
viewStory({
|
viewStory({
|
||||||
|
|
Loading…
Add table
Reference in a new issue