-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed errors from 404 error handler for non-transition 404s
ref https://linear.app/tryghost/issue/ONC-323 - our fallback 404 error handler assumed we always had a transition along with the error - this wasn't a bad assumption, it should be very unlikely that we see a 404 outside of navigating to a non-existent/deleted resource - unfortunately we weren't handling the error thrown by our error handler which meant the error was silent as far as the user was concerned - having a silent error meant that in very rare circumstances the editor could get into a state where saving was failing but there was no indication of that - updated the fallback 404 error handler to only do something when navigation was occurring in which case it transitions to the 404 screen, otherwise let the error continue to our generic API error handling which will stay on the current screen but show an error alert - adjusted the editor saving to actually trigger autosave-after-change when testing (albeit with 100ms wait compared to 3s) so the tests better reflect actual behaviour
- Loading branch information
1 parent
a44274d
commit f054205
Showing
5 changed files
with
79 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 2 additions & 14 deletions
16
ghost/admin/tests/acceptance/editor/unsaved-changes-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {click, find, settled, waitFor, waitUntil} from '@ember/test-helpers'; | ||
|
||
export const titleSelector = '[data-test-editor-title-input]'; | ||
export const editorSelector = '[data-secondary-instance="false"] [data-lexical-editor]'; | ||
|
||
export const pasteInEditor = async (text) => { | ||
await waitFor(editorSelector); | ||
await click(editorSelector); | ||
const dataTransfer = new DataTransfer(); | ||
dataTransfer.setData('text/plain', text); | ||
document.activeElement.dispatchEvent(new ClipboardEvent('paste', {clipboardData: dataTransfer, bubbles: true, cancelable: true})); | ||
dataTransfer.clearData(); | ||
const editor = find(editorSelector); | ||
await waitUntil(() => editor.textContent.includes(text)); | ||
await settled(); | ||
}; |