-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #471 from appuniversum/chore/more-gts
More Glint / TS conversion
- Loading branch information
Showing
10 changed files
with
183 additions
and
55 deletions.
There are no files selected for viewing
12 changes: 11 additions & 1 deletion
12
addon/components/au-form-row.gjs → addon/components/au-form-row.gts
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
15 changes: 14 additions & 1 deletion
15
addon/components/au-help-text.gjs → addon/components/au-help-text.gts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import AuFormRow from '@appuniversum/ember-appuniversum/components/au-form-row'; | ||
|
||
module('Integration | Component | au-form-row', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it accepts block content', async function (assert) { | ||
await render( | ||
<template> | ||
<AuFormRow data-test-form-row>Form row</AuFormRow> | ||
</template>, | ||
); | ||
|
||
assert.dom('[data-test-form-row]').hasText('Form row'); | ||
}); | ||
}); |
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,82 @@ | ||
import AuHeading, { | ||
type AuHeadingSignature, | ||
} from '@appuniversum/ember-appuniversum/components/au-heading'; | ||
import { settled } from '@ember/test-helpers'; | ||
import { render } from '@ember/test-helpers'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Integration | Component | au-heading', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it accepts block content and extra attributes', async function (assert) { | ||
await render( | ||
<template> | ||
<AuHeading data-test-heading> | ||
Some title | ||
</AuHeading> | ||
</template>, | ||
); | ||
|
||
assert.dom('[data-test-heading]').hasText('Some title'); | ||
}); | ||
|
||
test('it defaults to a h1 element', async function (assert) { | ||
await render( | ||
<template> | ||
<AuHeading> | ||
Some title | ||
</AuHeading> | ||
</template>, | ||
); | ||
|
||
assert.dom('h1').exists('it defaults to h1'); | ||
}); | ||
|
||
test('it has a `@level` argument that can be used to set the h* element', async function (assert) { | ||
class TestState { | ||
@tracked level?: AuHeadingSignature['Args']['level']; | ||
} | ||
|
||
const state = new TestState(); | ||
state.level = '1'; | ||
|
||
await render( | ||
<template> | ||
<AuHeading @level={{state.level}}> | ||
Some title | ||
</AuHeading> | ||
</template>, | ||
); | ||
|
||
assert.dom('h1').exists(); | ||
|
||
state.level = '2'; | ||
await settled(); | ||
assert.dom('h2').exists(); | ||
|
||
state.level = '3'; | ||
await settled(); | ||
assert.dom('h3').exists(); | ||
|
||
state.level = '4'; | ||
await settled(); | ||
assert.dom('h4').exists(); | ||
|
||
state.level = '5'; | ||
await settled(); | ||
assert.dom('h5').exists(); | ||
|
||
state.level = '6'; | ||
await settled(); | ||
assert.dom('h6').exists(); | ||
|
||
// @ts-expect-error: invalid level values are possible in projects that don't use Glint | ||
state.level = 'invalid level'; | ||
await settled(); | ||
assert | ||
.dom('h1') | ||
.exists('it falls back to h1 if the level value is invalid'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
import AuHelpText from '@appuniversum/ember-appuniversum/components/au-help-text'; | ||
import { render } from '@ember/test-helpers'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Integration | Component | au-help-text', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it accepts block content and extra attributes', async function (assert) { | ||
await render( | ||
<template> | ||
<AuHelpText data-test-help-text> | ||
Some help text | ||
</AuHelpText> | ||
</template>, | ||
); | ||
|
||
assert.dom('[data-test-help-text]').hasText('Some help text'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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