From 1d43eb695fcd7878befab61379f5f1d0bee3f5ba Mon Sep 17 00:00:00 2001 From: Andrew Kirwin Date: Thu, 20 Jun 2024 09:40:53 +0100 Subject: [PATCH] add failing test demoing https://github.com/ember-modifier/ember-modifier/issues/851 --- .../components/select-box/modifier-test.gjs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/integration/components/select-box/modifier-test.gjs diff --git a/tests/integration/components/select-box/modifier-test.gjs b/tests/integration/components/select-box/modifier-test.gjs new file mode 100644 index 00000000..d0f67dc7 --- /dev/null +++ b/tests/integration/components/select-box/modifier-test.gjs @@ -0,0 +1,42 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'dummy/tests/helpers'; +import { render, click } from '@ember/test-helpers'; +import SelectBox from '@zestia/ember-select-box/components/select-box'; +import { modifier } from 'ember-modifier'; +import { tracked } from '@glimmer/tracking'; + +module('select-box', function (hooks) { + setupRenderingTest(hooks); + + // Regression test for issue + // https://github.com/ember-modifier/ember-modifier/issues/851 + + const position = modifier( + (dropdown, [container]) => (dropdown.dataset.positioned = 'true'), + { eager: false } + ); + + test('it does not blow up', async function (assert) { + assert.expect(0); + + const state = new (class { + @tracked value; + })(); + + const handleChange = (value) => { + state.value = value; + }; + + await render(); + + await click('.select-box__trigger'); // Open + await click('.select-box__option'); // Close + }); +});