Skip to content

Commit

Permalink
Merge pull request #1975 from embroider-build/fix-with
Browse files Browse the repository at this point in the history
Stop using "#with" in macro tests
  • Loading branch information
mansona committed Jun 11, 2024
2 parents 8c70a40 + a49aa01 commit 2bf520d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/macros/tests/glimmer/get-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe(`macroGetConfig`, function () {
});

test('macroGetOwnConfig in subexpression position', function () {
let code = transform(`{{#with (macroGetOwnConfig "mode") as |m|}}{{m}}{{/with}}`);
let code = transform(`{{#let (macroGetOwnConfig "mode") as |m|}}{{m}}{{/let}}`);
expect(code).toMatch(/\{\{#with ["']amazing["'] as |m|\}\}/);
});

test('macroGetConfig in subexpression position', function () {
let code = transform(`{{#with (macroGetConfig "scenario-tester" "color") as |m|}}{{m}}{{/with}}`);
let code = transform(`{{#let (macroGetConfig "scenario-tester" "color") as |m|}}{{m}}{{/let}}`);
expect(code).toMatch(/\{\{#with ["']orange["'] as |m|\}\}/);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module('Integration | Macro | common', function(hooks) {
setupRenderingTest(hooks);

test('our macros do not shadow local variables', async function(assert) {
await render(hbs`{{#with "hello" as |macroDependencySatisfies|}} {{macroDependencySatisfies}} {{/with}}`);
await render(hbs`{{#let "hello" as |macroDependencySatisfies|}} {{macroDependencySatisfies}} {{/let}}`);
assert.equal(this.element.textContent.trim(), 'hello');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module('Integration | Macro | getConfig', function(hooks) {
});

test('macroGetOwnConfig in subexpression position', async function(assert) {
await render(hbs`{{#with (macroGetOwnConfig "mode") as |m|}}{{m}}{{/with}}`);
await render(hbs`{{#let (macroGetOwnConfig "mode") as |m|}}{{m}}{{/let}}`);
assert.equal(this.element.textContent.trim(), 'amazing');
});

test('macroGetConfig in subexpression position', async function(assert) {
await render(hbs`{{#with (macroGetConfig "ember-source" "color") as |m|}}{{m}}{{/with}}`);
await render(hbs`{{#let (macroGetConfig "ember-source" "color") as |m|}}{{m}}{{/let}}`);
assert.equal(this.element.textContent.trim(), 'orange');
});

Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/compat-resolver-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,8 @@ Scenarios.fromProject(() => new Project())
'templates/application.hbs': `
{{outlet}}
{{yield bar}}
{{#with (hash submit=(action doit)) as |thing| }}
{{/with}}
{{#let (hash submit=(action doit)) as |thing| }}
{{/let}}
<LinkTo @route="index"/>
<form {{on "submit" doit}}></form>
`,
Expand All @@ -1168,7 +1168,7 @@ Scenarios.fromProject(() => new Project())
expectTranspiled('templates/application.hbs').equalsCode(`
import { precompileTemplate } from "@ember/template-compilation";
import { on } from "@ember/modifier";
export default precompileTemplate("\\n {{outlet}}\\n {{yield bar}}\\n {{#with (hash submit=(action doit)) as |thing|}}\\n {{/with}}\\n <LinkTo @route=\\"index\\" />\\n <form {{on \\"submit\\" doit}}></form>\\n ", {
export default precompileTemplate("\\n {{outlet}}\\n {{yield bar}}\\n {{#let (hash submit=(action doit)) as |thing|}}\\n {{/let}}\\n <LinkTo @route=\\"index\\" />\\n <form {{on \\"submit\\" doit}}></form>\\n ", {
moduleName: "my-app/templates/application.hbs",
scope: () => ({
on,
Expand Down

0 comments on commit 2bf520d

Please sign in to comment.