-
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.
Merge pull request #190 from lukemelia/gts-error
Update config templates to properly handle .gts files
- Loading branch information
Showing
8 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
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
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
14 changes: 14 additions & 0 deletions
14
tests/fixtures/typescript/my-addon/src/components/another-gts.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Component from '@glimmer/component'; | ||
|
||
interface Signature { | ||
Element: HTMLDivElement; | ||
} | ||
|
||
export default class AnotherGts extends Component<Signature> { | ||
greeting = "Hello"; | ||
<template> | ||
<div ...attributes> | ||
{{this.greeting}} from another GTS file! | ||
</div> | ||
</template> | ||
} |
28 changes: 28 additions & 0 deletions
28
tests/fixtures/typescript/my-addon/src/components/template-import.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Component from '@glimmer/component'; | ||
import TemplateOnly from './template-only'; | ||
import AnotherGts from './another-gts.gts'; // N.B. relative imports inside a v2 addon should have explicit file extensions (this is consistent with how node treats ES modules) | ||
import { on } from '@ember/modifier'; | ||
import { action } from '@ember/object'; | ||
import { fn } from '@ember/helper'; | ||
|
||
interface Signature { | ||
Element: HTMLDivElement; | ||
Args: { | ||
saying?: string; | ||
}; | ||
} | ||
|
||
export default class TemplateImport extends Component<Signature> { | ||
<template> | ||
<div ...attributes> | ||
Hello from a GTS file but also <TemplateOnly /> and <AnotherGts /> | ||
|
||
<button {{on "click" (fn this.saySomething @saying)}}></button> | ||
</div> | ||
</template> | ||
|
||
@action | ||
saySomething(sayWhat: string | undefined) { | ||
console.log(sayWhat || "something"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/fixtures/typescript/test-app/tests/rendering/template-import-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-import', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
await render(hbs`<TemplateImport @saying="what" />`); | ||
|
||
assert.dom().hasText('Hello from a GTS file but also Hello from a template-only component and Hello from another GTS file!'); | ||
}) | ||
}); |
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