Skip to content

Commit 0a9275f

Browse files
committed
Add tests for using template tag within render in a test
1 parent 55634cd commit 0a9275f

5 files changed

Lines changed: 78 additions & 0 deletions

File tree

tests/cases/gts/rendering-test.gts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { module, test } from 'qunit';
2+
import { render } from '@ember/test-helpers';
3+
import { setupRenderingTest } from 'ember-qunit';
4+
5+
module('Render with template tag', function (hooks) {
6+
setupRenderingTest(hooks);
7+
8+
test('it has a template tag', async function (assert) {
9+
await render(<template>
10+
what
11+
</template>);
12+
assert.dom().hasText('what');
13+
});
14+
});

tests/unit-tests/__snapshots__/format.test.ts.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,22 @@ export interface Signature {
726726
"
727727
`;
728728
729+
exports[`format > config > default > it formats ../cases/gts/rendering-test.gts 1`] = `
730+
"import { module, test } from \\"qunit\\";
731+
import { render } from \\"@ember/test-helpers\\";
732+
import { setupRenderingTest } from \\"ember-qunit\\";
733+
734+
module(\\"Render with template tag\\", function (hooks) {
735+
setupRenderingTest(hooks);
736+
737+
test(\\"it has a template tag\\", async function (assert) {
738+
await render(<template>what</template>);
739+
assert.dom().hasText(\\"what\\");
740+
});
741+
});
742+
"
743+
`;
744+
729745
exports[`format > config > default > it formats ../cases/gts/simple.gts 1`] = `
730746
"import type { TemplateOnlyComponent } from \\"@ember/component/template-only\\";
731747

tests/unit-tests/__snapshots__/preprocessed.test.ts.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,22 @@ export interface Signature {
799799
"
800800
`;
801801
802+
exports[`format > config > with preprocessed code > it formats ../cases/gts/rendering-test.gts 1`] = `
803+
"import { module, test } from \\"qunit\\";
804+
import { render } from \\"@ember/test-helpers\\";
805+
import { setupRenderingTest } from \\"ember-qunit\\";
806+
807+
module(\\"Render with template tag\\", function (hooks) {
808+
setupRenderingTest(hooks);
809+
810+
test(\\"it has a template tag\\", async function (assert) {
811+
await render([__GLIMMER_TEMPLATE(\`what\`, { strictMode: true })]);
812+
assert.dom().hasText(\\"what\\");
813+
});
814+
});
815+
"
816+
`;
817+
802818
exports[`format > config > with preprocessed code > it formats ../cases/gts/simple.gts 1`] = `
803819
"import type { TemplateOnlyComponent } from \\"@ember/component/template-only\\";
804820

tests/unit-tests/config/__snapshots__/semi-false.test.ts.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,22 @@ export interface Signature {
726726
"
727727
`;
728728
729+
exports[`config > semi: false > it formats ../cases/gts/rendering-test.gts 1`] = `
730+
"import { module, test } from \\"qunit\\"
731+
import { render } from \\"@ember/test-helpers\\"
732+
import { setupRenderingTest } from \\"ember-qunit\\"
733+
734+
module(\\"Render with template tag\\", function (hooks) {
735+
setupRenderingTest(hooks)
736+
737+
test(\\"it has a template tag\\", async function (assert) {
738+
await render(<template>what</template>)
739+
assert.dom().hasText(\\"what\\")
740+
})
741+
})
742+
"
743+
`;
744+
729745
exports[`config > semi: false > it formats ../cases/gts/simple.gts 1`] = `
730746
"import type { TemplateOnlyComponent } from \\"@ember/component/template-only\\"
731747

tests/unit-tests/config/__snapshots__/template-export-default.test.ts.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,22 @@ export interface Signature {
726726
"
727727
`;
728728
729+
exports[`config > templateExportDefault: true > it formats ../cases/gts/rendering-test.gts 1`] = `
730+
"import { module, test } from \\"qunit\\";
731+
import { render } from \\"@ember/test-helpers\\";
732+
import { setupRenderingTest } from \\"ember-qunit\\";
733+
734+
module(\\"Render with template tag\\", function (hooks) {
735+
setupRenderingTest(hooks);
736+
737+
test(\\"it has a template tag\\", async function (assert) {
738+
await render(<template>what</template>);
739+
assert.dom().hasText(\\"what\\");
740+
});
741+
});
742+
"
743+
`;
744+
729745
exports[`config > templateExportDefault: true > it formats ../cases/gts/simple.gts 1`] = `
730746
"import type { TemplateOnlyComponent } from \\"@ember/component/template-only\\";
731747

0 commit comments

Comments
 (0)