diff --git a/test-app/tests/integration/components/buttons/button-group-test.ts b/test-app/tests/integration/components/buttons/button-group-test.gts similarity index 65% rename from test-app/tests/integration/components/buttons/button-group-test.ts rename to test-app/tests/integration/components/buttons/button-group-test.gts index d9f75500..b58febc8 100644 --- a/test-app/tests/integration/components/buttons/button-group-test.ts +++ b/test-app/tests/integration/components/buttons/button-group-test.gts @@ -1,9 +1,11 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; import { registerCustomStyles } from '@frontile/theme'; import { tv } from 'tailwind-variants'; +import { ButtonGroup } from '@frontile/buttons'; +import { cell } from 'ember-resources'; +import { settled } from '@ember/test-helpers'; module( 'Integration | Component | ButtonGroup | @frontile/buttons', @@ -61,10 +63,12 @@ module( test('it renders', async function (assert) { await render( - hbs` - Button - Toggle - ` + ); assert.dom('[data-test-id="group"]').exists(); @@ -75,12 +79,13 @@ module( module('Style classes', () => { module('@appearance', () => { test('it adds class for default appearance', async function (assert) { - this.set('appearance', ''); await render( - hbs` - Button - Toggle - ` + ); assert @@ -92,12 +97,18 @@ module( }); test('it adds class for outlined appearance', async function (assert) { - this.set('appearance', 'outlined'); + const appearance = cell<'outlined'>('outlined'); await render( - hbs` - Button - Toggle - ` + ); assert.dom('[data-test-id="button"]').doesNotHaveClass('btn'); @@ -109,17 +120,24 @@ module( module('@intent', () => { test('it adds class for the an intent', async function (assert) { - this.set('intent', 'primary'); + const intent = cell<'primary' | 'danger'>('primary'); await render( - hbs` - Button - Toggle - ` + ); assert.dom('[data-test-id="button"]').hasClass('intent-primary'); assert.dom('[data-test-id="toggle"]').hasClass('intent-primary'); - this.set('intent', 'danger'); + intent.current = 'danger'; + await settled(); assert.dom('[data-test-id="button"]').hasClass('intent-danger'); assert.dom('[data-test-id="toggle"]').hasClass('intent-danger'); }); @@ -127,17 +145,20 @@ module( module('@size', () => { test('it adds class for the an intent', async function (assert) { - this.set('size', 'sm'); + const size = cell<'sm' | 'lg'>('sm'); await render( - hbs` - Button - Toggle - ` + ); assert.dom('[data-test-id="button"]').hasClass('btn-sm'); assert.dom('[data-test-id="toggle"]').hasClass('toggle-button-sm'); - this.set('size', 'lg'); + size.current = 'lg'; + await settled(); assert.dom('[data-test-id="button"]').hasClass('btn-lg'); assert.dom('[data-test-id="toggle"]').hasClass('toggle-button-lg'); }); diff --git a/test-app/tests/integration/components/buttons/buttons-test.ts b/test-app/tests/integration/components/buttons/buttons-test.gts similarity index 76% rename from test-app/tests/integration/components/buttons/buttons-test.ts rename to test-app/tests/integration/components/buttons/buttons-test.gts index 0d98de8e..4d912a31 100644 --- a/test-app/tests/integration/components/buttons/buttons-test.ts +++ b/test-app/tests/integration/components/buttons/buttons-test.gts @@ -1,9 +1,9 @@ import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render } from '@ember/test-helpers'; -import hbs from 'htmlbars-inline-precompile'; import { registerCustomStyles } from '@frontile/theme'; import { tv } from 'tailwind-variants'; +import { Button } from '@frontile/buttons'; registerCustomStyles({ button: tv({ @@ -44,7 +44,11 @@ module( setupRenderingTest(hooks); test('it renders', async function (assert) { - await render(hbs``); + await render( + + ); assert.dom('[data-test-id="button"]').hasText('My Button'); assert.dom('[data-test-id="button"]').hasAttribute('type', 'button'); @@ -52,7 +56,9 @@ module( test('it accepts @type argument', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').hasAttribute('type', 'submit'); @@ -61,7 +67,11 @@ module( module('Style classes', () => { module('@appearance', () => { test('it adds class for default appearance', async function (assert) { - await render(hbs``); + await render( + + ); assert .dom('[data-test-id="button"]') @@ -73,7 +83,9 @@ module( test('it adds class for outlined appearance', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').doesNotHaveClass('btn'); @@ -84,7 +96,9 @@ module( test('it adds class for minimal appearance', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').doesNotHaveClass('btn'); @@ -97,7 +111,9 @@ module( test('it adds class for custom appearance', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').doesNotHaveClass('btn'); @@ -112,7 +128,9 @@ module( module('@intent', () => { test('it adds class for the an intent', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').hasClass('intent-primary'); @@ -122,7 +140,9 @@ module( module('sizes', () => { test('it adds class size xs"', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').hasClass('btn-xs'); @@ -130,7 +150,9 @@ module( test('it adds class size xl', async function (assert) { await render( - hbs`` + ); assert.dom('[data-test-id="button"]').hasClass('btn-xl'); @@ -140,9 +162,11 @@ module( test('it yields classNames when renderless', async function (assert) { await render( - hbs`