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

Add some additional coverage for strict mode/internal keywords #20673

Merged
merged 1 commit into from
Mar 29, 2024
Merged
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
Expand Up @@ -258,6 +258,48 @@ moduleFor(
this.render('<Foo/>');
this.click('button');
}

// Ember currently uses AST plugins to implement certain features that
// glimmer-vm does not natively provide, such as {{#each-in}}, {{outlet}}
// {{mount}} and some features in {{#in-element}}. These rewrites the AST
// and insert private keywords e.g. `{{#each (-each-in)}}`. These tests
// ensures we have _some_ basic coverage for those features in strict mode.
//
// Ultimately, our test coverage for strict mode is quite inadequate. This
// is particularly important as we expect more apps to start adopting the
// feature. Ideally we would run our entire/most of our test suite against
// both strict and resolution modes, and these things would be implicitly
// covered elsewhere, but until then, these coverage are essential.

'@test Can use each-in'() {
let obj = {
foo: 'FOO',
bar: 'BAR',
};

let Foo = defineComponent({ obj }, '{{#each-in obj as |k v|}}[{{k}}:{{v}}]{{/each-in}}');

this.registerComponent('foo', { ComponentClass: Foo });

this.render('<Foo/>');
this.assertHTML('[foo:FOO][bar:BAR]');
this.assertStableRerender();
}

'@test Can use in-element'() {
let getElement = (id) => document.getElementById(id);

let Foo = defineComponent(
{ getElement },
'{{#in-element (getElement "in-element-test")}}before{{/in-element}}after'
);

this.registerComponent('foo', { ComponentClass: Foo });

this.render('[<div id="in-element-test" />][<Foo/>]');
this.assertText('[before][after]');
this.assertStableRerender();
}
}
);

Expand Down
Loading