Skip to content

Test for dynamic content in Glimmer2 #68

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

Merged
merged 1 commit into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/acceptance/wormhole-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,21 @@ test('document-title example', function(assert) {
assert.equal(document.title, 'ember-wormhole');
});
});

// tests for dynamic content updates inside wormhole, which is failing with Glimmer2, see https://github.com/yapplabs/ember-wormhole/issues/66
test('toggle modal overlay', function(assert) {
visit('/');
andThen(function() {
assert.equal(currentPath(), 'index');
});
click('button:contains(Toggle Modal)');
andThen(function() {
assert.equal($('#modals .overlay').length, 1, 'overlay is visible');
assert.equal($('#modals .dialog').length, 1, 'dialog is visible');
});
click('button:contains(Toggle Overlay)');
andThen(function() {
assert.equal($('#modals .overlay').length, 0, 'overlay is not visible');
assert.equal($('#modals .dialog').length, 1, 'dialog is still visible');
});
});
4 changes: 4 additions & 0 deletions tests/dummy/app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default Ember.Controller.extend({
isInPlace: false,
isTestingDocumentTitle: false,
favicon: "http://emberjs.com/images/favicon.png",
isShowingOverlay: true,
actions: {
toggleModal() {
this.toggleProperty('isShowingModal');
Expand All @@ -25,6 +26,9 @@ export default Ember.Controller.extend({
},
toggleTitle() {
this.toggleProperty('isTestingDocumentTitle');
},
toggleOverlay() {
this.toggleProperty('isShowingOverlay');
}
}
});
3 changes: 3 additions & 0 deletions tests/dummy/app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@
</label>
{{#if isShowingModal}}
{{#ember-wormhole to='modals'}}
{{#if isShowingOverlay}}
<div class="overlay" {{action 'toggleModal'}}></div>
{{/if}}
<div class="dialog">
<h1>Hi, I'm a simple modal dialog</h1>
<p>Here we have some content which is bound from the context
where the wormhole component was used: "{{user.username}}"</p>
<button {{action 'toggleModal'}}>Close</button>
<button {{action 'toggleOverlay'}}>Toggle Overlay</button>
</div>
{{/ember-wormhole}}
{{/if}}
Expand Down