-
-
Notifications
You must be signed in to change notification settings - Fork 261
Make test context reusable during a test #1511
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import type { TestContext } from './setup-context'; | ||
| import settled from './settled.ts'; | ||
| import Ember from 'ember'; | ||
| import { unsetContext } from './setup-context.ts'; | ||
| import settled, { _teardownAJAXHooks } from './settled.ts'; | ||
| import { _cleanupOnerror } from './setup-onerror.ts'; | ||
| import { destroy } from '@ember/destroyable'; | ||
|
|
||
|
|
@@ -30,7 +32,14 @@ export default function teardownContext( | |
| .then(() => { | ||
| _cleanupOnerror(context); | ||
|
|
||
| destroy(context); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the only potential impact of this change would be that if consumers are calling |
||
| _teardownAJAXHooks(); | ||
|
|
||
| // SAFETY: this is intimate API *designed* for us to override. | ||
| (Ember as any).testing = false; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this wasn't here before, can we remove it 😅
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh apologies, you said it was from here: https://github.com/emberjs/ember-test-helpers/pull/1511/files#diff-93af636d6cd5ada55ea13d76db06d4e9447f451caae3fd2dc83a7cd4783bd385L223 ok. nevermind. This needs some thinking unrelated to this PR |
||
|
|
||
| unsetContext(); | ||
|
|
||
| destroy(context.owner); | ||
| }) | ||
| .finally(() => { | ||
| if (waitForSettled) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,16 +16,6 @@ if (isFirefox || isChrome) { | |
| clickSteps.push('selectionchange'); | ||
| } | ||
|
|
||
| /** | ||
| * Prior to Chrome 129 (canary), | ||
| * Chrome 127.x emits an extra selectionchange event sometimes | ||
| * | ||
| * Delete this once we don't want to test against Chrome 127 | ||
| */ | ||
| if (isChrome) { | ||
| clickSteps.push('selectionchange'); | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unrelated to the context reuse issue but fixes test failures currently on master. Since tests are running on Chrome 130 now, I assume this is safe to remove. |
||
|
|
||
| module('DOM Helper: fillIn', function (hooks) { | ||
| if (!hasEmberVersion(2, 4)) { | ||
| return; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we cannot import from
emberas it's planned to be deprecated soonish in the v6 series.See: emberjs/rfcs#1003
the RFC also has a big list of alternate ways to get what you need though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. This isn't new though, just moved from
setup-context.tsand there are several other imports currently in the repo.Also this project is setting
Ember.testing, I only see an alternative for checking it.