diff --git a/tests/integration/components/changeset-test.js b/tests/integration/components/changeset-test.js index 2da4192a..696f6e9c 100644 --- a/tests/integration/components/changeset-test.js +++ b/tests/integration/components/changeset-test.js @@ -36,14 +36,14 @@ module('Integration | Helper | changeset', function(hooks) { this.set('submit', (changeset) => changeset.validate()); this.set('reset', (changeset) => changeset.rollback()); await render(hbs` - {{#with (changeset dummyModel (action validate)) as |changeset|}} - {{#if changeset.isInvalid}} + {{#with (changeset dummyModel (action validate)) as |c|}} + {{#if c.isInvalid}}

There were one or more errors in your form.

{{/if}} - {{input id="first-name" value=changeset.firstName}} - {{input id="last-name" value=changeset.lastName}} - - + {{input id="first-name" value=c.firstName}} + {{input id="last-name" value=c.lastName}} + + {{/with}} `); @@ -60,9 +60,9 @@ module('Integration | Helper | changeset', function(hooks) { this.set('dummyModel', { firstName: 'Jim' }); this.set('reset', (changeset) => changeset.rollback()); await render(hbs` - {{#with (changeset dummyModel) as |changeset|}} - {{input id="first-name" value=changeset.firstName}} - + {{#with (changeset dummyModel) as |c|}} + {{input id="first-name" value=c.firstName}} + {{/with}} `); @@ -78,14 +78,14 @@ module('Integration | Helper | changeset', function(hooks) { this.set('submit', (changeset) => changeset.validate()); this.set('reset', (changeset) => changeset.rollback()); await render(hbs` - {{#with (changeset dummyModel) as |changeset|}} - {{#if changeset.isInvalid}} + {{#with (changeset dummyModel) as |c|}} + {{#if c.isInvalid}}

There were one or more errors in your form.

{{/if}} - {{input value=changeset.firstName}} - {{input value=changeset.lastName}} - - + {{input value=c.firstName}} + {{input value=c.lastName}} + + {{/with}} `); @@ -96,14 +96,14 @@ module('Integration | Helper | changeset', function(hooks) { test('it updates when set without a validator', async function(assert) { this.set('dummyModel', { firstName: 'Jim', lastName: 'Bob' }); await render(hbs` - {{#with (changeset dummyModel) as |changeset|}} -

{{changeset.firstName}} {{changeset.lastName}}

+ {{#with (changeset dummyModel) as |c|}} +

{{c.firstName}} {{c.lastName}}

- {{input id="last-name" value=changeset.lastName}} + value={{c.firstName}} + onchange={{action (mut c.firstName) value="target.value"}}> + {{input id="last-name" value=c.lastName}} {{/with}} `); @@ -117,14 +117,14 @@ module('Integration | Helper | changeset', function(hooks) { this.set('dummyModel', { firstName: 'Jim', lastName: 'Bob' }); this.set('validate', () => true); await render(hbs` - {{#with (changeset dummyModel (action validate)) as |changeset|}} -

{{changeset.firstName}} {{changeset.lastName}}

+ {{#with (changeset dummyModel (action validate)) as |c|}} +

{{c.firstName}} {{c.lastName}}

- {{input id="last-name" value=changeset.lastName}} + value={{c.firstName}} + onchange={{action (mut c.firstName) value="target.value"}}> + {{input id="last-name" value=c.lastName}} {{/with}} `); @@ -137,16 +137,16 @@ module('Integration | Helper | changeset', function(hooks) { test('a passed down nested object updates when set without a validator', async function(assert) { let data = { person: { firstName: 'Jim', lastName: 'Bob' } }; let changeset = new Changeset(data); - this.set('changeset', changeset); + this.set('c', changeset); await render(hbs` -

{{changeset.person.firstName}} {{changeset.person.lastName}}

+

{{c.person.firstName}} {{c.person.lastName}}

+ value={{c.person.firstName}} + onchange={{action (mut c.person.firstName) value="target.value"}}> > - {{input id="last-name" value=changeset.person.lastName}} + {{input id="last-name" value=c.person.lastName}} `); assert.equal(find('h1').textContent.trim(), 'Jim Bob', 'precondition'); @@ -158,15 +158,15 @@ module('Integration | Helper | changeset', function(hooks) { test('nested object updates when set without a validator', async function(assert) { let data = { person: { firstName: 'Jim', lastName: 'Bob' } }; let changeset = new Changeset(data); - this.set('changeset', changeset); + this.set('c', changeset); await render(hbs` -

{{changeset.person.firstName}} {{changeset.person.lastName}}

+

{{c.person.firstName}} {{c.person.lastName}}

- {{input id="last-name" value=changeset.person.lastName}} + value={{c.person.firstName}} + onchange={{action (mut c.person.firstName) value="target.value"}}> + {{input id="last-name" value=c.person.lastName}} `); assert.equal(find('h1').textContent.trim(), 'Jim Bob', 'precondition'); @@ -247,16 +247,16 @@ module('Integration | Helper | changeset', function(hooks) { test('a rollback propagates binding to deeply nested changesets', async function(assert) { let data = { person: { firstName: 'Jim', lastName: 'Bob' } }; let changeset = new Changeset(data); - this.set('changeset', changeset); + this.set('c', changeset); this.set('reset', () => changeset.rollback()); await render(hbs` -

{{changeset.person.firstName}} {{changeset.person.lastName}}

+

{{c.person.firstName}} {{c.person.lastName}}

- {{input id="last-name" value=changeset.person.lastName}} + value={{c.person.firstName}} + onchange={{action (mut c.person.firstName) value="target.value"}}> + {{input id="last-name" value=c.person.lastName}} `); @@ -277,7 +277,7 @@ module('Integration | Helper | changeset', function(hooks) { return ({ key, newValue }) => [validationMap[key](newValue)]; }; let changeset = new Changeset({ even: 4, odd: 4 }, lookupValidator(dummyValidations), dummyValidations); - this.set('changeset', changeset); + this.set('c', changeset); this.set('validateProperty', (changeset, property) => changeset.validate(property)); await render(hbs`
@@ -285,13 +285,13 @@ module('Integration | Helper | changeset', function(hooks) { - {{#if changeset.error.even}} - {{changeset.error.even.validation}} + value={{c.even}} + oninput={{action (mut c.even) value="target.value"}} + onblur={{action validateProperty c "even"}}> + {{#if c.error.even}} + {{c.error.even.validation}} {{/if}} - {{changeset.even}} + {{c.even}}
@@ -299,13 +299,13 @@ module('Integration | Helper | changeset', function(hooks) { - {{#if changeset.error.odd}} - {{changeset.error.odd.validation}} + value={{c.odd}} + oninput={{action (mut c.odd) value="target.value"}} + onblur={{action validateProperty c "odd"}}> + {{#if c.error.odd}} + {{c.error.odd.validation}} {{/if}} - {{changeset.odd}} + {{c.odd}}
`); @@ -337,8 +337,8 @@ module('Integration | Helper | changeset', function(hooks) { let momentInstance = new Moment(d); this.set('dummyModel', { startDate: momentInstance }); await render(hbs` - {{#with (changeset dummyModel) as |changeset|}} -

{{changeset.startDate.date}}

+ {{#with (changeset dummyModel) as |c|}} +

{{c.startDate.date}}

{{/with}} `); @@ -349,8 +349,8 @@ module('Integration | Helper | changeset', function(hooks) { let d = new Date('2015'); this.set('d', d); await render(hbs` - {{#with (changeset (hash date=d)) as |changeset|}} -

{{changeset.date}}

+ {{#with (changeset (hash date=d)) as |c|}} +

{{c.date}}

{{/with}} `); @@ -360,14 +360,14 @@ module('Integration | Helper | changeset', function(hooks) { test('it handles models that are promises', async function(assert) { this.set('dummyModel', resolve({ firstName: 'Jim', lastName: 'Bob' })); await render(hbs` - {{#with (changeset dummyModel) as |changeset|}} -

{{changeset.firstName}} {{changeset.lastName}}

+ {{#with (changeset dummyModel) as |c|}} +

{{c.firstName}} {{c.lastName}}

- {{input id="last-name" value=changeset.lastName}} + value={{c.firstName}} + onchange={{action (mut c.firstName) value="target.value"}}> + {{input id="last-name" value=c.lastName}} {{/with}} `); @@ -382,11 +382,11 @@ module('Integration | Helper | changeset', function(hooks) { this.set('dummyModel', { firstName: 'Jim', lastName: 'Bob' }); this.set('validate', () => false); await render(hbs` - {{#with (changeset dummyModel (action validate) skipValidate=true) as |changeset|}} -

{{changeset.firstName}} {{changeset.lastName}}

- {{input id="first-name" value=changeset.firstName}} - {{input id="last-name" value=changeset.lastName}} - {{#if changeset.isInvalid}} + {{#with (changeset dummyModel (action validate) skipValidate=true) as |c|}} +

{{c.firstName}} {{c.lastName}}

+ {{input id="first-name" value=c.firstName}} + {{input id="last-name" value=c.lastName}} + {{#if c.isInvalid}}

There were one or more errors in your form.

{{/if}} {{/with}}