Skip to content

Commit

Permalink
initial reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Jun 20, 2024
1 parent 890ae2d commit a3765c5
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 7 deletions.
20 changes: 20 additions & 0 deletions app/components/foo.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<p>
To reproduce the error, click open, then close.
</p>

<button type="button" class="open" {{on "click" this.open}}>
Open
</button>

<button
type="button"
class="close"
{{on "click" this.close}}
{{on "click" (fn this.setValue "foo")}}
>
Close
</button>

<div {{(if this.isOpen (modifier this.myModifier this.value))}}>
Hello World
</div>
34 changes: 34 additions & 0 deletions app/components/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Component from '@glimmer/component';
import { modifier } from 'ember-modifier';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';

export default class Foo extends Component {
@tracked isOpen = false;
@tracked value;

myModifier = modifier(
(element, [value]) => {
console.log('running modifier', value);
},
{ eager: false },
);

@action
open() {
console.log('open');
this.isOpen = true;
}

@action
close() {
console.log('close');
this.isOpen = false;
}

@action
setValue(value) {
console.log('setValue');
this.value = value;
}
}
8 changes: 1 addition & 7 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
{{page-title "Example"}}

{{! The following component displays Ember's default welcome message. }}
<WelcomePage />
{{! Feel free to remove this! }}

{{outlet}}
<Foo />
15 changes: 15 additions & 0 deletions tests/acceptance/application-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'example/tests/helpers';

module('Acceptance | application', function (hooks) {
setupApplicationTest(hooks);

test('does not blow up', async function (assert) {
assert.expect(0);

await visit('/');
await click('.open');
await click('.close');
});
});

0 comments on commit a3765c5

Please sign in to comment.