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

[Glimmer2] Migrate bindings integration test #13210

Merged
merged 1 commit into from
Apr 11, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { RenderingTest, moduleFor } from '../utils/test-case';
import { Component } from '../utils/helpers';
import { set } from 'ember-metal/property_set';
import { Binding } from 'ember-metal/binding';

moduleFor('Binding integration tests', class extends RenderingTest {

['@htmlbars should accept bindings as a string or an Ember.binding']() {
let FooBarComponent = Component.extend({
twoWayTestBinding: Binding.from('direction'),
stringTestBinding: 'direction',
twoWayObjectTestBinding: Binding.from('displacement.distance'),
stringObjectTestBinding: 'displacement.distance'
});

this.registerComponent('foo-bar', {
ComponentClass: FooBarComponent,
template: 'two way: {{twoWayTest}}, string: {{stringTest}}, object: {{twoWayObjectTest}}, string object: {{stringObjectTest}}'
});

this.render('{{foo-bar direction=direction displacement=displacement}}', {
direction: 'down',
displacement: {
distance: 10
}
});

this.assertText('two way: down, string: down, object: 10, string object: 10');

this.assertStableRerender();

this.runTask(() => set(this.context, 'direction', 'up'));

this.assertText('two way: up, string: up, object: 10, string object: 10');

this.runTask(() => set(this.context, 'displacement.distance', 20));

this.assertText('two way: up, string: up, object: 20, string object: 20');

this.runTask(() => {
set(this.context, 'direction', 'right');
set(this.context, 'displacement.distance', 30);
});

this.assertText('two way: right, string: right, object: 30, string object: 30');

this.runTask(() => {
set(this.context, 'direction', 'down');
set(this.context, 'displacement', { distance: 10 });
});

this.assertText('two way: down, string: down, object: 10, string object: 10');
}
});
16 changes: 16 additions & 0 deletions packages/ember-glimmer/tests/integration/content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ class DynamicContentTest extends RenderingTest {
this.assertInvariants();
}

['@test it can render undefined dynamic paths']() {
this.renderPath('name', {});

this.assertIsEmpty();

this.assertStableRerender();

this.runTask(() => set(this.context, 'name', 'foo-bar'));

this.assertContent('foo-bar');

this.runTask(() => set(this.context, 'name', undefined));

this.assertIsEmpty();
}

['@test it can render a deeply nested dynamic path']() {
this.renderPath('a.b.c.d.e.f', {
a: { b: { c: { d: { e: { f: 'hello' } } } } }
Expand Down
146 changes: 0 additions & 146 deletions packages/ember-htmlbars/tests/integration/binding_integration_test.js

This file was deleted.