mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Stories: an entry for a deleted story drops its ?story= in any mode
Back or Forward into such an entry from Explore or an open story clears the story and its time from the address and the entry's history state, keeping the globe hash and, when the entry is Explore, Explore itself.
This commit is contained in:
1 parent
6904ce0e7a
commit
82475bced3
2 files changed
+62
-3
No files matched your search
@@ -966,6 +966,48 @@ test('Back into the entry of a deleted story, with Stories closed, clears ?story
|
||||
controller.destroy();
|
||||
});
|
||||
|
||||
for (const [from, enter] of [
|
||||
['Explore', (controller) => controller.open()],
|
||||
['an open story', (controller) => controller.openStory('gev:flights-radar')],
|
||||
]) {
|
||||
test(`Back into the entry of a deleted story, from ${from}, clears ?story=`, () => {
|
||||
const { controller, store } = setup();
|
||||
enter(controller);
|
||||
assert.notEqual(store.mode, 'closed');
|
||||
history.replaceState(
|
||||
{ gevStories: { story: 'gev:gone', depth: 2, explore: 1 } },
|
||||
'',
|
||||
'/?story=gev%3Agone&storyTime=12#lat=1',
|
||||
);
|
||||
dispatchEvent(new PopStateEvent('popstate'));
|
||||
const url = new URL(location.href);
|
||||
assert.equal(url.searchParams.has('story'), false);
|
||||
assert.equal(url.searchParams.has('storyTime'), false);
|
||||
assert.equal(url.hash, '#lat=1', 'the globe state stays');
|
||||
assert.equal(history.state?.gevStories?.story, undefined);
|
||||
controller.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
test('Back into an Explore entry naming a deleted story keeps Explore', () => {
|
||||
const { controller, store } = setup();
|
||||
controller.openStory('gev:flights-radar');
|
||||
history.replaceState(
|
||||
{ gevStories: { story: 'gev:gone', depth: 1, explore: 1 } },
|
||||
'',
|
||||
'/?stories=explore&story=gev%3Agone#lat=1',
|
||||
);
|
||||
dispatchEvent(new PopStateEvent('popstate'));
|
||||
const url = new URL(location.href);
|
||||
assert.equal(url.searchParams.get('stories'), 'explore');
|
||||
assert.equal(url.searchParams.has('story'), false);
|
||||
assert.equal(url.hash, '#lat=1');
|
||||
assert.equal(history.state?.gevStories?.depth, 1);
|
||||
assert.equal(history.state?.gevStories?.story, undefined);
|
||||
assert.equal(store.mode, 'explore');
|
||||
controller.destroy();
|
||||
});
|
||||
|
||||
test('unsaved scenes appear as local drafts and disappear when deleted', () => {
|
||||
setActivePinia(createPinia());
|
||||
history.replaceState(null, '', '/');
|
||||
|
||||
Reference in new issue
Block a user