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

Stop using "#with" in macro tests #1975

Merged
merged 1 commit into from
Jun 11, 2024
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
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
Loading