From 4335ab2d57cfd69d72cf0066480490a49da44c20 Mon Sep 17 00:00:00 2001 From: Sergey Astapov Date: Tue, 15 Oct 2024 12:02:31 -0400 Subject: [PATCH] Replace `with` template helper with `let` (#677) --- tests/integration/helpers/changeset-test.js | 52 ++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tests/integration/helpers/changeset-test.js b/tests/integration/helpers/changeset-test.js index 5af37f43..675bbf82 100644 --- a/tests/integration/helpers/changeset-test.js +++ b/tests/integration/helpers/changeset-test.js @@ -36,7 +36,7 @@ module('Integration | Helper | changeset', function (hooks) { this.submit = (changeset) => changeset.validate(); this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel this.validate) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validate) as |changesetObj|}} {{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} @@ -44,7 +44,7 @@ module('Integration | Helper | changeset', function (hooks) { - {{/with}} + {{/let}} `); await fillIn('#first-name', 'A'); @@ -70,7 +70,7 @@ module('Integration | Helper | changeset', function (hooks) { this.submit = (changeset) => changeset.validate(); this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel this.validations) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validations) as |changesetObj|}} {{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} @@ -78,7 +78,7 @@ module('Integration | Helper | changeset', function (hooks) { - {{/with}} + {{/let}} `); await fillIn('#first-name', 'A'); @@ -110,7 +110,7 @@ module('Integration | Helper | changeset', function (hooks) { this.submit = (changeset) => changeset.validate(); this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel this.validations) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validations) as |changesetObj|}} {{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} @@ -118,7 +118,7 @@ module('Integration | Helper | changeset', function (hooks) { - {{/with}} + {{/let}} `); await fillIn('#first-name', 'A'); @@ -151,7 +151,7 @@ module('Integration | Helper | changeset', function (hooks) { this.submit = (changeset) => changeset.validate(); this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel this.validations) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validations) as |changesetObj|}} {{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} @@ -159,7 +159,7 @@ module('Integration | Helper | changeset', function (hooks) { - {{/with}} + {{/let}} `); await fillIn('#first-name', 'A'); @@ -175,10 +175,10 @@ module('Integration | Helper | changeset', function (hooks) { this.dummyModel = { firstName: 'Jim' }; this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel) as |changesetObj|}} + {{#let (changeset this.dummyModel) as |changesetObj|}} - {{/with}} + {{/let}} `); assert.dom('#first-name').hasValue('Jim', 'precondition'); @@ -193,7 +193,7 @@ module('Integration | Helper | changeset', function (hooks) { this.submit = (changeset) => changeset.validate(); this.reset = (changeset) => changeset.rollback(); await render(hbs` - {{#with (changeset this.dummyModel) as |changesetObj|}} + {{#let (changeset this.dummyModel) as |changesetObj|}} {{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} @@ -201,7 +201,7 @@ module('Integration | Helper | changeset', function (hooks) { - {{/with}} + {{/let}} `); await click('#submit-btn'); @@ -214,7 +214,7 @@ module('Integration | Helper | changeset', function (hooks) { changeset.firstName = evt.target.value; }; await render(hbs` - {{#with (changeset this.dummyModel) as |changesetObj|}} + {{#let (changeset this.dummyModel) as |changesetObj|}}

{{changesetObj.firstName}} {{changesetObj.lastName}}

- {{/with}} + {{/let}} `); assert.dom('h1').hasText('Jim Bob', 'precondition'); @@ -238,7 +238,7 @@ module('Integration | Helper | changeset', function (hooks) { changeset.firstName = evt.target.value; }; await render(hbs` - {{#with (changeset this.dummyModel this.this.validate) as |changesetObj|}} + {{#let (changeset this.dummyModel this.this.validate) as |changesetObj|}}

{{changesetObj.firstName}} {{changesetObj.lastName}}

- {{/with}} + {{/let}} `); assert.dom('h1').hasText('Jim Bob', 'precondition'); @@ -550,9 +550,9 @@ module('Integration | Helper | changeset', function (hooks) { let momentInstance = new Moment(d); this.dummyModel = { startDate: momentInstance }; await render(hbs` - {{#with (changeset this.dummyModel) as |changesetObj|}} + {{#let (changeset this.dummyModel) as |changesetObj|}}

{{changesetObj.startDate.date}}

- {{/with}} + {{/let}} `); assert.dom('h1').hasText(d.toString(), 'should update observable value'); @@ -562,9 +562,9 @@ module('Integration | Helper | changeset', function (hooks) { let d = new Date('2015'); this.d = d; await render(hbs` - {{#with (changeset (hash date=this.d)) as |changesetObj|}} + {{#let (changeset (hash date=this.d)) as |changesetObj|}}

{{changesetObj.date}}

- {{/with}} + {{/let}} `); assert.dom('h1').hasText(d.toString(), 'should update observable value'); @@ -573,7 +573,7 @@ module('Integration | Helper | changeset', function (hooks) { test('it handles models that are promises', async function (assert) { this.dummyModel = Promise.resolve({ firstName: 'Jim', lastName: 'Bob' }); await render(hbs` - {{#with (changeset this.dummyModel) as |changesetObj|}} + {{#let (changeset this.dummyModel) as |changesetObj|}}

{{changesetObj.firstName}} {{changesetObj.lastName}}

- {{/with}} + {{/let}} `); await fillIn('#first-name', 'foo'); @@ -596,14 +596,14 @@ module('Integration | Helper | changeset', function (hooks) { this.dummyModel = { firstName: 'Jim', lastName: 'Bob' }; this.validate = () => false; await render(hbs` - {{#with (changeset this.dummyModel this.validate skipValidate=true) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validate skipValidate=true) as |changesetObj|}}

{{changesetObj.firstName}} {{changesetObj.lastName}}

{{#if changesetObj.isInvalid}}

There were one or more errors in your form.

{{/if}} - {{/with}} + {{/let}} `); assert.dom('h1').hasText('Jim Bob', 'precondition'); @@ -633,13 +633,13 @@ module('Integration | Helper | changeset', function (hooks) { this.reset = (changeset) => changeset.rollback(); this.changesetKeys = ['lastName']; await render(hbs` - {{#with (changeset this.dummyModel this.validate changesetKeys=this.changesetKeys) as |changesetObj|}} + {{#let (changeset this.dummyModel this.validate changesetKeys=this.changesetKeys) as |changesetObj|}} {{#if changesetObj.isDirty}}

There were one or more errors in your form.

{{/if}} - {{/with}} + {{/let}} `); await fillIn('#first-name', 'A');