Skip to content

Commit

Permalink
wip commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolechung committed Feb 10, 2023
1 parent 4dd5d32 commit 91b50c0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions test-app/tests/integration/components/field-test.gts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render } from '@ember/test-helpers';
import { render, findAll } from '@ember/test-helpers';
import { module, test } from 'qunit';

import Field from '@crowdstrike/ember-toucan-core/components/form/field';
Expand Down Expand Up @@ -105,20 +105,22 @@ module('Integration | Component | Field', function (hooks) {
// TODO: Checkpoint: finish this
test('it renders conditionally', async function (assert) {
await render(<template>
<Field as |field|>
<field.Label>label</field.Label>
<field.Hint><span data-test-hint>hint</span></field.Hint>
<field.Control>
<input type="text" data-test-input />
</field.Control>
</Field>
<div data-test-field>
<Field as |field|>
<field.Label>label</field.Label>
<field.Hint><span data-test-hint>hint</span></field.Hint>
<field.Control>
<input type="text" data-test-input />
</field.Control>
</Field>
</div>
</template>);

const label = 'label';
const hint = '[data-test-hint]';
const error = '[data-test-error]';
const control = '[data-test-input]';

const children = findAll('[data-test-field] > div');
assert.dom(label).exists('Expected to have label block rendered');
assert.dom(label).hasText('label', 'Expected to have label text "label"');

Expand All @@ -130,6 +132,7 @@ module('Integration | Component | Field', function (hooks) {
assert
.dom('svg')
.doesNotExist('Error block does not exist (no error icon shown)');

assert
.dom(error)
.hasText('error', 'Expected to have error text rendered');
Expand Down

0 comments on commit 91b50c0

Please sign in to comment.