- {{#each
- (sort-by (or this.sortBy "") @model)
- as |product|
- }}
-
- {{else}}
-
- {{t "routes.products.no-products-found"}}
-
- {{/each}}
+ List of products goes here.
-
diff --git a/tests/fixtures/engine/typescript/input/addon/routes.ts b/tests/fixtures/engine/typescript/input/addon/routes.ts
new file mode 100644
index 0000000..7f0bcdb
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/addon/routes.ts
@@ -0,0 +1,7 @@
+import buildRoutes from 'ember-engines/routes';
+
+export default buildRoutes(function () {
+ this.route('products', function () {
+ this.route('product' , { path: '/:id' });
+ });
+});
diff --git a/tests/fixtures/engine/typescript/input/addon/components/product/card/component.d.ts b/tests/fixtures/engine/typescript/input/addon/styles/.placeholder
similarity index 100%
rename from tests/fixtures/engine/typescript/input/addon/components/product/card/component.d.ts
rename to tests/fixtures/engine/typescript/input/addon/styles/.placeholder
diff --git a/tests/fixtures/engine/typescript/input/addon/template-registry.ts b/tests/fixtures/engine/typescript/input/addon/template-registry.ts
new file mode 100644
index 0000000..14570ca
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/addon/template-registry.ts
@@ -0,0 +1,9 @@
+import type NavigationMenuComponent from './components/navigation-menu/component';
+import type UiPageComponent from './components/ui/page/component';
+
+export default interface MyV1AddonRegistry {
+ NavigationMenu: typeof NavigationMenuComponent;
+ 'Ui::Page': typeof UiPageComponent;
+ 'navigation-menu': typeof NavigationMenuComponent;
+ 'ui/page': typeof UiPageComponent;
+}
diff --git a/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts b/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts
new file mode 100644
index 0000000..41a2270
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts
@@ -0,0 +1,14 @@
+/*
+ https://docs.ember-cli-typescript.com/cookbook/working-with-route-models
+*/
+import type Route from '@ember/routing/route';
+
+/**
+ Get the resolved type of an item.
+ - If the item is a promise, the result will be the resolved value type
+ - If the item is not a promise, the result will just be the type of the item
+ */
+type Resolved
= P extends Promise ? T : P;
+
+/** Get the resolved model value from a route. */
+export type ModelFrom = Resolved>;
diff --git a/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts b/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts
new file mode 100644
index 0000000..e7240b3
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts
@@ -0,0 +1,11 @@
+export type Product = {
+ categoryId: string;
+ description: string;
+ id: string;
+ imageUrl: string;
+ name: string;
+ price: number;
+ rating: number;
+ seller: string;
+ shortDescription: string;
+};
diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts
new file mode 100644
index 0000000..df6b0a4
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts
@@ -0,0 +1,20 @@
+import { render, setupRenderingTest } from 'dummy/tests/helpers';
+import { hbs } from 'ember-cli-htmlbars';
+import { module, test } from 'qunit';
+
+module('Integration | Component | navigation-menu', function (hooks) {
+ setupRenderingTest(hooks);
+
+ test('it renders', async function (assert) {
+ await render(hbs`
+
+ `);
+
+ assert.ok(true);
+ });
+});
diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts
deleted file mode 100644
index 8f0ddaa..0000000
--- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { render } from '@ember/test-helpers';
-import { a11yAudit } from 'ember-a11y-testing/test-support';
-import { hbs } from 'ember-cli-htmlbars';
-import { setupIntl } from 'ember-intl/test-support';
-import { setupRenderingTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Integration | Component | products/product/card', function (hooks) {
- setupRenderingTest(hooks);
- setupIntl(hooks);
-
- hooks.beforeEach(function () {
- this.product = {
- description: 'Made with organic herbs',
- id: '1',
- name: 'Vanilla Ice Cream Cake',
- price: 40,
- rating: 4.5,
- seller: "Amy's",
- shortDescription: 'Made with organic herbs',
- };
- });
-
- test('The component renders when @product is undefined', async function (assert) {
- await render(hbs`
-
- `);
-
- assert.ok(true);
- });
-
- test('The component renders a product', async function (assert) {
- await render(hbs`
-
- `);
-
- assert
- .dom('[data-test-field="Name"]')
- .hasText('Vanilla Ice Cream Cake', 'We see the product name.');
-
- assert
- .dom('[data-test-field="Short Description"]')
- .hasText(
- 'Made with organic herbs',
- 'We see the product short description.'
- );
-
- assert
- .dom('[data-test-field="Price"]')
- .hasText('$40', 'We see the product price.');
-
- assert
- .dom('[data-test-link="Learn More"]')
- .hasAria(
- 'label',
- 'Learn more about Vanilla Ice Cream Cake',
- 'We see the correct aria-label.'
- )
- .hasTagName('a', 'We see the correct tag name.')
- .hasText('Learn more', 'We see the learn more link.');
-
- await a11yAudit();
-
- assert.ok(true, 'We passed the accessibility audit.');
- });
-});
diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts
deleted file mode 100644
index dcb4ad5..0000000
--- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { click, render } from '@ember/test-helpers';
-import { a11yAudit } from 'ember-a11y-testing/test-support';
-import { hbs } from 'ember-cli-htmlbars';
-import { setupIntl } from 'ember-intl/test-support';
-import { setupRenderingTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-import sinon from 'sinon';
-
-module('Integration | Component | products/product/details', function (hooks) {
- setupRenderingTest(hooks);
- setupIntl(hooks);
-
- hooks.beforeEach(function () {
- this.product = {
- description: 'Made with organic herbs',
- id: '1',
- name: 'Vanilla Ice Cream Cake',
- price: 40,
- rating: 4.5,
- seller: "Amy's",
- shortDescription: 'Made with organic herbs',
- };
- });
-
- test('The component renders when @product is undefined', async function (assert) {
- await render(hbs`
-
- `);
-
- assert.ok(true);
- });
-
- test('The component renders a product', async function (assert) {
- await render(hbs`
-
- `);
-
- assert
- .dom('[data-test-field="Name"]')
- .hasText('Vanilla Ice Cream Cake', 'We see the product name.');
-
- assert
- .dom('[data-test-field="Description"]')
- .hasText('Made with organic herbs', 'We see the product description.');
-
- assert
- .dom('[data-test-field="Price"]')
- .hasText('$40', 'We see the product price.');
-
- assert
- .dom('[data-test-field="Rating"]')
- .hasText('4.5 out of 5 stars', 'We see the product rating.');
-
- assert
- .dom('[data-test-field="Seller"]')
- .hasText("Amy's", 'We see the product seller.');
-
- assert
- .dom('[data-test-button="Add to Cart"]')
- .hasAttribute('type', 'button', 'We see the correct type.')
- .hasTagName('button', 'We see the correct tag name.')
- .hasText('Add to Cart', 'We see the add to cart button.');
-
- await a11yAudit();
-
- assert.ok(true, 'We passed the accessibility audit.');
- });
-
- test('We can click on the add to cart button', async function (assert) {
- const stubbedLog = sinon.stub(console, 'log');
-
- await render(hbs`
-
- `);
-
- await click('[data-test-button="Add to Cart"]');
-
- assert.true(
- stubbedLog.calledOnceWith(
- 'Vanilla Ice Cream Cake has been added to the cart.'
- ),
- 'We logged a message to the user.'
- );
- });
-});
diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts
deleted file mode 100644
index a853981..0000000
--- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { render } from '@ember/test-helpers';
-import { hbs } from 'ember-cli-htmlbars';
-import { setupRenderingTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Integration | Component | products/product/image', function (hooks) {
- setupRenderingTest(hooks);
-
- test('The component renders a placeholder in test environment', async function (assert) {
- await render(hbs`
-
- `);
-
- assert.dom('img').doesNotExist('We should not make a network request.');
- });
-});
diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts
new file mode 100644
index 0000000..4145b79
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts
@@ -0,0 +1,19 @@
+import { render, setupRenderingTest } from 'dummy/tests/helpers';
+import { hbs } from 'ember-cli-htmlbars';
+import { module, test } from 'qunit';
+
+module('Integration | Component | ui/page', function (hooks) {
+ setupRenderingTest(hooks);
+
+ test('it renders', async function (assert) {
+ await render(hbs`
+
+
+ Content goes here.
+
+
+ `);
+
+ assert.ok(true);
+ });
+});
diff --git a/tests/fixtures/app/javascript/input/tests/unit/routes/application/route-test.js b/tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts
similarity index 63%
rename from tests/fixtures/app/javascript/input/tests/unit/routes/application/route-test.js
rename to tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts
index d7720ea..038b79d 100644
--- a/tests/fixtures/app/javascript/input/tests/unit/routes/application/route-test.js
+++ b/tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts
@@ -1,11 +1,11 @@
-import { setupTest } from 'ember-qunit';
+import { setupTest } from 'dummy/tests/helpers';
import { module, test } from 'qunit';
module('Unit | Route | application', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
- let route = this.owner.lookup('route:application');
+ const route = this.engine.lookup('route:application');
assert.ok(route);
});
});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts
deleted file mode 100644
index 80722a4..0000000
--- a/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-import { setupTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Unit | Controller | products', function (hooks) {
- setupTest(hooks);
-
- hooks.beforeEach(function () {
- this.controller = this.owner.lookup('controller:products');
- });
-
- module('resetQueryParameters', function (nestedHooks) {
- nestedHooks.beforeEach(function () {
- this.controller.name = 'fresh';
- this.controller.sortBy = 'price:asc';
- });
-
- test('resets all query parameters', function (assert) {
- this.controller.resetQueryParameters();
-
- assert.strictEqual(
- this.controller.name,
- null,
- 'We update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- null,
- 'We update the sortBy query parameter.'
- );
- });
- });
-
- module('updateQueryParameters', function () {
- test('updates a query parameter', async function (assert) {
- await this.controller.updateQueryParameters.perform({
- key: 'name',
- value: 'fresh',
- });
-
- assert.strictEqual(
- this.controller.name,
- 'fresh',
- 'We update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- undefined,
- 'We should not update the sortBy query parameter.'
- );
-
- await this.controller.updateQueryParameters.perform({
- key: 'sortBy',
- value: 'price:asc',
- });
-
- assert.strictEqual(
- this.controller.name,
- 'fresh',
- 'We should not update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- 'price:asc',
- 'We update the sortBy query parameter.'
- );
- });
-
- test('casts undefined and empty string to null', async function (assert) {
- await this.controller.updateQueryParameters.perform({
- key: 'name',
- value: '',
- });
-
- assert.strictEqual(
- this.controller.name,
- null,
- 'We update the name query parameter.'
- );
-
- await this.controller.updateQueryParameters.perform({
- key: 'sortBy',
- value: undefined,
- });
-
- assert.strictEqual(
- this.controller.sortBy,
- null,
- 'We update the sortBy query parameter.'
- );
- });
- });
-});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts
new file mode 100644
index 0000000..df22145
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts
@@ -0,0 +1,12 @@
+import { setupTest } from 'dummy/tests/helpers';
+import { module, test } from 'qunit';
+
+module('Unit | Service | experiments', function (hooks) {
+ setupTest(hooks);
+
+ // TODO: Replace this with your real tests.
+ test('it exists', function (assert) {
+ const service = this.engine.lookup('service:experiments');
+ assert.ok(service);
+ });
+});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts
deleted file mode 100644
index 084e909..0000000
--- a/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { setupTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Unit | Route | product-details', function (hooks) {
- setupTest(hooks);
-
- test('it exists', function (assert) {
- let route = this.owner.lookup('route:product-details');
- assert.ok(route);
- });
-});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts
index 80722a4..b0c6e5e 100644
--- a/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts
+++ b/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts
@@ -1,95 +1,12 @@
-import { setupTest } from 'ember-qunit';
+import { setupTest } from 'dummy/tests/helpers';
import { module, test } from 'qunit';
module('Unit | Controller | products', function (hooks) {
setupTest(hooks);
- hooks.beforeEach(function () {
- this.controller = this.owner.lookup('controller:products');
- });
-
- module('resetQueryParameters', function (nestedHooks) {
- nestedHooks.beforeEach(function () {
- this.controller.name = 'fresh';
- this.controller.sortBy = 'price:asc';
- });
-
- test('resets all query parameters', function (assert) {
- this.controller.resetQueryParameters();
-
- assert.strictEqual(
- this.controller.name,
- null,
- 'We update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- null,
- 'We update the sortBy query parameter.'
- );
- });
- });
-
- module('updateQueryParameters', function () {
- test('updates a query parameter', async function (assert) {
- await this.controller.updateQueryParameters.perform({
- key: 'name',
- value: 'fresh',
- });
-
- assert.strictEqual(
- this.controller.name,
- 'fresh',
- 'We update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- undefined,
- 'We should not update the sortBy query parameter.'
- );
-
- await this.controller.updateQueryParameters.perform({
- key: 'sortBy',
- value: 'price:asc',
- });
-
- assert.strictEqual(
- this.controller.name,
- 'fresh',
- 'We should not update the name query parameter.'
- );
-
- assert.strictEqual(
- this.controller.sortBy,
- 'price:asc',
- 'We update the sortBy query parameter.'
- );
- });
-
- test('casts undefined and empty string to null', async function (assert) {
- await this.controller.updateQueryParameters.perform({
- key: 'name',
- value: '',
- });
-
- assert.strictEqual(
- this.controller.name,
- null,
- 'We update the name query parameter.'
- );
-
- await this.controller.updateQueryParameters.perform({
- key: 'sortBy',
- value: undefined,
- });
-
- assert.strictEqual(
- this.controller.sortBy,
- null,
- 'We update the sortBy query parameter.'
- );
- });
+ // TODO: Replace this with your real tests.
+ test('it exists', function (assert) {
+ const controller = this.engine.lookup('controller:products');
+ assert.ok(controller);
});
});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts
new file mode 100644
index 0000000..1ac4216
--- /dev/null
+++ b/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts
@@ -0,0 +1,12 @@
+import { setupTest } from 'dummy/tests/helpers';
+import { module, test } from 'qunit';
+
+module('Unit | Controller | products/product', function (hooks) {
+ setupTest(hooks);
+
+ // TODO: Replace this with your real tests.
+ test('it exists', function (assert) {
+ const controller = this.engine.lookup('controller:products/product');
+ assert.ok(controller);
+ });
+});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts
index 7dd63ec..463b4f3 100644
--- a/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts
+++ b/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts
@@ -1,11 +1,11 @@
-import { setupTest } from 'ember-qunit';
+import { setupTest } from 'dummy/tests/helpers';
import { module, test } from 'qunit';
module('Unit | Route | products/product', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
- let route = this.owner.lookup('route:products/product');
+ const route = this.engine.lookup('route:products/product');
assert.ok(route);
});
});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts
index 50693f5..b9e921d 100644
--- a/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts
+++ b/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts
@@ -1,11 +1,11 @@
-import { setupTest } from 'ember-qunit';
+import { setupTest } from 'dummy/tests/helpers';
import { module, test } from 'qunit';
module('Unit | Route | products', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
- let route = this.owner.lookup('route:products');
+ const route = this.engine.lookup('route:products');
assert.ok(route);
});
});
diff --git a/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts
deleted file mode 100644
index 084e909..0000000
--- a/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { setupTest } from 'ember-qunit';
-import { module, test } from 'qunit';
-
-module('Unit | Route | product-details', function (hooks) {
- setupTest(hooks);
-
- test('it exists', function (assert) {
- let route = this.owner.lookup('route:product-details');
- assert.ok(route);
- });
-});
diff --git a/tests/fixtures/app/javascript/output/app/components/navigation-menu.css b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css
similarity index 85%
rename from tests/fixtures/app/javascript/output/app/components/navigation-menu.css
rename to tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css
index 9bee6e9..7fdf679 100644
--- a/tests/fixtures/app/javascript/output/app/components/navigation-menu.css
+++ b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css
@@ -1,4 +1,3 @@
-/* stylelint-disable selector-pseudo-class-no-unknown */
.list {
align-items: center;
display: flex;
diff --git a/tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs
similarity index 91%
rename from tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs
rename to tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs
index 061bf4c..1b36915 100644
--- a/tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs
+++ b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs
@@ -1,7 +1,7 @@