diff --git a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts index 5080db8994..0804a006d6 100644 --- a/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts +++ b/packages/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.ts @@ -35,7 +35,7 @@ class KeywordImpl< protected keyword: S, type: KeywordType, private delegate: KeywordDelegate, - private options?: { strictOnly: boolean }, + private options?: { strictOnly: boolean } ) { let nodes = new Set(); for (let nodeType of KEYWORD_NODES[type]) { @@ -45,7 +45,10 @@ class KeywordImpl< this.types = nodes; } - protected match(node: KeywordCandidates[K], state: NormalizationState): node is KeywordMatches[K] { + protected match( + node: KeywordCandidates[K], + state: NormalizationState + ): node is KeywordMatches[K] { // some keywords are enabled only in strict mode. None are planned to be loose mode only if (this.options?.strictOnly) { if (state.isStrict === false) { @@ -145,7 +148,12 @@ export function keyword< D extends KeywordDelegate, Out = unknown >(keyword: string, type: K, delegate: D, options?: { strictOnly: boolean }): Keyword { - return new KeywordImpl(keyword, type, delegate as KeywordDelegate, options); + return new KeywordImpl( + keyword, + type, + delegate as KeywordDelegate, + options + ); } export type PossibleKeyword = KeywordNode; diff --git a/packages/@glimmer/integration-tests/test/keywords/equality-test.ts b/packages/@glimmer/integration-tests/test/keywords/equality-test.ts index 14f12a6468..6713945857 100644 --- a/packages/@glimmer/integration-tests/test/keywords/equality-test.ts +++ b/packages/@glimmer/integration-tests/test/keywords/equality-test.ts @@ -1,4 +1,4 @@ -import { RenderTest, test, jitSuite, defineComponent } from '../..'; +import { RenderTest, test, jitSuite, defineComponent, trackedObj } from '../..'; class EqualTest extends RenderTest { static suiteName = '{{eq}} keyword'; @@ -37,13 +37,15 @@ class EqualTest extends RenderTest { @test ['correctly renders when values update eq']() { + let args = trackedObj({ foo: 123, bar: 456 }); + const AComponent = defineComponent({}, '{{eq @foo @bar}}'); - this.renderComponent(AComponent, { foo: 123, bar: 456 }); + this.renderComponent(AComponent, args); this.assertHTML('false'); - this.assertStableRerender(); - this.rerender({ foo: 456 }); + args.foo = 456; + this.rerender(); this.assertHTML('true'); } @@ -86,11 +88,14 @@ class NotEqualTest extends RenderTest { @test ['correctly renders when values update neq']() { + let args = trackedObj({ foo: 123, bar: 456 }); + const AComponent = defineComponent({}, '{{neq @foo @bar}}'); - this.renderComponent(AComponent, { foo: 123, bar: 456 }); + this.renderComponent(AComponent, args); this.assertHTML('true'); + args.foo = 456; this.rerender({ foo: 456 }); this.assertHTML('false');