Skip to content

Commit

Permalink
chore: remove Button's test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
clintcs committed Aug 17, 2023
1 parent 532ab89 commit ce91639
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 40 deletions.
6 changes: 6 additions & 0 deletions .changeset/tidy-roses-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@crowdstrike/ember-toucan-core': minor
'@crowdstrike/ember-toucan-form': minor
---

Remove Button's test helpers
23 changes: 0 additions & 23 deletions packages/ember-toucan-core/src/test-support/components/button.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/ember-toucan-core/src/test-support/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { AutocompletePageObject } from './components/autocomplete';
export { ButtonPageObject } from './components/button';
export { MultiselectPageObject } from './components/multiselect';
24 changes: 8 additions & 16 deletions test-app/tests/integration/components/button-test.gts
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
import { render, setupOnerror } from '@ember/test-helpers';
import { click, render, setupOnerror } from '@ember/test-helpers';
import { module, test } from 'qunit';

import Button from '@crowdstrike/ember-toucan-core/components/button';
import { setupRenderingTest } from 'test-app/tests/helpers';

import { ButtonPageObject } from '@crowdstrike/ember-toucan-core/test-support';

module('Integration | Component | button', function (hooks) {
setupRenderingTest(hooks);

let buttonPageObject = new ButtonPageObject('[data-button]');

test('it renders', async function (assert) {
await render(<template>
<Button data-button>
text
</Button>
</template>);

assert.strictEqual(buttonPageObject.text, 'text');
assert.false(buttonPageObject.isDisabled);
assert.dom('[data-button]').hasText('text');
assert.dom('[data-button]').isEnabled();

assert
.dom(buttonPageObject.element)
.dom('[data-button]')
.hasAttribute('type', 'button', 'Expected default type to be "button"');
});

Expand All @@ -35,8 +31,6 @@ module('Integration | Component | button', function (hooks) {
</Button>
</template>);

assert.true(buttonPageObject.isLoading);

assert
.dom('[data-test-loading-content]')
.exists('Expect to have loading named block rendered');
Expand All @@ -55,8 +49,6 @@ module('Integration | Component | button', function (hooks) {
</Button>
</template>);

assert.false(buttonPageObject.isLoading);

assert
.dom('[data-test-loading]')
.doesNotExist('Expected to NOT have loading named block rendered');
Expand All @@ -73,7 +65,7 @@ module('Integration | Component | button', function (hooks) {
</Button>
</template>);

assert.true(buttonPageObject.isDisabled);
assert.dom('[data-button]').hasAttribute('aria-disabled', 'true');
});

test('it yields a disabled named block when `@isDisabled={{true}}', async function (assert) {
Expand Down Expand Up @@ -123,7 +115,7 @@ module('Integration | Component | button', function (hooks) {

assert.verifySteps([]);

await buttonPageObject.click();
await click('[data-button]');

assert.verifySteps(['clicked']);
});
Expand All @@ -139,7 +131,7 @@ module('Integration | Component | button', function (hooks) {

assert.verifySteps([]);

await buttonPageObject.click();
await click('[data-button]');

assert.verifySteps([]);
});
Expand All @@ -150,7 +142,7 @@ module('Integration | Component | button', function (hooks) {
setupOnerror((e: Error) => {
assert.ok(
e.message.includes('Invalid variant for Button'),
'Expected assertion error message'
'Expected assertion error message',
);
});

Expand Down

0 comments on commit ce91639

Please sign in to comment.