-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add typescript component building / testing tests
- Loading branch information
1 parent
85981bd
commit 40a5d11
Showing
8 changed files
with
99 additions
and
34 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
tests/fixtures/typescript/my-addon/src/components/co-located-ts.hbs
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,3 @@ | ||
Hello, | ||
{{this.whereAmI}} | ||
(in TypeScript) |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/typescript/my-addon/src/components/co-located-ts.ts
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,5 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class CoLocatedTs extends Component { | ||
whereAmI = 'from a co-located TS component'; | ||
} |
1 change: 1 addition & 0 deletions
1
tests/fixtures/typescript/my-addon/src/components/co-located.hbs
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 @@ | ||
Hello, {{this.whereAmI}} |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/typescript/my-addon/src/components/co-located.js
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,5 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
export default class CoLocated extends Component { | ||
whereAmI = 'from a co-located component'; | ||
} |
1 change: 1 addition & 0 deletions
1
tests/fixtures/typescript/my-addon/src/components/template-only.hbs
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 @@ | ||
Hello from a template-only component |
20 changes: 20 additions & 0 deletions
20
tests/fixtures/typescript/test-app/tests/rendering/co-located-test.ts
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 { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
module('Rendering | co-located', function (hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders a JS component', async function (assert) { | ||
await render(hbs`<CoLocated />`); | ||
|
||
assert.dom().hasText('Hello, from a co-located component'); | ||
}); | ||
|
||
test('it renders a TS component', async function (assert) { | ||
await render(hbs`<CoLocatedTs />`); | ||
|
||
assert.dom().containsText('Hello, from a co-located TS component (in TypeScript)'); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
tests/fixtures/typescript/test-app/tests/rendering/template-only-test.ts
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,14 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
module('Rendering | template-only', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
await render(hbs`<TemplateOnly />`); | ||
|
||
assert.dom().hasText('Hello from a template-only component'); | ||
}) | ||
}); |
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