Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a breakpoint when the window is about to unload. #10417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions blueprints/app/files/tests/test-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { setApplication } from '@ember/test-helpers';
import { setup } from 'qunit-dom';
import { start } from 'ember-qunit';

window.addEventListener('beforeunload', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, and this is potentially workflow altering --

  • live reload triggers this as well
  • and also regular refresh button clicking / f5

idk if there is a way to skip around this during live reload... but that'd be ideal.

console.error('Window is about to unload. This means some test or code has tried to either set window.location or submit a form without "event.preventDefault()". Please use a mock window, window service, preventDefault, or some other technique to prevent navigation during testing');

// eslint-disable-next-line no-debugger
debugger;
});


setApplication(Application.create(config.APP));

setup(QUnit.assert);
Expand Down