diff --git a/packages/@glimmer-workspace/integration-tests/test/modifiers/on-test.ts b/packages/@glimmer-workspace/integration-tests/test/modifiers/on-test.ts
index ad43550b9..d81cf1835 100644
--- a/packages/@glimmer-workspace/integration-tests/test/modifiers/on-test.ts
+++ b/packages/@glimmer-workspace/integration-tests/test/modifiers/on-test.ts
@@ -315,11 +315,37 @@ if (hasDom) {
this.assertCounts({ adds: 1, removes: 0 });
}
+ @test
+ 'updates to a (remaining truthy) condition do not leave the element without an attached modifier'(assert:
+ Assert) {
+ let calledCount = 0;
+
+ this.render('', {
+ callback() {
+ calledCount++;
+ },
+ condition: true,
+ });
+
+ this.findButton().click();
+ assert.strictEqual(calledCount, 1, 'callback is being invoked');
+
+ this.rerender({ condition: true });
+
+ this.findButton().click();
+ assert.strictEqual(calledCount, 2, 'callback is being invoked');
+
+ this.rerender({ condition: true });
+
+ this.findButton().click();
+ assert.strictEqual(calledCount, 3, 'callback is being invoked');
+ }
+
@test
'asserts when eventName is missing'(assert: Assert) {
assert.throws(() => {
this.render(``, {
- callback() {},
+ callback() { },
});
}, /You must pass a valid DOM event name as the first argument to the `on` modifier/u);
}
@@ -328,7 +354,7 @@ if (hasDom) {
'asserts when eventName is a bound undefined value'(assert: Assert) {
assert.throws(() => {
this.render(``, {
- callback() {},
+ callback() { },
});
}, /You must pass a valid DOM event name as the first argument to the `on` modifier/u);
}
@@ -337,7 +363,7 @@ if (hasDom) {
'asserts when eventName is a function'(assert: Assert) {
assert.throws(() => {
this.render(``, {
- callback() {},
+ callback() { },
});
}, /You must pass a valid DOM event name as the first argument to the `on` modifier/u);
}
@@ -384,7 +410,7 @@ if (hasDom) {
'asserts if more than 2 positional parameters are provided'(assert: Assert) {
assert.throws(() => {
this.render(``, {
- callback() {},
+ callback() { },
someArg: 'foo',
});
}, /You can only pass two positional arguments \(event name and callback\) to the `on` modifier, but you provided 3. Consider using the `fn` helper to provide additional arguments to the `on` callback./u);