-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b33e608
Support apps with Feature Flag ember-glimmer-remove-application-templ…
cibernox 008a507
Apply last feedback
cibernox cf11a35
Use official mechanism for feature testing.
rwjblue 6108cc3
Remove extra assertions which require wrapper application template.
rwjblue b2708fa
Correct yarn version (use 3.0.0-beta series).
rwjblue 7d0b188
Fix moduleForComponent with missing template wrapper.
rwjblue 71d0ec0
Use explicit check for checking for application template wrapper.
rwjblue cce1782
Cleanup linting enable/disable for EmberENV.
rwjblue 7af8ea2
Simplify naming of without application wrapper scenario.
rwjblue df741fb
Test clicking "wormholed" content with and without wrapper div.
rwjblue a16b9d3
Ensure tests exist for where this.element goes.
rwjblue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/* globals EmberENV */ | ||
import Ember from 'ember'; | ||
import { module, test } from 'qunit'; | ||
import Component from '@ember/component'; | ||
|
@@ -116,34 +117,58 @@ module('setupRenderingContext "real world"', function(hooks) { | |
|
||
// uses `{{-in-element` which was only added in Ember 2.10 | ||
if (hasEmberVersion(2, 10)) { | ||
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'); | ||
assert.equal( | ||
rootElement.textContent, | ||
'Click Me!', | ||
'the rootElement has the correct content after initial render' | ||
); | ||
|
||
await click('.click-me-button'); | ||
|
||
assert.equal( | ||
rootElement.textContent, | ||
'Clicked!', | ||
'the rootElement has the correct content after clicking' | ||
); | ||
}); | ||
if (EmberENV._APPLICATION_TEMPLATE_WRAPPER !== false) { | ||
test('can click on a sibling element of the application template wrapper', async function(assert) { | ||
let rootElement = document.getElementById('ember-testing'); | ||
|
||
assert.notEqual( | ||
rootElement, | ||
this.element, | ||
'precond - confirm that the rootElement is different from this.element' | ||
); | ||
|
||
this.set('rootElement', rootElement); | ||
|
||
await render(hbs`{{#-in-element rootElement}}{{click-me-button}}{{/-in-element}}`); | ||
|
||
assert.equal(this.element.textContent, '', 'no content is contained _within_ this.element'); | ||
assert.equal( | ||
rootElement.textContent, | ||
'Click Me!', | ||
'the rootElement has the correct content after initial render' | ||
); | ||
|
||
await click('.click-me-button'); | ||
|
||
assert.equal( | ||
rootElement.textContent, | ||
'Clicked!', | ||
'the rootElement has the correct content after clicking' | ||
); | ||
}); | ||
} else { | ||
test('can click on a sibling of the rendered content', async function(assert) { | ||
let rootElement = document.getElementById('ember-testing'); | ||
this.set('rootElement', rootElement); | ||
|
||
assert.equal(rootElement.textContent, '', 'the rootElement is empty before rendering'); | ||
|
||
await render(hbs`{{#-in-element rootElement}}{{click-me-button}}{{/-in-element}}`); | ||
|
||
assert.equal( | ||
rootElement.textContent, | ||
'Click Me!', | ||
'the rootElement has the correct content after initial render' | ||
); | ||
|
||
await click('.click-me-button'); | ||
|
||
assert.equal( | ||
rootElement.textContent, | ||
'Clicked!', | ||
'the rootElement has the correct content after clicking' | ||
); | ||
}); | ||
} | ||
} | ||
}); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
ember-cli/ember-try#155