-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
288 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/integration/components/dropdown/index/edge-case-test.gjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { module, skip } from 'qunit'; | ||
import { setupRenderingTest } from 'dummy/tests/helpers'; | ||
import { render, focus, triggerKeyEvent } from '@ember/test-helpers'; | ||
import Dropdown from '@zestia/ember-select-box/components/dropdown'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { on } from '@ember/modifier'; | ||
|
||
module('dropdown (edge cases)', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
skip('destroying a dropdown with a focus inside (and no trigger)', async function (assert) { | ||
assert.expect(1); | ||
|
||
const state = new (class { | ||
@tracked show = true; | ||
})(); | ||
|
||
const destroy = (value) => { | ||
state.show = false; | ||
}; | ||
|
||
await render(<template> | ||
{{#if state.show}} | ||
<Dropdown as |dd|> | ||
<input aria-label="example" /> | ||
<button type="button" {{on "keydown" dd.open}} class="open" /> | ||
<button type="button" {{on "keydown" destroy}} class="close" /> | ||
</Dropdown> | ||
{{/if}} | ||
</template>); | ||
|
||
await triggerKeyEvent('.open', 'keydown', 'Enter'); | ||
await focus('input'); | ||
await triggerKeyEvent('.close', 'keydown', 'Enter'); | ||
|
||
assert | ||
.dom('.select-box') | ||
.doesNotExist('does not cause infinite revalidation bug'); | ||
}); | ||
}); |
Oops, something went wrong.