-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
Support testing without an application template wrapper. #305
Changes from 7 commits
b33e608
008a507
cf11a35
6108cc3
b2708fa
7d0b188
71d0ec0
cce1782
7af8ea2
df741fb
a16b9d3
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 |
---|---|---|
|
@@ -19,7 +19,12 @@ export function visit() { | |
return owner.visit(...arguments); | ||
}) | ||
.then(() => { | ||
context.element = document.querySelector('#ember-testing > .ember-view'); | ||
// eslint-disable-next-line | ||
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 would prefer 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. agree, will update |
||
if (EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) { | ||
context.element = document.querySelector('#ember-testing > .ember-view'); | ||
} else { | ||
context.element = document.querySelector('#ember-testing'); | ||
} | ||
}) | ||
.then(settled); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,7 +196,12 @@ export default function setupRenderingContext(context) { | |
// In older Ember versions (2.4) the element itself is not stable, | ||
// and therefore we cannot update the `this.element` until after the | ||
// rendering is completed | ||
context.element = getRootElement().querySelector('.ember-view'); | ||
// eslint-disable-next-line | ||
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. see above |
||
if (EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) { | ||
context.element = getRootElement().querySelector('.ember-view'); | ||
} else { | ||
context.element = getRootElement(); | ||
} | ||
|
||
return context; | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
"ember-cli-htmlbars-inline-precompile": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ember/optional-features": "^0.5.1", | ||
"documentation": "^5.3.5", | ||
"ember-cli": "~2.18.0", | ||
"ember-cli-dependency-checker": "^2.0.0", | ||
|
@@ -54,9 +55,9 @@ | |
"ember-maybe-import-regenerator-for-testing": "^1.0.0", | ||
"ember-native-dom-event-dispatcher": "^0.6.3", | ||
"ember-resolver": "^4.0.0", | ||
"ember-source": "~2.18.0", | ||
"ember-source": "~3.0.0-beta.5", | ||
"ember-source-channel-url": "^1.0.1", | ||
"ember-try": "^0.2.23", | ||
"ember-try": "^1.0.0-beta.1", | ||
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. offtopic: mmhhh.... I have thoughts about promoting this to 1.0.0... 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. haha, we can always make a 2.0 😸 If there are specific things wrong with ember-try, please make issues so we can discuss the details. IMHO, there is basically no reason to not have the ability to signal "new API's are added" (normal minor version bump) from "bug fixes" (normal patch release). 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. |
||
"eslint-config-prettier": "^2.6.0", | ||
"eslint-plugin-disable-features": "^0.1.3", | ||
"eslint-plugin-node": "^5.2.1", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,18 +119,10 @@ module('setupRenderingContext "real world"', function(hooks) { | |
test('can click on a sibling element of this.element (within the rootElement)', async function(assert) { | ||
let rootElement = document.getElementById('ember-testing'); | ||
|
||
assert.notEqual( | ||
rootElement, | ||
this.element, | ||
'precond - confirm that the rootElement is different from this.element' | ||
); | ||
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. should we keep this assertion and run it conditionally instead? 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. ya, I'll make it two tests |
||
|
||
this.set('rootElement', rootElement); | ||
|
||
await render(hbs`{{#-in-element rootElement}}{{click-me-button}}{{/-in-element}}`); | ||
|
||
// this will need to be modified / removed once RFC280 lands | ||
assert.equal(this.element.textContent, '', 'no content is contained _within_ this.element'); | ||
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. why is this removed? 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. Because 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. what content will be in there and why wasn't it in there before? I'm not sure I understand the assertion 🤔 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. The test (as it exists on master) is actually testing a few different things:
As you can tell some of these assertions are no longer needed with the changes from emberjs/rfcs#280. Specifically:
without the wrapper DIV, the
due to the above, this is not true any longer. These two changes are the assertions that were being removed (when you commented). I have changed things around a bit so that we have two different tests (one with an application template wrapper and one without it). 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.
given that we use 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 behavior was changed in #295. tldr; we don't use 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 see. Turns out we are still on v0.7.10 of |
||
assert.equal( | ||
rootElement.textContent, | ||
'Click Me!', | ||
|
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.
can we drop the
canary
from the scenario name? I assume this functionality will eventually exist outside of canary and that currently it uses canary is only an implementation detail, right?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.
yep, will do