diff --git a/tests/fixtures/app/javascript/index.ts b/tests/fixtures/app/javascript/index.ts deleted file mode 100644 index 29de5e9..0000000 --- a/tests/fixtures/app/javascript/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('app/javascript/input'); -const outputProject = convertFixtureToJson('app/javascript/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/app/javascript/input/app/application/adapter.js b/tests/fixtures/app/javascript/input/app/application/adapter.js deleted file mode 100644 index 09a6c6c..0000000 --- a/tests/fixtures/app/javascript/input/app/application/adapter.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPIAdapter from '@ember-data/adapter/json-api'; - -export default class ApplicationAdapter extends JSONAPIAdapter {} diff --git a/tests/fixtures/app/javascript/input/app/application/route.js b/tests/fixtures/app/javascript/input/app/application/route.js deleted file mode 100644 index 0a89bde..0000000 --- a/tests/fixtures/app/javascript/input/app/application/route.js +++ /dev/null @@ -1,10 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ApplicationRoute extends Route { - @service intl; - - beforeModel() { - this.intl.setLocale(['en-us']); - } -} diff --git a/tests/fixtures/app/javascript/input/app/application/serializer.js b/tests/fixtures/app/javascript/input/app/application/serializer.js deleted file mode 100644 index 2341d47..0000000 --- a/tests/fixtures/app/javascript/input/app/application/serializer.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPISerializer from '@ember-data/serializer/json-api'; - -export default class ApplicationSerializer extends JSONAPISerializer {} diff --git a/tests/fixtures/app/javascript/input/app/application/styles.css b/tests/fixtures/app/javascript/input/app/application/styles.css deleted file mode 100644 index 16fae37..0000000 --- a/tests/fixtures/app/javascript/input/app/application/styles.css +++ /dev/null @@ -1,55 +0,0 @@ -.application { - display: grid; - grid-template-areas: - ". header ." - "main main main" - ". footer ."; - grid-template-columns: 1fr minmax(auto, 75rem) 1fr; - grid-template-rows: auto 1fr auto; - height: 100%; - overflow: hidden; - width: 100vw; -} - -.header { - grid-area: header; - min-height: 2.75rem; - overflow-x: auto; -} - -.main { - background-color: rgb(255 255 255 / 4.5%); - border-bottom: 0.0625rem solid rgb(211 211 211 / 15%); - border-top: 0.0625rem solid rgb(211 211 211 / 15%); - display: flex; - flex: 1; - grid-area: main; - justify-content: center; - overflow-y: hidden; -} - -.center { - display: flex; - flex-direction: column; - max-width: 75rem; - overflow-y: auto; - width: 100%; -} - -.footer { - align-items: center; - display: flex; - grid-area: footer; - justify-content: center; - min-height: 2.375rem; -} - -.copyright { - color: rgb(128 191 255 / 90%); - font-size: 0.75rem; - padding: 0.75rem 0; -} - -.copyright a { - color: rgb(128 191 255 / 90%); -} diff --git a/tests/fixtures/app/javascript/input/app/application/template.hbs b/tests/fixtures/app/javascript/input/app/application/template.hbs deleted file mode 100644 index 57bb661..0000000 --- a/tests/fixtures/app/javascript/input/app/application/template.hbs +++ /dev/null @@ -1,47 +0,0 @@ -{{page-title (t "routes.application.app-name")}} - -
-
- - - -
- -
-
- {{outlet}} -
-
- - -
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/product/card/styles.css b/tests/fixtures/app/javascript/input/app/components/product/card/styles.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/card/styles.css +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/app/javascript/input/app/components/product/card/template.hbs b/tests/fixtures/app/javascript/input/app/components/product/card/template.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/card/template.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/product/details/component.js b/tests/fixtures/app/javascript/input/app/components/product/details/component.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/details/component.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/product/details/styles.css b/tests/fixtures/app/javascript/input/app/components/product/details/styles.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/details/styles.css +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/app/javascript/input/app/components/product/details/template.hbs b/tests/fixtures/app/javascript/input/app/components/product/details/template.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/details/template.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/product/image/component.js b/tests/fixtures/app/javascript/input/app/components/product/image/component.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/image/component.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/app/javascript/input/app/components/product/image/styles.css b/tests/fixtures/app/javascript/input/app/components/product/image/styles.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/image/styles.css +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/app/javascript/input/app/components/product/image/template.hbs b/tests/fixtures/app/javascript/input/app/components/product/image/template.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/app/javascript/input/app/components/product/image/template.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/component.js deleted file mode 100644 index 9cfbe2c..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/component.js +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormCheckboxComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.isChecked, - valueType: 'boolean', - }); - } - - get isChecked() { - const { changeset, key } = this.args; - - return get(changeset, key) ?? undefined; - } - - @action updateValue() { - const { isDisabled, isReadOnly, key, onUpdate } = this.args; - - if (isDisabled || isReadOnly) { - return; - } - - const value = !this.isChecked; - - onUpdate({ key, value }); - } - - @action updateValueByPressingSpace(event) { - if (event.code === 'Space' || event.key === 'Space') { - this.updateValue(); - } - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/styles.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/styles.css +++ /dev/null @@ -1,37 +0,0 @@ -.checkbox { - align-items: center; - background-color: white; - border: 0.125rem solid #ffd54f; - cursor: pointer; - display: flex; - height: 1rem; - justify-content: center; - position: relative; - width: 1rem; -} - -.checkbox:focus { - background-color: #ffecb3; - outline: 0; -} - -.checkbox:not(:focus) { - border-color: transparent; -} - -.checkbox.is-checked { - background-color: #1976d2; -} - -.checkbox.is-disabled { - background-color: #b2c9d4; - cursor: not-allowed; -} - -.checkmark-icon { - color: white; -} - -.checkbox.is-disabled .checkmark-icon { - color: #546e7a; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/template.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/template.hbs +++ /dev/null @@ -1,40 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - {{#if this.isChecked}} - - {{/if}} - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/component.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/component.js +++ /dev/null @@ -1,17 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; -import { TrackedObject } from 'tracked-built-ins'; - -export default class UiFormComponent extends Component { - changeset = new TrackedObject(this.args.data ?? {}); - - @action submitForm(event) { - event.preventDefault(); - - this.args.onSubmit(this.changeset); - } - - @action updateChangeset({ key, value }) { - this.changeset[key] = value; - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/field/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/field/styles.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/field/styles.css +++ /dev/null @@ -1,83 +0,0 @@ -.container { - align-items: start; - display: grid; -} - -.container:not(.is-wide, .no-feedback) { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field" - "feedback"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr auto; -} - -.container:not(.is-wide).no-feedback { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; -} - -.container.is-wide:not(.no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "label field" - "label feedback"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-wide.no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: "label field"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr; -} - -.label { - grid-area: label; - overflow: hidden; - word-break: break-word; -} - -.field { - grid-area: field; -} - -.feedback { - align-items: center; - display: flex; - font-size: 0.875rem; - grid-area: feedback; -} - -.feedback.is-error { - color: #ff5252; -} - -/* Exceptions for mobile */ -.container.is-inline:not(.is-wide, .no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "field label" - "feedback feedback"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-inline:not(.is-wide).no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0; - grid-template-areas: "field label"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/field/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/field/template.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/field/template.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{#let (unique-id) as |inputId|}} -
-
- {{yield (hash inputId=inputId) to="label"}} -
- -
- {{yield (hash inputId=inputId) to="field"}} -
- - {{#if @errorMessage}} -
- {{@errorMessage}} -
- {{/if}} -
-{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/information/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/information/styles.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/information/styles.css +++ /dev/null @@ -1,16 +0,0 @@ -.container { - margin-bottom: 1rem; -} - -.title { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -.instructions { - font-size: 0.9rem; - font-weight: 300; - line-height: 1.25rem; - margin-bottom: 0.5rem; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/information/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/information/template.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/information/template.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{#if (or @title @instructions)}} -
- {{#if @title}} -
- {{@title}} -
- {{/if}} - - {{#if @instructions}} -

- {{@instructions}} -

- {{/if}} -
-{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/input/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/input/component.js deleted file mode 100644 index 7fd3558..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/input/component.js +++ /dev/null @@ -1,42 +0,0 @@ -import { assert } from '@ember/debug'; -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormInputComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get type() { - const { type } = this.args; - - assert( - 'To render a number input, please use instead.', - type !== 'number' - ); - - return this.args.type ?? 'text'; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/input/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/input/styles.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/input/styles.css +++ /dev/null @@ -1,24 +0,0 @@ -.input { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.input:focus { - background-color: #ffecb3; - outline: 0; -} - -.input:not(:focus) { - border-color: transparent; -} - -.input::placeholder { - font-style: italic; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/input/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/input/template.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/input/template.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/number/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/number/component.js deleted file mode 100644 index 69b12c0..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/number/component.js +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormNumberComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'number', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - const valueAsNumber = Number.parseFloat(value); - - if (Number.isNaN(valueAsNumber)) { - onUpdate({ key, value: undefined }); - return; - } - - onUpdate({ key, value: valueAsNumber }); - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/number/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/number/styles.css deleted file mode 100644 index f24ae8e..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/number/styles.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-app/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/number/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/number/template.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/number/template.hbs +++ /dev/null @@ -1,34 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/select/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/select/component.js deleted file mode 100644 index efc8007..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/select/component.js +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormSelectComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get options() { - return this.args.options ?? []; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action resetValue() { - const { key, onUpdate } = this.args; - - onUpdate({ key, value: undefined }); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/select/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/select/styles.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/select/styles.css +++ /dev/null @@ -1,33 +0,0 @@ -.select-container { - display: grid; - grid-column-gap: 0.75rem; - grid-template-areas: "select clear-button"; - grid-template-columns: 1fr auto; - grid-template-rows: 1fr; -} - -.select { - border: 0.125rem solid #ffd54f; - grid-area: select; - padding: 0.125rem 0.25rem; - width: 100%; -} - -.select:focus { - background-color: #ffecb3; - outline: 0; -} - -.select:not(:focus) { - border-color: transparent; -} - -.select.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} - -.clear-button { - grid-area: clear-button; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/select/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/select/template.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/select/template.hbs +++ /dev/null @@ -1,79 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> -
- - - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/styles.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/styles.css +++ /dev/null @@ -1,19 +0,0 @@ -.form { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - padding: 1.25rem 1.5rem; -} - -.actions { - align-items: center; - display: flex; - justify-content: flex-end; - margin-top: 2rem; -} - -.submit-button { - padding: 0.5rem 3rem; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/template.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/template.hbs +++ /dev/null @@ -1,70 +0,0 @@ -{{#let (unique-id) as |formId|}} -
- - - - {{yield - (hash - Checkbox=(component - "ui/form/checkbox" - changeset=this.changeset - isInline=true - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Input=(component - "ui/form/input" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Number=(component - "ui/form/number" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Select=(component - "ui/form/select" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Textarea=(component - "ui/form/textarea" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - ) - }} - - -
- -
- -{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/component.js b/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/component.js deleted file mode 100644 index 29c258e..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/component.js +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormTextareaComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/styles.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/styles.css +++ /dev/null @@ -1,24 +0,0 @@ -.textarea { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.textarea:focus { - background-color: #ffecb3; - outline: 0; -} - -.textarea:not(:focus) { - border-color: transparent; -} - -.textarea::placeholder { - font-style: italic; -} - -.textarea.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/template.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/form/textarea/template.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/ui/page/styles.css b/tests/fixtures/app/javascript/input/app/components/ui/page/styles.css deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/page/styles.css +++ /dev/null @@ -1,20 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "body"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; - height: calc(100% - 3em); - overflow-y: auto; - padding: 1.5rem 1rem; - scrollbar-gutter: stable; -} - -.header { - grid-area: header; -} - -.body { - grid-area: body; -} diff --git a/tests/fixtures/app/javascript/input/app/components/ui/page/template.hbs b/tests/fixtures/app/javascript/input/app/components/ui/page/template.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/app/javascript/input/app/components/ui/page/template.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/config/service.js b/tests/fixtures/app/javascript/input/app/config/service.js deleted file mode 100644 index acc692f..0000000 --- a/tests/fixtures/app/javascript/input/app/config/service.js +++ /dev/null @@ -1,25 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; -import config from 'my-app/config/environment'; - -export default class ConfigService extends Service { - customization = { - experiments: { - 'nest-product-details': { - control: 0.5, - v1: 0.5, - }, - - 'subscribe-to-ember-times': { - control: 0.7, - v1: 0.3, - }, - }, - }; - - isTestEnvironment = config.environment === 'test'; - - getValue(key) { - return get(this.customization, key); - } -} diff --git a/tests/fixtures/app/javascript/input/app/experiments/service.js b/tests/fixtures/app/javascript/input/app/experiments/service.js deleted file mode 100644 index 83cdf3c..0000000 --- a/tests/fixtures/app/javascript/input/app/experiments/service.js +++ /dev/null @@ -1,82 +0,0 @@ -import { assert } from '@ember/debug'; -import Service, { service } from '@ember/service'; -import { cached } from '@glimmer/tracking'; - -export default class ExperimentsService extends Service { - @service config; - - @cached get cdfs() { - const experiments = this.config.getValue('experiments') ?? {}; - const cdfs = new Map(); - - for (const [experimentName, pdf] of Object.entries(experiments)) { - const cdf = new Map(); - let total = 0; - - for (const [variant, probability] of Object.entries(pdf)) { - total += probability; - cdf.set(variant, total); - } - - cdfs.set(experimentName, cdf); - } - - return cdfs; - } - - constructor() { - super(...arguments); - - this.#initializeVariants(); - } - - getVariant(experimentName) { - assert( - `${experimentName} is an unknown experiment. Please define the experiment in the config service.`, - this.cdfs.has(experimentName) - ); - - const cachedVariant = this.cachedVariants[experimentName]; - - if (cachedVariant) { - return cachedVariant; - } - - this.#determineVariant(experimentName); - - return this.cachedVariants[experimentName]; - } - - setVariant(experimentName, variant) { - const cdf = this.cdfs.get(experimentName); - - assert( - `${variant} is an unknown variant for ${experimentName}. Please check for typos.`, - cdf.has(variant) - ); - - this.cachedVariants[experimentName] = variant; - } - - #determineVariant(experimentName) { - const cdf = this.cdfs.get(experimentName); - const sample = Math.random(); - - for (const [variant, total] of cdf.entries()) { - if (sample < total) { - this.setVariant(experimentName, variant); - break; - } - } - } - - #initializeVariants() { - const cachedVariants = {}; - - this.cdfs.forEach((cdf, experimentName) => { - cachedVariants[experimentName] = undefined; - }); - - this.cachedVariants = cachedVariants; - } -} diff --git a/tests/fixtures/app/javascript/input/app/form/controller.js b/tests/fixtures/app/javascript/input/app/form/controller.js deleted file mode 100644 index 816335a..0000000 --- a/tests/fixtures/app/javascript/input/app/form/controller.js +++ /dev/null @@ -1,44 +0,0 @@ -import Controller from '@ember/controller'; -import { service } from '@ember/service'; -import { dropTask } from 'ember-concurrency'; -import fetch from 'fetch'; -import { generateBody } from 'my-app/utils/fetch'; - -export default class FormController extends Controller { - @service experiments; - - get initialData() { - if (this.isPartOfSubscribeToEmberTimesExperiment) { - return { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }; - } - - return { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }; - } - - get isPartOfSubscribeToEmberTimesExperiment() { - return this.experiments.getVariant('subscribe-to-ember-times') === 'v1'; - } - - submitForm = dropTask(async (data) => { - try { - const body = generateBody(data); - - await fetch('/contact-me', { - body, - method: 'POST', - }); - } catch (e) { - throw new Error(e); - } - }); -} diff --git a/tests/fixtures/app/javascript/input/app/form/route.js b/tests/fixtures/app/javascript/input/app/form/route.js deleted file mode 100644 index df63a89..0000000 --- a/tests/fixtures/app/javascript/input/app/form/route.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class FormRoute extends Route {} diff --git a/tests/fixtures/app/javascript/input/app/form/styles.css b/tests/fixtures/app/javascript/input/app/form/styles.css deleted file mode 100644 index 8ba2936..0000000 --- a/tests/fixtures/app/javascript/input/app/form/styles.css +++ /dev/null @@ -1,7 +0,0 @@ -.field { - margin-bottom: 1.25rem; -} - -.field:last-of-type { - margin-bottom: 0; -} diff --git a/tests/fixtures/app/javascript/input/app/form/template.hbs b/tests/fixtures/app/javascript/input/app/form/template.hbs deleted file mode 100644 index af78c5e..0000000 --- a/tests/fixtures/app/javascript/input/app/form/template.hbs +++ /dev/null @@ -1,76 +0,0 @@ -{{page-title (t "routes.form.title")}} - - - -
- -
- -
- -
- -
- -
- - {{#if this.isPartOfSubscribeToEmberTimesExperiment}} -
- -
- - {{else}} -
- -
- - {{/if}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/index/route.js b/tests/fixtures/app/javascript/input/app/index/route.js deleted file mode 100644 index accaec9..0000000 --- a/tests/fixtures/app/javascript/input/app/index/route.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class IndexRoute extends Route {} diff --git a/tests/fixtures/app/javascript/input/app/index/styles.css b/tests/fixtures/app/javascript/input/app/index/styles.css deleted file mode 100644 index ea2d8d7..0000000 --- a/tests/fixtures/app/javascript/input/app/index/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -.container { - padding: 1.5rem 1rem; -} diff --git a/tests/fixtures/app/javascript/input/app/index/template.hbs b/tests/fixtures/app/javascript/input/app/index/template.hbs deleted file mode 100644 index a5b7cf9..0000000 --- a/tests/fixtures/app/javascript/input/app/index/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ - -

- {{t "routes.index.description" htmlSafe=true}} -

-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/product-details/route.js b/tests/fixtures/app/javascript/input/app/product-details/route.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/app/javascript/input/app/product-details/route.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/javascript/input/app/product-details/styles.css b/tests/fixtures/app/javascript/input/app/product-details/styles.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/app/javascript/input/app/product-details/styles.css +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/app/javascript/input/app/product-details/template.hbs b/tests/fixtures/app/javascript/input/app/product-details/template.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/app/javascript/input/app/product-details/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/product/model.js b/tests/fixtures/app/javascript/input/app/product/model.js deleted file mode 100644 index 3c6dd3d..0000000 --- a/tests/fixtures/app/javascript/input/app/product/model.js +++ /dev/null @@ -1,11 +0,0 @@ -import Model, { attr } from '@ember-data/model'; - -export default class ProductModel extends Model { - @attr description; - @attr imageUrl; - @attr name; - @attr price; - @attr rating; - @attr seller; - @attr shortDescription; -} diff --git a/tests/fixtures/app/javascript/input/app/products/controller.js b/tests/fixtures/app/javascript/input/app/products/controller.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/app/javascript/input/app/products/controller.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/app/javascript/input/app/products/product/route.js b/tests/fixtures/app/javascript/input/app/products/product/route.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/app/javascript/input/app/products/product/route.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/javascript/input/app/products/product/styles.css b/tests/fixtures/app/javascript/input/app/products/product/styles.css deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/app/javascript/input/app/products/product/styles.css +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/app/javascript/input/app/products/product/template.hbs b/tests/fixtures/app/javascript/input/app/products/product/template.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/app/javascript/input/app/products/product/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/products/route.js b/tests/fixtures/app/javascript/input/app/products/route.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/app/javascript/input/app/products/route.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/app/javascript/input/app/products/styles.css b/tests/fixtures/app/javascript/input/app/products/styles.css deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/app/javascript/input/app/products/styles.css +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/app/javascript/input/app/products/template.hbs b/tests/fixtures/app/javascript/input/app/products/template.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/app/javascript/input/app/products/template.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/styles/app.css b/tests/fixtures/app/javascript/input/app/styles/app.css deleted file mode 100644 index 210d088..0000000 --- a/tests/fixtures/app/javascript/input/app/styles/app.css +++ /dev/null @@ -1,109 +0,0 @@ -html { - font-size: 16px; - height: 100%; -} - -body { - background-color: #020e1c; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-weight: 400; - height: 100%; - letter-spacing: 0.03rem; - margin: 0; -} - -* { - margin: 0; - padding: 0; -} - -h1 { - font-size: 2.25em; - font-weight: 700; - margin-bottom: 1.5rem; -} - -h2 { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -h3 { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -h4 { - font-size: 1rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -a { - color: rgb(245 255 250 / 88%); -} - -button { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - padding: 0.25rem 0.5rem; -} - -button:hover { - background-color: rgb(255 255 255 / 22.5%); - cursor: pointer; - transition: background-color 0.17s; -} - -input { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -p { - margin-bottom: 0.75rem; -} - -select { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -table { - border-collapse: collapse; - width: 100%; -} - -textarea { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -th, -td { - border: 0.0625rem solid rgb(112 128 144 / 100%); - padding: 0.25rem 0.5rem; -} - -ul { - list-style-type: none; -} - -/* stylelint-disable selector-pseudo-class-no-unknown */ -:global(#ember-testing-container) { - overflow: hidden !important; -} - -:global(#ember-testing) { - background-color: #020e1c !important; -} diff --git a/tests/fixtures/app/javascript/input/app/utils/components/form/index.js b/tests/fixtures/app/javascript/input/app/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/app/javascript/input/app/utils/components/form/index.js +++ /dev/null @@ -1,26 +0,0 @@ -export function generateErrorMessage({ options = {}, value, valueType }) { - const { isRequired } = options; - - if (isRequired) { - switch (valueType) { - case 'boolean': { - if (value === undefined || value === false) { - return 'Please select the checkbox.'; - } - - break; - } - - case 'number': - case 'string': { - if (value === undefined || value === '') { - return 'Please provide a value.'; - } - - break; - } - } - } - - return undefined; -} diff --git a/tests/fixtures/app/javascript/input/app/utils/fetch.js b/tests/fixtures/app/javascript/input/app/utils/fetch.js deleted file mode 100644 index 0e5ef3f..0000000 --- a/tests/fixtures/app/javascript/input/app/utils/fetch.js +++ /dev/null @@ -1,11 +0,0 @@ -function replacer(key, value) { - if (typeof value === 'undefined') { - return null; - } - - return value; -} - -export function generateBody(data = {}) { - return JSON.stringify(data, replacer); -} diff --git a/tests/fixtures/app/javascript/input/package.json b/tests/fixtures/app/javascript/input/package.json deleted file mode 100644 index 1692de1..0000000 --- a/tests/fixtures/app/javascript/input/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "my-app", - "version": "0.0.0" -} diff --git a/tests/fixtures/app/javascript/input/tests/helpers/components/form/index.js b/tests/fixtures/app/javascript/input/tests/helpers/components/form/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/app/javascript/input/tests/helpers/components/form/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { assert } from '@ember/debug'; -import { find, select } from '@ember/test-helpers'; - -export async function selectByLabel(selector, label) { - const option = find(`[data-test-option="${label}"]`); - - assert(`${label} is an unknown option. Please check for typos.`, option); - - await select(selector, option.value); -} diff --git a/tests/fixtures/app/javascript/input/tests/helpers/index.js b/tests/fixtures/app/javascript/input/tests/helpers/index.js deleted file mode 100644 index 432eab0..0000000 --- a/tests/fixtures/app/javascript/input/tests/helpers/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from 'my-app/tests/helpers/components/ui/form'; -export * from 'my-app/tests/helpers/services/config'; -export * from 'my-app/tests/helpers/services/experiments'; diff --git a/tests/fixtures/app/javascript/input/tests/helpers/services/config.js b/tests/fixtures/app/javascript/input/tests/helpers/services/config.js deleted file mode 100644 index a5f0e5e..0000000 --- a/tests/fixtures/app/javascript/input/tests/helpers/services/config.js +++ /dev/null @@ -1,23 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; - -export function setupConfigService(hooks, customization = {}) { - hooks.beforeEach(function () { - this.owner.register( - 'service:config', - class ConfigService extends Service { - customization = customization; - - isTestEnvironment = true; - - getValue(key) { - return get(this.customization, key); - } - } - ); - }); - - hooks.afterEach(function () { - this.owner.unregister('service:config'); - }); -} diff --git a/tests/fixtures/app/javascript/input/tests/helpers/services/experiments.js b/tests/fixtures/app/javascript/input/tests/helpers/services/experiments.js deleted file mode 100644 index 017f498..0000000 --- a/tests/fixtures/app/javascript/input/tests/helpers/services/experiments.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getContext } from '@ember/test-helpers'; - -export function assignVariants(mapping = {}) { - const { owner } = getContext(); - const experiments = owner.lookup('service:experiments'); - - for (const [experimentName, variant] of Object.entries(mapping)) { - experiments.setVariant(experimentName, variant); - } -} diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/navigation-menu/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/navigation-menu/component-test.js deleted file mode 100644 index 53d5827..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/navigation-menu/component-test.js +++ /dev/null @@ -1,45 +0,0 @@ -import { findAll, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | navigation-menu', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a navigation menu', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-nav="Main Navigation"]') - .hasAria( - 'label', - 'Main Navigation', - 'We can pass @name to specify the navigation.' - ) - .hasTagName('nav', 'We see the correct tag name.'); - - const links = findAll('[data-test-link]'); - - assert.strictEqual(links.length, 1, 'We see 1 link.'); - - assert - .dom(links[0]) - .hasAttribute('href', '/', 'We see the correct href for the 1st link.') - .hasText('Home', 'We see the correct label for the 1st link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/product/card/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/product/card/component-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/product/card/component-test.js +++ /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/app/javascript/input/tests/integration/components/product/details/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/product/details/component-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/product/details/component-test.js +++ /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/app/javascript/input/tests/integration/components/product/image/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/product/image/component-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/product/image/component-test.js +++ /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/app/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js +++ /dev/null @@ -1,209 +0,0 @@ -import { set } from '@ember/object'; -import { click, render, triggerKeyEvent } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/checkbox', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: true, - }; - }); - - test('The component renders a label and a checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Subscribe to The Ember Times?', 'We see the correct label.'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('disabled', 'false', 'The checkbox should be enabled.') - .hasAria('readonly', 'false', 'The checkbox should not be readonly.') - .hasAria('required', 'false', 'The checkbox should not be required.') - .hasAttribute('role', 'checkbox', 'We see the correct role.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.') - .hasTagName('span', 'We see the correct tag name.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .doesNotHaveAttribute('tabindex', 'The checkbox should not be focusable.') - .hasAria('disabled', 'true', 'The checkbox is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('readonly', 'true', 'We see the aria-readonly attribute.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Subscribe to The Ember Times? *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('required', 'true', 'The checkbox is required.'); - }); - - test('We can click on the checkbox to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Click the checkbox - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Click the checkbox again - expectedValue = true; - - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can press the Space key to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Press the Space key - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Press the Space key again - expectedValue = true; - - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/component-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/component-test.js +++ /dev/null @@ -1,179 +0,0 @@ -import { click, fillIn, find, 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 | ui/form', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - test('The component renders a form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - const titleId = find('[data-test-title]').getAttribute('id'); - const instructionsId = find('[data-test-instructions]').getAttribute('id'); - - assert - .dom('[data-test-form="Contact me"]') - .hasAria( - 'describedby', - instructionsId, - 'We see the correct aria-describedby.' - ) - .hasAria('labelledby', titleId, 'We see the correct aria-labelledby.'); - - assert.dom('[data-test-field]').exists({ count: 5 }, 'We see 5 fields.'); - - assert - .dom('[data-test-button="Submit"]') - .hasAttribute('type', 'submit', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Submit', 'We see the submit button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can submit the form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - await fillIn('[data-test-field="Name"]', 'Zoey'); - await fillIn('[data-test-field="Email"]', 'zoey@emberjs.com'); - await fillIn('[data-test-field="Message"]', 'Gude!'); - await click('[data-test-field="Subscribe to The Ember Times?"]'); - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - await click('[data-test-button="Submit"]'); - - assert.true( - this.submitForm.calledOnceWith({ - donation: 10000, - email: 'zoey@emberjs.com', - message: 'Gude!', - name: 'Zoey', - subscribe: false, - }), - 'We called @onSubmit once.' - ); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/field/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/field/component-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/field/component-test.js +++ /dev/null @@ -1,74 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/field', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the field layout', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert.dom('[data-test-label]').hasText('Name', 'We see the label.'); - - assert.dom('[data-test-field="Name"]').hasValue('', 'We see the field.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can pass @errorMessage to show an error message', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see the error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/information/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/information/component-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/information/component-test.js +++ /dev/null @@ -1,63 +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 | ui/form/information', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders nothing when we do not pass @title or @instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @title to display the form title', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .hasAttribute('id', 'ember123-title', 'We see the correct ID.') - .hasText('Contact me', 'We see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @instructions to display the form instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .hasAttribute('id', 'ember123-instructions', 'We see the correct ID.') - .hasText( - 'Still have questions about ember-container-query? Try sending me a message.', - 'We see the form instructions.' - ); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/input/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/input/component-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/input/component-test.js +++ /dev/null @@ -1,169 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/input', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name', 'We see the correct label.'); - - assert - .dom('[data-test-field="Name"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'text', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('Zoey', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert.dom('[data-test-field="Name"]').isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('Zoey', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name *', 'The label shows that the field is required.'); - - assert.dom('[data-test-field="Name"]').isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Name"]', ''); - - assert - .dom('[data-test-field="Name"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Tomster'; - - await fillIn('[data-test-field="Name"]', 'Tomster'); - - assert - .dom('[data-test-field="Name"]') - .hasValue('Tomster', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @type to create an email input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Email', 'We see the correct label.'); - - assert - .dom('[data-test-field="Email"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'email', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('zoey@emberjs.com', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/number/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/number/component-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/number/component-test.js +++ /dev/null @@ -1,159 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/number', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - donation: 1000, - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Donation amount ($)', 'We see the correct label.'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'number', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('1000', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('1000', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Donation amount ($) *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = undefined; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Donation amount ($)"]', ''); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 10000; - - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('10000', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/select/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/select/component-test.js deleted file mode 100644 index 20ea0b9..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/select/component-test.js +++ /dev/null @@ -1,244 +0,0 @@ -import { set } from '@ember/object'; -import { click, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { selectByLabel } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/select', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.changeset = { - sortBy: 'name:asc', - }; - - this.optionsForSorting = [ - { - label: 'Name: A to Z', - value: 'name:asc', - }, - { - label: 'Name: Z to A', - value: 'name:desc', - }, - { - label: 'Price: Low to High', - value: 'price:asc', - }, - { - label: 'Price: High to Low', - value: 'price:desc', - }, - ]; - }); - - test('The component renders a label and a select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('name:asc', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 4 }, 'We see 4 options.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Name: A to Z', 'We see the correct selected option.'); - - assert - .dom('[data-test-button="Clear"]') - .hasAria( - 'label', - 'Clear option for Sort by', - 'We see the correct aria-label.' - ) - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('✕', 'we see the correct label.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('The component renders when @options is undefined', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 0 }, 'We see 0 options.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('name:asc', 'We see the correct value.') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Sort by"]') - .isRequired('The select is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(5); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - 'price:desc', - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await selectByLabel('[data-test-field="Sort by"]', 'Price: High to Low'); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('price:desc', 'We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Price: High to Low', 'We see the correct selected option.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can click on the clear button to reset the option', async function (assert) { - assert.expect(4); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - undefined, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await click('[data-test-button="Clear"]'); - - assert - .dom('[data-test-field="Sort by"]') - .hasNoValue('We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .doesNotExist('We should not see a selected option.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/textarea/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/textarea/component-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/form/textarea/component-test.js +++ /dev/null @@ -1,144 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/textarea', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and a textarea', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message', 'We see the correct label.'); - - assert - .dom('[data-test-field="Message"]') - .doesNotHaveAttribute('readonly', 'The textarea should not be readonly.') - .hasTagName('textarea', 'We see the correct tag name.') - .hasValue('I 🧡 container queries!', 'We see the correct value.') - .isEnabled('The textarea should be enabled.') - .isNotRequired('The textarea should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the text area', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .isDisabled('The textarea is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('I 🧡 container queries!', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Message"]') - .isRequired('The textarea is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Message"]', ''); - - assert - .dom('[data-test-field="Message"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Keep up the good work!'; - - await fillIn('[data-test-field="Message"]', 'Keep up the good work!'); - - assert - .dom('[data-test-field="Message"]') - .hasValue('Keep up the good work!', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/integration/components/ui/page/component-test.js b/tests/fixtures/app/javascript/input/tests/integration/components/ui/page/component-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/app/javascript/input/tests/integration/components/ui/page/component-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/page', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the page layout', async function (assert) { - await render(hbs` - -
- Content goes here. -
-
- `); - - assert.dom('h1').hasText('Forms', 'We see the title.'); - - assert.dom('[data-test-content]').exists('We see the yielded content.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/config/service-test.js b/tests/fixtures/app/javascript/input/tests/unit/config/service-test.js deleted file mode 100644 index 8026782..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/config/service-test.js +++ /dev/null @@ -1,54 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Service | config', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - key: { - child: { - grandchild: 'value', - }, - }, - }); - - hooks.beforeEach(function () { - this.config = this.owner.lookup('service:config'); - }); - - module('getValue', function () { - test('returns the value of a key', function (assert) { - assert.deepEqual( - this.config.getValue('key'), - { - child: { - grandchild: 'value', - }, - }, - 'We get the correct value.' - ); - }); - - test('returns the value of a nested key', function (assert) { - assert.deepEqual( - this.config.getValue('key.child'), - { - grandchild: 'value', - }, - 'We get the correct value. (1)' - ); - - assert.strictEqual( - this.config.getValue('key.child.grandchild'), - 'value', - 'We get the correct value. (2)' - ); - }); - }); - - module('isTestEnvironment', function () { - test('returns true in the test environment', function (assert) { - assert.true(this.config.isTestEnvironment, 'We get the correct value.'); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/controllers/form/controller-test.js b/tests/fixtures/app/javascript/input/tests/unit/controllers/form/controller-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/controllers/form/controller-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/controllers/products/controller-test.js b/tests/fixtures/app/javascript/input/tests/unit/controllers/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/controllers/products/controller-test.js +++ /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/app/javascript/input/tests/unit/experiments/service-test.js b/tests/fixtures/app/javascript/input/tests/unit/experiments/service-test.js deleted file mode 100644 index f5770ec..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/experiments/service-test.js +++ /dev/null @@ -1,204 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Unit | Service | experiments', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - experiments: { - 'experiment-a': { - control: 0.5, - v1: 0.5, - }, - - 'experiment-b': { - control: 0.4, - v1: 0.3, - v2: 0.3, - }, - }, - }); - - hooks.beforeEach(function () { - this.experiments = this.owner.lookup('service:experiments'); - }); - - module('cachedVariants', function () { - test('returns an object, with each experiment mapped to undefined', function (assert) { - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': undefined, - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('getVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.getVariant('experiment-c'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: experiment-c is an unknown experiment. Please define the experiment in the config service.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('returns a variant at random when called initially', function (assert) { - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - - test('returns the cached variant when called again', function (assert) { - // Check one experiment - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('setVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.setVariant('experiment-a', 'v2'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: v2 is an unknown variant for experiment-a. Please check for typos.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('can be used to deterministically set the variant', function (assert) { - this.experiments.setVariant('experiment-a', 'v1'); - - assert.strictEqual( - this.experiments.getVariant('experiment-a'), - 'v1', - 'We get the correct value for variant.' - ); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/form/controller-test.js b/tests/fixtures/app/javascript/input/tests/unit/form/controller-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/form/controller-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/form/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/form/route-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/form/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/index/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/index/route-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/index/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/product-details/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/product-details/route-test.js +++ /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/input/tests/unit/products/controller-test.js b/tests/fixtures/app/javascript/input/tests/unit/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/products/controller-test.js +++ /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/app/javascript/input/tests/unit/routes/form/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/form/route-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/routes/form/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/routes/index/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/index/route-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/routes/index/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/routes/product-details/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/routes/product-details/route-test.js +++ /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/input/tests/unit/routes/products/product/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/routes/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/input/tests/unit/routes/products/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/javascript/input/tests/unit/routes/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/app/adapters/application.js b/tests/fixtures/app/javascript/output/app/adapters/application.js deleted file mode 100644 index 09a6c6c..0000000 --- a/tests/fixtures/app/javascript/output/app/adapters/application.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPIAdapter from '@ember-data/adapter/json-api'; - -export default class ApplicationAdapter extends JSONAPIAdapter {} diff --git a/tests/fixtures/app/javascript/output/app/components/product/card.css b/tests/fixtures/app/javascript/output/app/components/product/card.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/card.css +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/app/javascript/output/app/components/product/card.hbs b/tests/fixtures/app/javascript/output/app/components/product/card.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/card.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/product/details.css b/tests/fixtures/app/javascript/output/app/components/product/details.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/details.css +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/app/javascript/output/app/components/product/details.hbs b/tests/fixtures/app/javascript/output/app/components/product/details.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/details.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/product/details.js b/tests/fixtures/app/javascript/output/app/components/product/details.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/details.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/product/image.css b/tests/fixtures/app/javascript/output/app/components/product/image.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/image.css +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/app/javascript/output/app/components/product/image.hbs b/tests/fixtures/app/javascript/output/app/components/product/image.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/image.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/product/image.js b/tests/fixtures/app/javascript/output/app/components/product/image.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/app/javascript/output/app/components/product/image.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form.css b/tests/fixtures/app/javascript/output/app/components/ui/form.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form.css +++ /dev/null @@ -1,19 +0,0 @@ -.form { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - padding: 1.25rem 1.5rem; -} - -.actions { - align-items: center; - display: flex; - justify-content: flex-end; - margin-top: 2rem; -} - -.submit-button { - padding: 0.5rem 3rem; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form.hbs +++ /dev/null @@ -1,70 +0,0 @@ -{{#let (unique-id) as |formId|}} -
- - - - {{yield - (hash - Checkbox=(component - "ui/form/checkbox" - changeset=this.changeset - isInline=true - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Input=(component - "ui/form/input" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Number=(component - "ui/form/number" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Select=(component - "ui/form/select" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Textarea=(component - "ui/form/textarea" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - ) - }} - - -
- -
- -{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form.js b/tests/fixtures/app/javascript/output/app/components/ui/form.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form.js +++ /dev/null @@ -1,17 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; -import { TrackedObject } from 'tracked-built-ins'; - -export default class UiFormComponent extends Component { - changeset = new TrackedObject(this.args.data ?? {}); - - @action submitForm(event) { - event.preventDefault(); - - this.args.onSubmit(this.changeset); - } - - @action updateChangeset({ key, value }) { - this.changeset[key] = value; - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.css b/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.css +++ /dev/null @@ -1,37 +0,0 @@ -.checkbox { - align-items: center; - background-color: white; - border: 0.125rem solid #ffd54f; - cursor: pointer; - display: flex; - height: 1rem; - justify-content: center; - position: relative; - width: 1rem; -} - -.checkbox:focus { - background-color: #ffecb3; - outline: 0; -} - -.checkbox:not(:focus) { - border-color: transparent; -} - -.checkbox.is-checked { - background-color: #1976d2; -} - -.checkbox.is-disabled { - background-color: #b2c9d4; - cursor: not-allowed; -} - -.checkmark-icon { - color: white; -} - -.checkbox.is-disabled .checkmark-icon { - color: #546e7a; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.hbs +++ /dev/null @@ -1,40 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - {{#if this.isChecked}} - - {{/if}} - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.js b/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.js deleted file mode 100644 index 9cfbe2c..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.js +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormCheckboxComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.isChecked, - valueType: 'boolean', - }); - } - - get isChecked() { - const { changeset, key } = this.args; - - return get(changeset, key) ?? undefined; - } - - @action updateValue() { - const { isDisabled, isReadOnly, key, onUpdate } = this.args; - - if (isDisabled || isReadOnly) { - return; - } - - const value = !this.isChecked; - - onUpdate({ key, value }); - } - - @action updateValueByPressingSpace(event) { - if (event.code === 'Space' || event.key === 'Space') { - this.updateValue(); - } - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/field.css b/tests/fixtures/app/javascript/output/app/components/ui/form/field.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/field.css +++ /dev/null @@ -1,83 +0,0 @@ -.container { - align-items: start; - display: grid; -} - -.container:not(.is-wide, .no-feedback) { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field" - "feedback"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr auto; -} - -.container:not(.is-wide).no-feedback { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; -} - -.container.is-wide:not(.no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "label field" - "label feedback"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-wide.no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: "label field"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr; -} - -.label { - grid-area: label; - overflow: hidden; - word-break: break-word; -} - -.field { - grid-area: field; -} - -.feedback { - align-items: center; - display: flex; - font-size: 0.875rem; - grid-area: feedback; -} - -.feedback.is-error { - color: #ff5252; -} - -/* Exceptions for mobile */ -.container.is-inline:not(.is-wide, .no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "field label" - "feedback feedback"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-inline:not(.is-wide).no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0; - grid-template-areas: "field label"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/field.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/field.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/field.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{#let (unique-id) as |inputId|}} -
-
- {{yield (hash inputId=inputId) to="label"}} -
- -
- {{yield (hash inputId=inputId) to="field"}} -
- - {{#if @errorMessage}} -
- {{@errorMessage}} -
- {{/if}} -
-{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/information.css b/tests/fixtures/app/javascript/output/app/components/ui/form/information.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/information.css +++ /dev/null @@ -1,16 +0,0 @@ -.container { - margin-bottom: 1rem; -} - -.title { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -.instructions { - font-size: 0.9rem; - font-weight: 300; - line-height: 1.25rem; - margin-bottom: 0.5rem; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/information.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/information.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/information.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{#if (or @title @instructions)}} -
- {{#if @title}} -
- {{@title}} -
- {{/if}} - - {{#if @instructions}} -

- {{@instructions}} -

- {{/if}} -
-{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/input.css b/tests/fixtures/app/javascript/output/app/components/ui/form/input.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/input.css +++ /dev/null @@ -1,24 +0,0 @@ -.input { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.input:focus { - background-color: #ffecb3; - outline: 0; -} - -.input:not(:focus) { - border-color: transparent; -} - -.input::placeholder { - font-style: italic; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/input.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/input.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/input.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/input.js b/tests/fixtures/app/javascript/output/app/components/ui/form/input.js deleted file mode 100644 index 7fd3558..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/input.js +++ /dev/null @@ -1,42 +0,0 @@ -import { assert } from '@ember/debug'; -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormInputComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get type() { - const { type } = this.args; - - assert( - 'To render a number input, please use instead.', - type !== 'number' - ); - - return this.args.type ?? 'text'; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/number.css b/tests/fixtures/app/javascript/output/app/components/ui/form/number.css deleted file mode 100644 index f24ae8e..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/number.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-app/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/number.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/number.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/number.hbs +++ /dev/null @@ -1,34 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/number.js b/tests/fixtures/app/javascript/output/app/components/ui/form/number.js deleted file mode 100644 index 69b12c0..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/number.js +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormNumberComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'number', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - const valueAsNumber = Number.parseFloat(value); - - if (Number.isNaN(valueAsNumber)) { - onUpdate({ key, value: undefined }); - return; - } - - onUpdate({ key, value: valueAsNumber }); - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/select.css b/tests/fixtures/app/javascript/output/app/components/ui/form/select.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/select.css +++ /dev/null @@ -1,33 +0,0 @@ -.select-container { - display: grid; - grid-column-gap: 0.75rem; - grid-template-areas: "select clear-button"; - grid-template-columns: 1fr auto; - grid-template-rows: 1fr; -} - -.select { - border: 0.125rem solid #ffd54f; - grid-area: select; - padding: 0.125rem 0.25rem; - width: 100%; -} - -.select:focus { - background-color: #ffecb3; - outline: 0; -} - -.select:not(:focus) { - border-color: transparent; -} - -.select.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} - -.clear-button { - grid-area: clear-button; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/select.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/select.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/select.hbs +++ /dev/null @@ -1,79 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> -
- - - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/select.js b/tests/fixtures/app/javascript/output/app/components/ui/form/select.js deleted file mode 100644 index efc8007..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/select.js +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormSelectComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get options() { - return this.args.options ?? []; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action resetValue() { - const { key, onUpdate } = this.args; - - onUpdate({ key, value: undefined }); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.css b/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.css +++ /dev/null @@ -1,24 +0,0 @@ -.textarea { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.textarea:focus { - background-color: #ffecb3; - outline: 0; -} - -.textarea:not(:focus) { - border-color: transparent; -} - -.textarea::placeholder { - font-style: italic; -} - -.textarea.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.hbs b/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.js b/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.js deleted file mode 100644 index 29c258e..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/form/textarea.js +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormTextareaComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/javascript/output/app/components/ui/page.hbs b/tests/fixtures/app/javascript/output/app/components/ui/page.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/page.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/controllers/form.js b/tests/fixtures/app/javascript/output/app/controllers/form.js deleted file mode 100644 index 816335a..0000000 --- a/tests/fixtures/app/javascript/output/app/controllers/form.js +++ /dev/null @@ -1,44 +0,0 @@ -import Controller from '@ember/controller'; -import { service } from '@ember/service'; -import { dropTask } from 'ember-concurrency'; -import fetch from 'fetch'; -import { generateBody } from 'my-app/utils/fetch'; - -export default class FormController extends Controller { - @service experiments; - - get initialData() { - if (this.isPartOfSubscribeToEmberTimesExperiment) { - return { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }; - } - - return { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }; - } - - get isPartOfSubscribeToEmberTimesExperiment() { - return this.experiments.getVariant('subscribe-to-ember-times') === 'v1'; - } - - submitForm = dropTask(async (data) => { - try { - const body = generateBody(data); - - await fetch('/contact-me', { - body, - method: 'POST', - }); - } catch (e) { - throw new Error(e); - } - }); -} diff --git a/tests/fixtures/app/javascript/output/app/controllers/products.js b/tests/fixtures/app/javascript/output/app/controllers/products.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/app/javascript/output/app/controllers/products.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/app/javascript/output/app/models/product.js b/tests/fixtures/app/javascript/output/app/models/product.js deleted file mode 100644 index 3c6dd3d..0000000 --- a/tests/fixtures/app/javascript/output/app/models/product.js +++ /dev/null @@ -1,11 +0,0 @@ -import Model, { attr } from '@ember-data/model'; - -export default class ProductModel extends Model { - @attr description; - @attr imageUrl; - @attr name; - @attr price; - @attr rating; - @attr seller; - @attr shortDescription; -} diff --git a/tests/fixtures/app/javascript/output/app/routes/application.js b/tests/fixtures/app/javascript/output/app/routes/application.js deleted file mode 100644 index 0a89bde..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/application.js +++ /dev/null @@ -1,10 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ApplicationRoute extends Route { - @service intl; - - beforeModel() { - this.intl.setLocale(['en-us']); - } -} diff --git a/tests/fixtures/app/javascript/output/app/routes/form.js b/tests/fixtures/app/javascript/output/app/routes/form.js deleted file mode 100644 index df63a89..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/form.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class FormRoute extends Route {} diff --git a/tests/fixtures/app/javascript/output/app/routes/index.js b/tests/fixtures/app/javascript/output/app/routes/index.js deleted file mode 100644 index accaec9..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class IndexRoute extends Route {} diff --git a/tests/fixtures/app/javascript/output/app/routes/product-details.js b/tests/fixtures/app/javascript/output/app/routes/product-details.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/product-details.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/javascript/output/app/routes/products.js b/tests/fixtures/app/javascript/output/app/routes/products.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/products.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/app/javascript/output/app/routes/products/product.js b/tests/fixtures/app/javascript/output/app/routes/products/product.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/app/javascript/output/app/routes/products/product.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/javascript/output/app/serializers/application.js b/tests/fixtures/app/javascript/output/app/serializers/application.js deleted file mode 100644 index 2341d47..0000000 --- a/tests/fixtures/app/javascript/output/app/serializers/application.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPISerializer from '@ember-data/serializer/json-api'; - -export default class ApplicationSerializer extends JSONAPISerializer {} diff --git a/tests/fixtures/app/javascript/output/app/services/config.js b/tests/fixtures/app/javascript/output/app/services/config.js deleted file mode 100644 index acc692f..0000000 --- a/tests/fixtures/app/javascript/output/app/services/config.js +++ /dev/null @@ -1,25 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; -import config from 'my-app/config/environment'; - -export default class ConfigService extends Service { - customization = { - experiments: { - 'nest-product-details': { - control: 0.5, - v1: 0.5, - }, - - 'subscribe-to-ember-times': { - control: 0.7, - v1: 0.3, - }, - }, - }; - - isTestEnvironment = config.environment === 'test'; - - getValue(key) { - return get(this.customization, key); - } -} diff --git a/tests/fixtures/app/javascript/output/app/services/experiments.js b/tests/fixtures/app/javascript/output/app/services/experiments.js deleted file mode 100644 index 83cdf3c..0000000 --- a/tests/fixtures/app/javascript/output/app/services/experiments.js +++ /dev/null @@ -1,82 +0,0 @@ -import { assert } from '@ember/debug'; -import Service, { service } from '@ember/service'; -import { cached } from '@glimmer/tracking'; - -export default class ExperimentsService extends Service { - @service config; - - @cached get cdfs() { - const experiments = this.config.getValue('experiments') ?? {}; - const cdfs = new Map(); - - for (const [experimentName, pdf] of Object.entries(experiments)) { - const cdf = new Map(); - let total = 0; - - for (const [variant, probability] of Object.entries(pdf)) { - total += probability; - cdf.set(variant, total); - } - - cdfs.set(experimentName, cdf); - } - - return cdfs; - } - - constructor() { - super(...arguments); - - this.#initializeVariants(); - } - - getVariant(experimentName) { - assert( - `${experimentName} is an unknown experiment. Please define the experiment in the config service.`, - this.cdfs.has(experimentName) - ); - - const cachedVariant = this.cachedVariants[experimentName]; - - if (cachedVariant) { - return cachedVariant; - } - - this.#determineVariant(experimentName); - - return this.cachedVariants[experimentName]; - } - - setVariant(experimentName, variant) { - const cdf = this.cdfs.get(experimentName); - - assert( - `${variant} is an unknown variant for ${experimentName}. Please check for typos.`, - cdf.has(variant) - ); - - this.cachedVariants[experimentName] = variant; - } - - #determineVariant(experimentName) { - const cdf = this.cdfs.get(experimentName); - const sample = Math.random(); - - for (const [variant, total] of cdf.entries()) { - if (sample < total) { - this.setVariant(experimentName, variant); - break; - } - } - } - - #initializeVariants() { - const cachedVariants = {}; - - this.cdfs.forEach((cdf, experimentName) => { - cachedVariants[experimentName] = undefined; - }); - - this.cachedVariants = cachedVariants; - } -} diff --git a/tests/fixtures/app/javascript/output/app/styles/app.css b/tests/fixtures/app/javascript/output/app/styles/app.css deleted file mode 100644 index 210d088..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/app.css +++ /dev/null @@ -1,109 +0,0 @@ -html { - font-size: 16px; - height: 100%; -} - -body { - background-color: #020e1c; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-weight: 400; - height: 100%; - letter-spacing: 0.03rem; - margin: 0; -} - -* { - margin: 0; - padding: 0; -} - -h1 { - font-size: 2.25em; - font-weight: 700; - margin-bottom: 1.5rem; -} - -h2 { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -h3 { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -h4 { - font-size: 1rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -a { - color: rgb(245 255 250 / 88%); -} - -button { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - padding: 0.25rem 0.5rem; -} - -button:hover { - background-color: rgb(255 255 255 / 22.5%); - cursor: pointer; - transition: background-color 0.17s; -} - -input { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -p { - margin-bottom: 0.75rem; -} - -select { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -table { - border-collapse: collapse; - width: 100%; -} - -textarea { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -th, -td { - border: 0.0625rem solid rgb(112 128 144 / 100%); - padding: 0.25rem 0.5rem; -} - -ul { - list-style-type: none; -} - -/* stylelint-disable selector-pseudo-class-no-unknown */ -:global(#ember-testing-container) { - overflow: hidden !important; -} - -:global(#ember-testing) { - background-color: #020e1c !important; -} diff --git a/tests/fixtures/app/javascript/output/app/styles/application.css b/tests/fixtures/app/javascript/output/app/styles/application.css deleted file mode 100644 index 16fae37..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/application.css +++ /dev/null @@ -1,55 +0,0 @@ -.application { - display: grid; - grid-template-areas: - ". header ." - "main main main" - ". footer ."; - grid-template-columns: 1fr minmax(auto, 75rem) 1fr; - grid-template-rows: auto 1fr auto; - height: 100%; - overflow: hidden; - width: 100vw; -} - -.header { - grid-area: header; - min-height: 2.75rem; - overflow-x: auto; -} - -.main { - background-color: rgb(255 255 255 / 4.5%); - border-bottom: 0.0625rem solid rgb(211 211 211 / 15%); - border-top: 0.0625rem solid rgb(211 211 211 / 15%); - display: flex; - flex: 1; - grid-area: main; - justify-content: center; - overflow-y: hidden; -} - -.center { - display: flex; - flex-direction: column; - max-width: 75rem; - overflow-y: auto; - width: 100%; -} - -.footer { - align-items: center; - display: flex; - grid-area: footer; - justify-content: center; - min-height: 2.375rem; -} - -.copyright { - color: rgb(128 191 255 / 90%); - font-size: 0.75rem; - padding: 0.75rem 0; -} - -.copyright a { - color: rgb(128 191 255 / 90%); -} diff --git a/tests/fixtures/app/javascript/output/app/styles/form.css b/tests/fixtures/app/javascript/output/app/styles/form.css deleted file mode 100644 index 8ba2936..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/form.css +++ /dev/null @@ -1,7 +0,0 @@ -.field { - margin-bottom: 1.25rem; -} - -.field:last-of-type { - margin-bottom: 0; -} diff --git a/tests/fixtures/app/javascript/output/app/styles/index.css b/tests/fixtures/app/javascript/output/app/styles/index.css deleted file mode 100644 index ea2d8d7..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/index.css +++ /dev/null @@ -1,3 +0,0 @@ -.container { - padding: 1.5rem 1rem; -} diff --git a/tests/fixtures/app/javascript/output/app/styles/product-details.css b/tests/fixtures/app/javascript/output/app/styles/product-details.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/product-details.css +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/app/javascript/output/app/styles/products.css b/tests/fixtures/app/javascript/output/app/styles/products.css deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/products.css +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/app/javascript/output/app/styles/products/product.css b/tests/fixtures/app/javascript/output/app/styles/products/product.css deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/app/javascript/output/app/styles/products/product.css +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/app/javascript/output/app/templates/application.hbs b/tests/fixtures/app/javascript/output/app/templates/application.hbs deleted file mode 100644 index 57bb661..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/application.hbs +++ /dev/null @@ -1,47 +0,0 @@ -{{page-title (t "routes.application.app-name")}} - -
-
- - - -
- -
-
- {{outlet}} -
-
- -
- - {{t "routes.application.copyright" htmlSafe=true}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/templates/form.hbs b/tests/fixtures/app/javascript/output/app/templates/form.hbs deleted file mode 100644 index af78c5e..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/form.hbs +++ /dev/null @@ -1,76 +0,0 @@ -{{page-title (t "routes.form.title")}} - - - -
- -
- -
- -
- -
- -
- - {{#if this.isPartOfSubscribeToEmberTimesExperiment}} -
- -
- - {{else}} -
- -
- - {{/if}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/templates/index.hbs b/tests/fixtures/app/javascript/output/app/templates/index.hbs deleted file mode 100644 index a5b7cf9..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/index.hbs +++ /dev/null @@ -1,5 +0,0 @@ - -

- {{t "routes.index.description" htmlSafe=true}} -

-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/templates/product-details.hbs b/tests/fixtures/app/javascript/output/app/templates/product-details.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/product-details.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/templates/products.hbs b/tests/fixtures/app/javascript/output/app/templates/products.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/products.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/templates/products/product.hbs b/tests/fixtures/app/javascript/output/app/templates/products/product.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/app/javascript/output/app/templates/products/product.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/output/app/utils/components/form/index.js b/tests/fixtures/app/javascript/output/app/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/app/javascript/output/app/utils/components/form/index.js +++ /dev/null @@ -1,26 +0,0 @@ -export function generateErrorMessage({ options = {}, value, valueType }) { - const { isRequired } = options; - - if (isRequired) { - switch (valueType) { - case 'boolean': { - if (value === undefined || value === false) { - return 'Please select the checkbox.'; - } - - break; - } - - case 'number': - case 'string': { - if (value === undefined || value === '') { - return 'Please provide a value.'; - } - - break; - } - } - } - - return undefined; -} diff --git a/tests/fixtures/app/javascript/output/app/utils/fetch.js b/tests/fixtures/app/javascript/output/app/utils/fetch.js deleted file mode 100644 index 0e5ef3f..0000000 --- a/tests/fixtures/app/javascript/output/app/utils/fetch.js +++ /dev/null @@ -1,11 +0,0 @@ -function replacer(key, value) { - if (typeof value === 'undefined') { - return null; - } - - return value; -} - -export function generateBody(data = {}) { - return JSON.stringify(data, replacer); -} diff --git a/tests/fixtures/app/javascript/output/package.json b/tests/fixtures/app/javascript/output/package.json deleted file mode 100644 index 1692de1..0000000 --- a/tests/fixtures/app/javascript/output/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "my-app", - "version": "0.0.0" -} diff --git a/tests/fixtures/app/javascript/output/tests/helpers/components/form/index.js b/tests/fixtures/app/javascript/output/tests/helpers/components/form/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/app/javascript/output/tests/helpers/components/form/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { assert } from '@ember/debug'; -import { find, select } from '@ember/test-helpers'; - -export async function selectByLabel(selector, label) { - const option = find(`[data-test-option="${label}"]`); - - assert(`${label} is an unknown option. Please check for typos.`, option); - - await select(selector, option.value); -} diff --git a/tests/fixtures/app/javascript/output/tests/helpers/index.js b/tests/fixtures/app/javascript/output/tests/helpers/index.js deleted file mode 100644 index 432eab0..0000000 --- a/tests/fixtures/app/javascript/output/tests/helpers/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from 'my-app/tests/helpers/components/ui/form'; -export * from 'my-app/tests/helpers/services/config'; -export * from 'my-app/tests/helpers/services/experiments'; diff --git a/tests/fixtures/app/javascript/output/tests/helpers/services/config.js b/tests/fixtures/app/javascript/output/tests/helpers/services/config.js deleted file mode 100644 index a5f0e5e..0000000 --- a/tests/fixtures/app/javascript/output/tests/helpers/services/config.js +++ /dev/null @@ -1,23 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; - -export function setupConfigService(hooks, customization = {}) { - hooks.beforeEach(function () { - this.owner.register( - 'service:config', - class ConfigService extends Service { - customization = customization; - - isTestEnvironment = true; - - getValue(key) { - return get(this.customization, key); - } - } - ); - }); - - hooks.afterEach(function () { - this.owner.unregister('service:config'); - }); -} diff --git a/tests/fixtures/app/javascript/output/tests/helpers/services/experiments.js b/tests/fixtures/app/javascript/output/tests/helpers/services/experiments.js deleted file mode 100644 index 017f498..0000000 --- a/tests/fixtures/app/javascript/output/tests/helpers/services/experiments.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getContext } from '@ember/test-helpers'; - -export function assignVariants(mapping = {}) { - const { owner } = getContext(); - const experiments = owner.lookup('service:experiments'); - - for (const [experimentName, variant] of Object.entries(mapping)) { - experiments.setVariant(experimentName, variant); - } -} diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/navigation-menu-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/navigation-menu-test.js deleted file mode 100644 index 53d5827..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/navigation-menu-test.js +++ /dev/null @@ -1,45 +0,0 @@ -import { findAll, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | navigation-menu', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a navigation menu', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-nav="Main Navigation"]') - .hasAria( - 'label', - 'Main Navigation', - 'We can pass @name to specify the navigation.' - ) - .hasTagName('nav', 'We see the correct tag name.'); - - const links = findAll('[data-test-link]'); - - assert.strictEqual(links.length, 1, 'We see 1 link.'); - - assert - .dom(links[0]) - .hasAttribute('href', '/', 'We see the correct href for the 1st link.') - .hasText('Home', 'We see the correct label for the 1st link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/product/card-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/product/card-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/product/card-test.js +++ /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/app/javascript/output/tests/integration/components/product/details-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/product/details-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/product/details-test.js +++ /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/app/javascript/output/tests/integration/components/product/image-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/product/image-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/product/image-test.js +++ /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/app/javascript/output/tests/integration/components/ui/form-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form-test.js +++ /dev/null @@ -1,179 +0,0 @@ -import { click, fillIn, find, 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 | ui/form', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - test('The component renders a form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - const titleId = find('[data-test-title]').getAttribute('id'); - const instructionsId = find('[data-test-instructions]').getAttribute('id'); - - assert - .dom('[data-test-form="Contact me"]') - .hasAria( - 'describedby', - instructionsId, - 'We see the correct aria-describedby.' - ) - .hasAria('labelledby', titleId, 'We see the correct aria-labelledby.'); - - assert.dom('[data-test-field]').exists({ count: 5 }, 'We see 5 fields.'); - - assert - .dom('[data-test-button="Submit"]') - .hasAttribute('type', 'submit', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Submit', 'We see the submit button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can submit the form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - await fillIn('[data-test-field="Name"]', 'Zoey'); - await fillIn('[data-test-field="Email"]', 'zoey@emberjs.com'); - await fillIn('[data-test-field="Message"]', 'Gude!'); - await click('[data-test-field="Subscribe to The Ember Times?"]'); - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - await click('[data-test-button="Submit"]'); - - assert.true( - this.submitForm.calledOnceWith({ - donation: 10000, - email: 'zoey@emberjs.com', - message: 'Gude!', - name: 'Zoey', - subscribe: false, - }), - 'We called @onSubmit once.' - ); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/checkbox-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/checkbox-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/checkbox-test.js +++ /dev/null @@ -1,209 +0,0 @@ -import { set } from '@ember/object'; -import { click, render, triggerKeyEvent } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/checkbox', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: true, - }; - }); - - test('The component renders a label and a checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Subscribe to The Ember Times?', 'We see the correct label.'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('disabled', 'false', 'The checkbox should be enabled.') - .hasAria('readonly', 'false', 'The checkbox should not be readonly.') - .hasAria('required', 'false', 'The checkbox should not be required.') - .hasAttribute('role', 'checkbox', 'We see the correct role.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.') - .hasTagName('span', 'We see the correct tag name.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .doesNotHaveAttribute('tabindex', 'The checkbox should not be focusable.') - .hasAria('disabled', 'true', 'The checkbox is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('readonly', 'true', 'We see the aria-readonly attribute.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Subscribe to The Ember Times? *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('required', 'true', 'The checkbox is required.'); - }); - - test('We can click on the checkbox to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Click the checkbox - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Click the checkbox again - expectedValue = true; - - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can press the Space key to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Press the Space key - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Press the Space key again - expectedValue = true; - - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/field-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/field-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/field-test.js +++ /dev/null @@ -1,74 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/field', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the field layout', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert.dom('[data-test-label]').hasText('Name', 'We see the label.'); - - assert.dom('[data-test-field="Name"]').hasValue('', 'We see the field.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can pass @errorMessage to show an error message', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see the error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/information-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/information-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/information-test.js +++ /dev/null @@ -1,63 +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 | ui/form/information', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders nothing when we do not pass @title or @instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @title to display the form title', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .hasAttribute('id', 'ember123-title', 'We see the correct ID.') - .hasText('Contact me', 'We see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @instructions to display the form instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .hasAttribute('id', 'ember123-instructions', 'We see the correct ID.') - .hasText( - 'Still have questions about ember-container-query? Try sending me a message.', - 'We see the form instructions.' - ); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/input-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/input-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/input-test.js +++ /dev/null @@ -1,169 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/input', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name', 'We see the correct label.'); - - assert - .dom('[data-test-field="Name"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'text', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('Zoey', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert.dom('[data-test-field="Name"]').isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('Zoey', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name *', 'The label shows that the field is required.'); - - assert.dom('[data-test-field="Name"]').isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Name"]', ''); - - assert - .dom('[data-test-field="Name"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Tomster'; - - await fillIn('[data-test-field="Name"]', 'Tomster'); - - assert - .dom('[data-test-field="Name"]') - .hasValue('Tomster', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @type to create an email input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Email', 'We see the correct label.'); - - assert - .dom('[data-test-field="Email"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'email', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('zoey@emberjs.com', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/number-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/number-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/number-test.js +++ /dev/null @@ -1,159 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/number', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - donation: 1000, - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Donation amount ($)', 'We see the correct label.'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'number', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('1000', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('1000', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Donation amount ($) *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = undefined; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Donation amount ($)"]', ''); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 10000; - - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('10000', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/select-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/select-test.js deleted file mode 100644 index 20ea0b9..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/select-test.js +++ /dev/null @@ -1,244 +0,0 @@ -import { set } from '@ember/object'; -import { click, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { selectByLabel } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/select', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.changeset = { - sortBy: 'name:asc', - }; - - this.optionsForSorting = [ - { - label: 'Name: A to Z', - value: 'name:asc', - }, - { - label: 'Name: Z to A', - value: 'name:desc', - }, - { - label: 'Price: Low to High', - value: 'price:asc', - }, - { - label: 'Price: High to Low', - value: 'price:desc', - }, - ]; - }); - - test('The component renders a label and a select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('name:asc', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 4 }, 'We see 4 options.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Name: A to Z', 'We see the correct selected option.'); - - assert - .dom('[data-test-button="Clear"]') - .hasAria( - 'label', - 'Clear option for Sort by', - 'We see the correct aria-label.' - ) - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('✕', 'we see the correct label.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('The component renders when @options is undefined', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 0 }, 'We see 0 options.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('name:asc', 'We see the correct value.') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Sort by"]') - .isRequired('The select is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(5); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - 'price:desc', - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await selectByLabel('[data-test-field="Sort by"]', 'Price: High to Low'); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('price:desc', 'We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Price: High to Low', 'We see the correct selected option.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can click on the clear button to reset the option', async function (assert) { - assert.expect(4); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - undefined, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await click('[data-test-button="Clear"]'); - - assert - .dom('[data-test-field="Sort by"]') - .hasNoValue('We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .doesNotExist('We should not see a selected option.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/textarea-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/textarea-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/form/textarea-test.js +++ /dev/null @@ -1,144 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/textarea', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and a textarea', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message', 'We see the correct label.'); - - assert - .dom('[data-test-field="Message"]') - .doesNotHaveAttribute('readonly', 'The textarea should not be readonly.') - .hasTagName('textarea', 'We see the correct tag name.') - .hasValue('I 🧡 container queries!', 'We see the correct value.') - .isEnabled('The textarea should be enabled.') - .isNotRequired('The textarea should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the text area', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .isDisabled('The textarea is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('I 🧡 container queries!', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Message"]') - .isRequired('The textarea is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Message"]', ''); - - assert - .dom('[data-test-field="Message"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Keep up the good work!'; - - await fillIn('[data-test-field="Message"]', 'Keep up the good work!'); - - assert - .dom('[data-test-field="Message"]') - .hasValue('Keep up the good work!', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/integration/components/ui/page-test.js b/tests/fixtures/app/javascript/output/tests/integration/components/ui/page-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/app/javascript/output/tests/integration/components/ui/page-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/page', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the page layout', async function (assert) { - await render(hbs` - -
- Content goes here. -
-
- `); - - assert.dom('h1').hasText('Forms', 'We see the title.'); - - assert.dom('[data-test-content]').exists('We see the yielded content.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/controllers/form-test.js b/tests/fixtures/app/javascript/output/tests/unit/controllers/form-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/controllers/form-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/controllers/products-test.js b/tests/fixtures/app/javascript/output/tests/unit/controllers/products-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/controllers/products-test.js +++ /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/app/javascript/output/tests/unit/routes/application-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/application-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/application-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/routes/form-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/form-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/form-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/routes/index-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/index-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/routes/product-details-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/product-details-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/product-details-test.js +++ /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/tests/unit/routes/products-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/products-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/products-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/routes/products/product-test.js b/tests/fixtures/app/javascript/output/tests/unit/routes/products/product-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/routes/products/product-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/services/config-test.js b/tests/fixtures/app/javascript/output/tests/unit/services/config-test.js deleted file mode 100644 index 8026782..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/services/config-test.js +++ /dev/null @@ -1,54 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Service | config', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - key: { - child: { - grandchild: 'value', - }, - }, - }); - - hooks.beforeEach(function () { - this.config = this.owner.lookup('service:config'); - }); - - module('getValue', function () { - test('returns the value of a key', function (assert) { - assert.deepEqual( - this.config.getValue('key'), - { - child: { - grandchild: 'value', - }, - }, - 'We get the correct value.' - ); - }); - - test('returns the value of a nested key', function (assert) { - assert.deepEqual( - this.config.getValue('key.child'), - { - grandchild: 'value', - }, - 'We get the correct value. (1)' - ); - - assert.strictEqual( - this.config.getValue('key.child.grandchild'), - 'value', - 'We get the correct value. (2)' - ); - }); - }); - - module('isTestEnvironment', function () { - test('returns true in the test environment', function (assert) { - assert.true(this.config.isTestEnvironment, 'We get the correct value.'); - }); - }); -}); diff --git a/tests/fixtures/app/javascript/output/tests/unit/services/experiments-test.js b/tests/fixtures/app/javascript/output/tests/unit/services/experiments-test.js deleted file mode 100644 index f5770ec..0000000 --- a/tests/fixtures/app/javascript/output/tests/unit/services/experiments-test.js +++ /dev/null @@ -1,204 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Unit | Service | experiments', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - experiments: { - 'experiment-a': { - control: 0.5, - v1: 0.5, - }, - - 'experiment-b': { - control: 0.4, - v1: 0.3, - v2: 0.3, - }, - }, - }); - - hooks.beforeEach(function () { - this.experiments = this.owner.lookup('service:experiments'); - }); - - module('cachedVariants', function () { - test('returns an object, with each experiment mapped to undefined', function (assert) { - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': undefined, - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('getVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.getVariant('experiment-c'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: experiment-c is an unknown experiment. Please define the experiment in the config service.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('returns a variant at random when called initially', function (assert) { - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - - test('returns the cached variant when called again', function (assert) { - // Check one experiment - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('setVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.setVariant('experiment-a', 'v2'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: v2 is an unknown variant for experiment-a. Please check for typos.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('can be used to deterministically set the variant', function (assert) { - this.experiments.setVariant('experiment-a', 'v1'); - - assert.strictEqual( - this.experiments.getVariant('experiment-a'), - 'v1', - 'We get the correct value for variant.' - ); - }); - }); -}); diff --git a/tests/fixtures/app/sass/index.ts b/tests/fixtures/app/sass/index.ts deleted file mode 100644 index 1ee7fdd..0000000 --- a/tests/fixtures/app/sass/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('app/sass/input'); -const outputProject = convertFixtureToJson('app/sass/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/app/sass/input/app/application/adapter.js b/tests/fixtures/app/sass/input/app/application/adapter.js deleted file mode 100644 index 09a6c6c..0000000 --- a/tests/fixtures/app/sass/input/app/application/adapter.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPIAdapter from '@ember-data/adapter/json-api'; - -export default class ApplicationAdapter extends JSONAPIAdapter {} diff --git a/tests/fixtures/app/sass/input/app/application/route.js b/tests/fixtures/app/sass/input/app/application/route.js deleted file mode 100644 index 0a89bde..0000000 --- a/tests/fixtures/app/sass/input/app/application/route.js +++ /dev/null @@ -1,10 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ApplicationRoute extends Route { - @service intl; - - beforeModel() { - this.intl.setLocale(['en-us']); - } -} diff --git a/tests/fixtures/app/sass/input/app/application/serializer.js b/tests/fixtures/app/sass/input/app/application/serializer.js deleted file mode 100644 index 2341d47..0000000 --- a/tests/fixtures/app/sass/input/app/application/serializer.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPISerializer from '@ember-data/serializer/json-api'; - -export default class ApplicationSerializer extends JSONAPISerializer {} diff --git a/tests/fixtures/app/sass/input/app/application/styles.scss b/tests/fixtures/app/sass/input/app/application/styles.scss deleted file mode 100644 index 16fae37..0000000 --- a/tests/fixtures/app/sass/input/app/application/styles.scss +++ /dev/null @@ -1,55 +0,0 @@ -.application { - display: grid; - grid-template-areas: - ". header ." - "main main main" - ". footer ."; - grid-template-columns: 1fr minmax(auto, 75rem) 1fr; - grid-template-rows: auto 1fr auto; - height: 100%; - overflow: hidden; - width: 100vw; -} - -.header { - grid-area: header; - min-height: 2.75rem; - overflow-x: auto; -} - -.main { - background-color: rgb(255 255 255 / 4.5%); - border-bottom: 0.0625rem solid rgb(211 211 211 / 15%); - border-top: 0.0625rem solid rgb(211 211 211 / 15%); - display: flex; - flex: 1; - grid-area: main; - justify-content: center; - overflow-y: hidden; -} - -.center { - display: flex; - flex-direction: column; - max-width: 75rem; - overflow-y: auto; - width: 100%; -} - -.footer { - align-items: center; - display: flex; - grid-area: footer; - justify-content: center; - min-height: 2.375rem; -} - -.copyright { - color: rgb(128 191 255 / 90%); - font-size: 0.75rem; - padding: 0.75rem 0; -} - -.copyright a { - color: rgb(128 191 255 / 90%); -} diff --git a/tests/fixtures/app/sass/input/app/application/template.hbs b/tests/fixtures/app/sass/input/app/application/template.hbs deleted file mode 100644 index 57bb661..0000000 --- a/tests/fixtures/app/sass/input/app/application/template.hbs +++ /dev/null @@ -1,47 +0,0 @@ -{{page-title (t "routes.application.app-name")}} - -
-
- - - -
- -
-
- {{outlet}} -
-
- -
- - {{t "routes.application.copyright" htmlSafe=true}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/product/card/styles.scss b/tests/fixtures/app/sass/input/app/components/product/card/styles.scss deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/card/styles.scss +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/app/sass/input/app/components/product/card/template.hbs b/tests/fixtures/app/sass/input/app/components/product/card/template.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/card/template.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/product/details/component.js b/tests/fixtures/app/sass/input/app/components/product/details/component.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/details/component.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/app/sass/input/app/components/product/details/styles.scss b/tests/fixtures/app/sass/input/app/components/product/details/styles.scss deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/details/styles.scss +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/app/sass/input/app/components/product/details/template.hbs b/tests/fixtures/app/sass/input/app/components/product/details/template.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/details/template.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/product/image/component.js b/tests/fixtures/app/sass/input/app/components/product/image/component.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/image/component.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/app/sass/input/app/components/product/image/styles.scss b/tests/fixtures/app/sass/input/app/components/product/image/styles.scss deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/image/styles.scss +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/app/sass/input/app/components/product/image/template.hbs b/tests/fixtures/app/sass/input/app/components/product/image/template.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/app/sass/input/app/components/product/image/template.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/component.js deleted file mode 100644 index 9cfbe2c..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/component.js +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormCheckboxComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.isChecked, - valueType: 'boolean', - }); - } - - get isChecked() { - const { changeset, key } = this.args; - - return get(changeset, key) ?? undefined; - } - - @action updateValue() { - const { isDisabled, isReadOnly, key, onUpdate } = this.args; - - if (isDisabled || isReadOnly) { - return; - } - - const value = !this.isChecked; - - onUpdate({ key, value }); - } - - @action updateValueByPressingSpace(event) { - if (event.code === 'Space' || event.key === 'Space') { - this.updateValue(); - } - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/styles.scss deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/styles.scss +++ /dev/null @@ -1,37 +0,0 @@ -.checkbox { - align-items: center; - background-color: white; - border: 0.125rem solid #ffd54f; - cursor: pointer; - display: flex; - height: 1rem; - justify-content: center; - position: relative; - width: 1rem; -} - -.checkbox:focus { - background-color: #ffecb3; - outline: 0; -} - -.checkbox:not(:focus) { - border-color: transparent; -} - -.checkbox.is-checked { - background-color: #1976d2; -} - -.checkbox.is-disabled { - background-color: #b2c9d4; - cursor: not-allowed; -} - -.checkmark-icon { - color: white; -} - -.checkbox.is-disabled .checkmark-icon { - color: #546e7a; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/template.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/checkbox/template.hbs +++ /dev/null @@ -1,40 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - {{#if this.isChecked}} - - {{/if}} - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/component.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/component.js +++ /dev/null @@ -1,17 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; -import { TrackedObject } from 'tracked-built-ins'; - -export default class UiFormComponent extends Component { - changeset = new TrackedObject(this.args.data ?? {}); - - @action submitForm(event) { - event.preventDefault(); - - this.args.onSubmit(this.changeset); - } - - @action updateChangeset({ key, value }) { - this.changeset[key] = value; - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/field/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/field/styles.scss deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/field/styles.scss +++ /dev/null @@ -1,83 +0,0 @@ -.container { - align-items: start; - display: grid; -} - -.container:not(.is-wide, .no-feedback) { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field" - "feedback"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr auto; -} - -.container:not(.is-wide).no-feedback { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; -} - -.container.is-wide:not(.no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "label field" - "label feedback"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-wide.no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: "label field"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr; -} - -.label { - grid-area: label; - overflow: hidden; - word-break: break-word; -} - -.field { - grid-area: field; -} - -.feedback { - align-items: center; - display: flex; - font-size: 0.875rem; - grid-area: feedback; -} - -.feedback.is-error { - color: #ff5252; -} - -/* Exceptions for mobile */ -.container.is-inline:not(.is-wide, .no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "field label" - "feedback feedback"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-inline:not(.is-wide).no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0; - grid-template-areas: "field label"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/field/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/field/template.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/field/template.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{#let (unique-id) as |inputId|}} -
-
- {{yield (hash inputId=inputId) to="label"}} -
- -
- {{yield (hash inputId=inputId) to="field"}} -
- - {{#if @errorMessage}} -
- {{@errorMessage}} -
- {{/if}} -
-{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/information/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/information/styles.scss deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/information/styles.scss +++ /dev/null @@ -1,16 +0,0 @@ -.container { - margin-bottom: 1rem; -} - -.title { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -.instructions { - font-size: 0.9rem; - font-weight: 300; - line-height: 1.25rem; - margin-bottom: 0.5rem; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/information/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/information/template.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/information/template.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{#if (or @title @instructions)}} -
- {{#if @title}} -
- {{@title}} -
- {{/if}} - - {{#if @instructions}} -

- {{@instructions}} -

- {{/if}} -
-{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/input/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/input/component.js deleted file mode 100644 index 7fd3558..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/input/component.js +++ /dev/null @@ -1,42 +0,0 @@ -import { assert } from '@ember/debug'; -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormInputComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get type() { - const { type } = this.args; - - assert( - 'To render a number input, please use instead.', - type !== 'number' - ); - - return this.args.type ?? 'text'; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/input/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/input/styles.scss deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/input/styles.scss +++ /dev/null @@ -1,24 +0,0 @@ -.input { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.input:focus { - background-color: #ffecb3; - outline: 0; -} - -.input:not(:focus) { - border-color: transparent; -} - -.input::placeholder { - font-style: italic; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/input/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/input/template.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/input/template.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/number/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/number/component.js deleted file mode 100644 index 69b12c0..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/number/component.js +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormNumberComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'number', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - const valueAsNumber = Number.parseFloat(value); - - if (Number.isNaN(valueAsNumber)) { - onUpdate({ key, value: undefined }); - return; - } - - onUpdate({ key, value: valueAsNumber }); - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/number/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/number/styles.scss deleted file mode 100644 index f24ae8e..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/number/styles.scss +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-app/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/number/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/number/template.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/number/template.hbs +++ /dev/null @@ -1,34 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/select/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/select/component.js deleted file mode 100644 index efc8007..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/select/component.js +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormSelectComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get options() { - return this.args.options ?? []; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action resetValue() { - const { key, onUpdate } = this.args; - - onUpdate({ key, value: undefined }); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/select/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/select/styles.scss deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/select/styles.scss +++ /dev/null @@ -1,33 +0,0 @@ -.select-container { - display: grid; - grid-column-gap: 0.75rem; - grid-template-areas: "select clear-button"; - grid-template-columns: 1fr auto; - grid-template-rows: 1fr; -} - -.select { - border: 0.125rem solid #ffd54f; - grid-area: select; - padding: 0.125rem 0.25rem; - width: 100%; -} - -.select:focus { - background-color: #ffecb3; - outline: 0; -} - -.select:not(:focus) { - border-color: transparent; -} - -.select.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} - -.clear-button { - grid-area: clear-button; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/select/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/select/template.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/select/template.hbs +++ /dev/null @@ -1,79 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> -
- - - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/styles.scss deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/styles.scss +++ /dev/null @@ -1,19 +0,0 @@ -.form { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - padding: 1.25rem 1.5rem; -} - -.actions { - align-items: center; - display: flex; - justify-content: flex-end; - margin-top: 2rem; -} - -.submit-button { - padding: 0.5rem 3rem; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/template.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/template.hbs +++ /dev/null @@ -1,70 +0,0 @@ -{{#let (unique-id) as |formId|}} -
- - - - {{yield - (hash - Checkbox=(component - "ui/form/checkbox" - changeset=this.changeset - isInline=true - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Input=(component - "ui/form/input" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Number=(component - "ui/form/number" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Select=(component - "ui/form/select" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Textarea=(component - "ui/form/textarea" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - ) - }} - - -
- -
- -{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/component.js b/tests/fixtures/app/sass/input/app/components/ui/form/textarea/component.js deleted file mode 100644 index 29c258e..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/component.js +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormTextareaComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/form/textarea/styles.scss deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/styles.scss +++ /dev/null @@ -1,24 +0,0 @@ -.textarea { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.textarea:focus { - background-color: #ffecb3; - outline: 0; -} - -.textarea:not(:focus) { - border-color: transparent; -} - -.textarea::placeholder { - font-style: italic; -} - -.textarea.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/form/textarea/template.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/form/textarea/template.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/components/ui/page/styles.scss b/tests/fixtures/app/sass/input/app/components/ui/page/styles.scss deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/page/styles.scss +++ /dev/null @@ -1,20 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "body"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; - height: calc(100% - 3em); - overflow-y: auto; - padding: 1.5rem 1rem; - scrollbar-gutter: stable; -} - -.header { - grid-area: header; -} - -.body { - grid-area: body; -} diff --git a/tests/fixtures/app/sass/input/app/components/ui/page/template.hbs b/tests/fixtures/app/sass/input/app/components/ui/page/template.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/app/sass/input/app/components/ui/page/template.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/config/service.js b/tests/fixtures/app/sass/input/app/config/service.js deleted file mode 100644 index acc692f..0000000 --- a/tests/fixtures/app/sass/input/app/config/service.js +++ /dev/null @@ -1,25 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; -import config from 'my-app/config/environment'; - -export default class ConfigService extends Service { - customization = { - experiments: { - 'nest-product-details': { - control: 0.5, - v1: 0.5, - }, - - 'subscribe-to-ember-times': { - control: 0.7, - v1: 0.3, - }, - }, - }; - - isTestEnvironment = config.environment === 'test'; - - getValue(key) { - return get(this.customization, key); - } -} diff --git a/tests/fixtures/app/sass/input/app/experiments/service.js b/tests/fixtures/app/sass/input/app/experiments/service.js deleted file mode 100644 index 83cdf3c..0000000 --- a/tests/fixtures/app/sass/input/app/experiments/service.js +++ /dev/null @@ -1,82 +0,0 @@ -import { assert } from '@ember/debug'; -import Service, { service } from '@ember/service'; -import { cached } from '@glimmer/tracking'; - -export default class ExperimentsService extends Service { - @service config; - - @cached get cdfs() { - const experiments = this.config.getValue('experiments') ?? {}; - const cdfs = new Map(); - - for (const [experimentName, pdf] of Object.entries(experiments)) { - const cdf = new Map(); - let total = 0; - - for (const [variant, probability] of Object.entries(pdf)) { - total += probability; - cdf.set(variant, total); - } - - cdfs.set(experimentName, cdf); - } - - return cdfs; - } - - constructor() { - super(...arguments); - - this.#initializeVariants(); - } - - getVariant(experimentName) { - assert( - `${experimentName} is an unknown experiment. Please define the experiment in the config service.`, - this.cdfs.has(experimentName) - ); - - const cachedVariant = this.cachedVariants[experimentName]; - - if (cachedVariant) { - return cachedVariant; - } - - this.#determineVariant(experimentName); - - return this.cachedVariants[experimentName]; - } - - setVariant(experimentName, variant) { - const cdf = this.cdfs.get(experimentName); - - assert( - `${variant} is an unknown variant for ${experimentName}. Please check for typos.`, - cdf.has(variant) - ); - - this.cachedVariants[experimentName] = variant; - } - - #determineVariant(experimentName) { - const cdf = this.cdfs.get(experimentName); - const sample = Math.random(); - - for (const [variant, total] of cdf.entries()) { - if (sample < total) { - this.setVariant(experimentName, variant); - break; - } - } - } - - #initializeVariants() { - const cachedVariants = {}; - - this.cdfs.forEach((cdf, experimentName) => { - cachedVariants[experimentName] = undefined; - }); - - this.cachedVariants = cachedVariants; - } -} diff --git a/tests/fixtures/app/sass/input/app/form/controller.js b/tests/fixtures/app/sass/input/app/form/controller.js deleted file mode 100644 index 816335a..0000000 --- a/tests/fixtures/app/sass/input/app/form/controller.js +++ /dev/null @@ -1,44 +0,0 @@ -import Controller from '@ember/controller'; -import { service } from '@ember/service'; -import { dropTask } from 'ember-concurrency'; -import fetch from 'fetch'; -import { generateBody } from 'my-app/utils/fetch'; - -export default class FormController extends Controller { - @service experiments; - - get initialData() { - if (this.isPartOfSubscribeToEmberTimesExperiment) { - return { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }; - } - - return { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }; - } - - get isPartOfSubscribeToEmberTimesExperiment() { - return this.experiments.getVariant('subscribe-to-ember-times') === 'v1'; - } - - submitForm = dropTask(async (data) => { - try { - const body = generateBody(data); - - await fetch('/contact-me', { - body, - method: 'POST', - }); - } catch (e) { - throw new Error(e); - } - }); -} diff --git a/tests/fixtures/app/sass/input/app/form/route.js b/tests/fixtures/app/sass/input/app/form/route.js deleted file mode 100644 index df63a89..0000000 --- a/tests/fixtures/app/sass/input/app/form/route.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class FormRoute extends Route {} diff --git a/tests/fixtures/app/sass/input/app/form/styles.scss b/tests/fixtures/app/sass/input/app/form/styles.scss deleted file mode 100644 index 8ba2936..0000000 --- a/tests/fixtures/app/sass/input/app/form/styles.scss +++ /dev/null @@ -1,7 +0,0 @@ -.field { - margin-bottom: 1.25rem; -} - -.field:last-of-type { - margin-bottom: 0; -} diff --git a/tests/fixtures/app/sass/input/app/form/template.hbs b/tests/fixtures/app/sass/input/app/form/template.hbs deleted file mode 100644 index af78c5e..0000000 --- a/tests/fixtures/app/sass/input/app/form/template.hbs +++ /dev/null @@ -1,76 +0,0 @@ -{{page-title (t "routes.form.title")}} - - - -
- -
- -
- -
- -
- -
- - {{#if this.isPartOfSubscribeToEmberTimesExperiment}} -
- -
- - {{else}} -
- -
- - {{/if}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/index/route.js b/tests/fixtures/app/sass/input/app/index/route.js deleted file mode 100644 index accaec9..0000000 --- a/tests/fixtures/app/sass/input/app/index/route.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class IndexRoute extends Route {} diff --git a/tests/fixtures/app/sass/input/app/index/styles.scss b/tests/fixtures/app/sass/input/app/index/styles.scss deleted file mode 100644 index ea2d8d7..0000000 --- a/tests/fixtures/app/sass/input/app/index/styles.scss +++ /dev/null @@ -1,3 +0,0 @@ -.container { - padding: 1.5rem 1rem; -} diff --git a/tests/fixtures/app/sass/input/app/index/template.hbs b/tests/fixtures/app/sass/input/app/index/template.hbs deleted file mode 100644 index a5b7cf9..0000000 --- a/tests/fixtures/app/sass/input/app/index/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ - -

- {{t "routes.index.description" htmlSafe=true}} -

-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/product-details/route.js b/tests/fixtures/app/sass/input/app/product-details/route.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/app/sass/input/app/product-details/route.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/sass/input/app/product-details/styles.scss b/tests/fixtures/app/sass/input/app/product-details/styles.scss deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/app/sass/input/app/product-details/styles.scss +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/app/sass/input/app/product-details/template.hbs b/tests/fixtures/app/sass/input/app/product-details/template.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/app/sass/input/app/product-details/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/product/model.js b/tests/fixtures/app/sass/input/app/product/model.js deleted file mode 100644 index 3c6dd3d..0000000 --- a/tests/fixtures/app/sass/input/app/product/model.js +++ /dev/null @@ -1,11 +0,0 @@ -import Model, { attr } from '@ember-data/model'; - -export default class ProductModel extends Model { - @attr description; - @attr imageUrl; - @attr name; - @attr price; - @attr rating; - @attr seller; - @attr shortDescription; -} diff --git a/tests/fixtures/app/sass/input/app/products/controller.js b/tests/fixtures/app/sass/input/app/products/controller.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/app/sass/input/app/products/controller.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/app/sass/input/app/products/product/route.js b/tests/fixtures/app/sass/input/app/products/product/route.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/app/sass/input/app/products/product/route.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/sass/input/app/products/product/styles.scss b/tests/fixtures/app/sass/input/app/products/product/styles.scss deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/app/sass/input/app/products/product/styles.scss +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/app/sass/input/app/products/product/template.hbs b/tests/fixtures/app/sass/input/app/products/product/template.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/app/sass/input/app/products/product/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/products/route.js b/tests/fixtures/app/sass/input/app/products/route.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/app/sass/input/app/products/route.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/app/sass/input/app/products/styles.scss b/tests/fixtures/app/sass/input/app/products/styles.scss deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/app/sass/input/app/products/styles.scss +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/app/sass/input/app/products/template.hbs b/tests/fixtures/app/sass/input/app/products/template.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/app/sass/input/app/products/template.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/input/app/styles/app.scss b/tests/fixtures/app/sass/input/app/styles/app.scss deleted file mode 100644 index 210d088..0000000 --- a/tests/fixtures/app/sass/input/app/styles/app.scss +++ /dev/null @@ -1,109 +0,0 @@ -html { - font-size: 16px; - height: 100%; -} - -body { - background-color: #020e1c; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-weight: 400; - height: 100%; - letter-spacing: 0.03rem; - margin: 0; -} - -* { - margin: 0; - padding: 0; -} - -h1 { - font-size: 2.25em; - font-weight: 700; - margin-bottom: 1.5rem; -} - -h2 { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -h3 { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -h4 { - font-size: 1rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -a { - color: rgb(245 255 250 / 88%); -} - -button { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - padding: 0.25rem 0.5rem; -} - -button:hover { - background-color: rgb(255 255 255 / 22.5%); - cursor: pointer; - transition: background-color 0.17s; -} - -input { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -p { - margin-bottom: 0.75rem; -} - -select { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -table { - border-collapse: collapse; - width: 100%; -} - -textarea { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -th, -td { - border: 0.0625rem solid rgb(112 128 144 / 100%); - padding: 0.25rem 0.5rem; -} - -ul { - list-style-type: none; -} - -/* stylelint-disable selector-pseudo-class-no-unknown */ -:global(#ember-testing-container) { - overflow: hidden !important; -} - -:global(#ember-testing) { - background-color: #020e1c !important; -} diff --git a/tests/fixtures/app/sass/input/app/utils/components/form/index.js b/tests/fixtures/app/sass/input/app/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/app/sass/input/app/utils/components/form/index.js +++ /dev/null @@ -1,26 +0,0 @@ -export function generateErrorMessage({ options = {}, value, valueType }) { - const { isRequired } = options; - - if (isRequired) { - switch (valueType) { - case 'boolean': { - if (value === undefined || value === false) { - return 'Please select the checkbox.'; - } - - break; - } - - case 'number': - case 'string': { - if (value === undefined || value === '') { - return 'Please provide a value.'; - } - - break; - } - } - } - - return undefined; -} diff --git a/tests/fixtures/app/sass/input/app/utils/fetch.js b/tests/fixtures/app/sass/input/app/utils/fetch.js deleted file mode 100644 index 0e5ef3f..0000000 --- a/tests/fixtures/app/sass/input/app/utils/fetch.js +++ /dev/null @@ -1,11 +0,0 @@ -function replacer(key, value) { - if (typeof value === 'undefined') { - return null; - } - - return value; -} - -export function generateBody(data = {}) { - return JSON.stringify(data, replacer); -} diff --git a/tests/fixtures/app/sass/input/package.json b/tests/fixtures/app/sass/input/package.json deleted file mode 100644 index 1692de1..0000000 --- a/tests/fixtures/app/sass/input/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "my-app", - "version": "0.0.0" -} diff --git a/tests/fixtures/app/sass/input/tests/helpers/components/form/index.js b/tests/fixtures/app/sass/input/tests/helpers/components/form/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/app/sass/input/tests/helpers/components/form/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { assert } from '@ember/debug'; -import { find, select } from '@ember/test-helpers'; - -export async function selectByLabel(selector, label) { - const option = find(`[data-test-option="${label}"]`); - - assert(`${label} is an unknown option. Please check for typos.`, option); - - await select(selector, option.value); -} diff --git a/tests/fixtures/app/sass/input/tests/helpers/index.js b/tests/fixtures/app/sass/input/tests/helpers/index.js deleted file mode 100644 index 432eab0..0000000 --- a/tests/fixtures/app/sass/input/tests/helpers/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from 'my-app/tests/helpers/components/ui/form'; -export * from 'my-app/tests/helpers/services/config'; -export * from 'my-app/tests/helpers/services/experiments'; diff --git a/tests/fixtures/app/sass/input/tests/helpers/services/config.js b/tests/fixtures/app/sass/input/tests/helpers/services/config.js deleted file mode 100644 index a5f0e5e..0000000 --- a/tests/fixtures/app/sass/input/tests/helpers/services/config.js +++ /dev/null @@ -1,23 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; - -export function setupConfigService(hooks, customization = {}) { - hooks.beforeEach(function () { - this.owner.register( - 'service:config', - class ConfigService extends Service { - customization = customization; - - isTestEnvironment = true; - - getValue(key) { - return get(this.customization, key); - } - } - ); - }); - - hooks.afterEach(function () { - this.owner.unregister('service:config'); - }); -} diff --git a/tests/fixtures/app/sass/input/tests/helpers/services/experiments.js b/tests/fixtures/app/sass/input/tests/helpers/services/experiments.js deleted file mode 100644 index 017f498..0000000 --- a/tests/fixtures/app/sass/input/tests/helpers/services/experiments.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getContext } from '@ember/test-helpers'; - -export function assignVariants(mapping = {}) { - const { owner } = getContext(); - const experiments = owner.lookup('service:experiments'); - - for (const [experimentName, variant] of Object.entries(mapping)) { - experiments.setVariant(experimentName, variant); - } -} diff --git a/tests/fixtures/app/sass/input/tests/integration/components/navigation-menu/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/navigation-menu/component-test.js deleted file mode 100644 index 53d5827..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/navigation-menu/component-test.js +++ /dev/null @@ -1,45 +0,0 @@ -import { findAll, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | navigation-menu', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a navigation menu', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-nav="Main Navigation"]') - .hasAria( - 'label', - 'Main Navigation', - 'We can pass @name to specify the navigation.' - ) - .hasTagName('nav', 'We see the correct tag name.'); - - const links = findAll('[data-test-link]'); - - assert.strictEqual(links.length, 1, 'We see 1 link.'); - - assert - .dom(links[0]) - .hasAttribute('href', '/', 'We see the correct href for the 1st link.') - .hasText('Home', 'We see the correct label for the 1st link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/product/card/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/product/card/component-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/product/card/component-test.js +++ /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/app/sass/input/tests/integration/components/product/details/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/product/details/component-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/product/details/component-test.js +++ /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/app/sass/input/tests/integration/components/product/image/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/product/image/component-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/product/image/component-test.js +++ /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/app/sass/input/tests/integration/components/ui/form/checkbox/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/checkbox/component-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/checkbox/component-test.js +++ /dev/null @@ -1,209 +0,0 @@ -import { set } from '@ember/object'; -import { click, render, triggerKeyEvent } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/checkbox', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: true, - }; - }); - - test('The component renders a label and a checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Subscribe to The Ember Times?', 'We see the correct label.'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('disabled', 'false', 'The checkbox should be enabled.') - .hasAria('readonly', 'false', 'The checkbox should not be readonly.') - .hasAria('required', 'false', 'The checkbox should not be required.') - .hasAttribute('role', 'checkbox', 'We see the correct role.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.') - .hasTagName('span', 'We see the correct tag name.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .doesNotHaveAttribute('tabindex', 'The checkbox should not be focusable.') - .hasAria('disabled', 'true', 'The checkbox is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('readonly', 'true', 'We see the aria-readonly attribute.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Subscribe to The Ember Times? *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('required', 'true', 'The checkbox is required.'); - }); - - test('We can click on the checkbox to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Click the checkbox - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Click the checkbox again - expectedValue = true; - - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can press the Space key to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Press the Space key - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Press the Space key again - expectedValue = true; - - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/component-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/component-test.js +++ /dev/null @@ -1,179 +0,0 @@ -import { click, fillIn, find, 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 | ui/form', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - test('The component renders a form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - const titleId = find('[data-test-title]').getAttribute('id'); - const instructionsId = find('[data-test-instructions]').getAttribute('id'); - - assert - .dom('[data-test-form="Contact me"]') - .hasAria( - 'describedby', - instructionsId, - 'We see the correct aria-describedby.' - ) - .hasAria('labelledby', titleId, 'We see the correct aria-labelledby.'); - - assert.dom('[data-test-field]').exists({ count: 5 }, 'We see 5 fields.'); - - assert - .dom('[data-test-button="Submit"]') - .hasAttribute('type', 'submit', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Submit', 'We see the submit button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can submit the form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - await fillIn('[data-test-field="Name"]', 'Zoey'); - await fillIn('[data-test-field="Email"]', 'zoey@emberjs.com'); - await fillIn('[data-test-field="Message"]', 'Gude!'); - await click('[data-test-field="Subscribe to The Ember Times?"]'); - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - await click('[data-test-button="Submit"]'); - - assert.true( - this.submitForm.calledOnceWith({ - donation: 10000, - email: 'zoey@emberjs.com', - message: 'Gude!', - name: 'Zoey', - subscribe: false, - }), - 'We called @onSubmit once.' - ); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/field/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/field/component-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/field/component-test.js +++ /dev/null @@ -1,74 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/field', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the field layout', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert.dom('[data-test-label]').hasText('Name', 'We see the label.'); - - assert.dom('[data-test-field="Name"]').hasValue('', 'We see the field.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can pass @errorMessage to show an error message', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see the error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/information/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/information/component-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/information/component-test.js +++ /dev/null @@ -1,63 +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 | ui/form/information', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders nothing when we do not pass @title or @instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @title to display the form title', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .hasAttribute('id', 'ember123-title', 'We see the correct ID.') - .hasText('Contact me', 'We see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @instructions to display the form instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .hasAttribute('id', 'ember123-instructions', 'We see the correct ID.') - .hasText( - 'Still have questions about ember-container-query? Try sending me a message.', - 'We see the form instructions.' - ); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/input/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/input/component-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/input/component-test.js +++ /dev/null @@ -1,169 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/input', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name', 'We see the correct label.'); - - assert - .dom('[data-test-field="Name"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'text', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('Zoey', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert.dom('[data-test-field="Name"]').isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('Zoey', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name *', 'The label shows that the field is required.'); - - assert.dom('[data-test-field="Name"]').isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Name"]', ''); - - assert - .dom('[data-test-field="Name"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Tomster'; - - await fillIn('[data-test-field="Name"]', 'Tomster'); - - assert - .dom('[data-test-field="Name"]') - .hasValue('Tomster', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @type to create an email input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Email', 'We see the correct label.'); - - assert - .dom('[data-test-field="Email"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'email', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('zoey@emberjs.com', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/number/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/number/component-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/number/component-test.js +++ /dev/null @@ -1,159 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/number', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - donation: 1000, - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Donation amount ($)', 'We see the correct label.'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'number', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('1000', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('1000', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Donation amount ($) *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = undefined; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Donation amount ($)"]', ''); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 10000; - - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('10000', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/select/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/select/component-test.js deleted file mode 100644 index 20ea0b9..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/select/component-test.js +++ /dev/null @@ -1,244 +0,0 @@ -import { set } from '@ember/object'; -import { click, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { selectByLabel } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/select', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.changeset = { - sortBy: 'name:asc', - }; - - this.optionsForSorting = [ - { - label: 'Name: A to Z', - value: 'name:asc', - }, - { - label: 'Name: Z to A', - value: 'name:desc', - }, - { - label: 'Price: Low to High', - value: 'price:asc', - }, - { - label: 'Price: High to Low', - value: 'price:desc', - }, - ]; - }); - - test('The component renders a label and a select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('name:asc', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 4 }, 'We see 4 options.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Name: A to Z', 'We see the correct selected option.'); - - assert - .dom('[data-test-button="Clear"]') - .hasAria( - 'label', - 'Clear option for Sort by', - 'We see the correct aria-label.' - ) - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('✕', 'we see the correct label.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('The component renders when @options is undefined', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 0 }, 'We see 0 options.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('name:asc', 'We see the correct value.') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Sort by"]') - .isRequired('The select is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(5); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - 'price:desc', - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await selectByLabel('[data-test-field="Sort by"]', 'Price: High to Low'); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('price:desc', 'We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Price: High to Low', 'We see the correct selected option.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can click on the clear button to reset the option', async function (assert) { - assert.expect(4); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - undefined, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await click('[data-test-button="Clear"]'); - - assert - .dom('[data-test-field="Sort by"]') - .hasNoValue('We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .doesNotExist('We should not see a selected option.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/textarea/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/form/textarea/component-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/form/textarea/component-test.js +++ /dev/null @@ -1,144 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/textarea', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and a textarea', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message', 'We see the correct label.'); - - assert - .dom('[data-test-field="Message"]') - .doesNotHaveAttribute('readonly', 'The textarea should not be readonly.') - .hasTagName('textarea', 'We see the correct tag name.') - .hasValue('I 🧡 container queries!', 'We see the correct value.') - .isEnabled('The textarea should be enabled.') - .isNotRequired('The textarea should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the text area', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .isDisabled('The textarea is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('I 🧡 container queries!', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Message"]') - .isRequired('The textarea is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Message"]', ''); - - assert - .dom('[data-test-field="Message"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Keep up the good work!'; - - await fillIn('[data-test-field="Message"]', 'Keep up the good work!'); - - assert - .dom('[data-test-field="Message"]') - .hasValue('Keep up the good work!', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/integration/components/ui/page/component-test.js b/tests/fixtures/app/sass/input/tests/integration/components/ui/page/component-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/app/sass/input/tests/integration/components/ui/page/component-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/page', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the page layout', async function (assert) { - await render(hbs` - -
- Content goes here. -
-
- `); - - assert.dom('h1').hasText('Forms', 'We see the title.'); - - assert.dom('[data-test-content]').exists('We see the yielded content.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/application/route-test.js b/tests/fixtures/app/sass/input/tests/unit/application/route-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/application/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/config/service-test.js b/tests/fixtures/app/sass/input/tests/unit/config/service-test.js deleted file mode 100644 index 8026782..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/config/service-test.js +++ /dev/null @@ -1,54 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Service | config', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - key: { - child: { - grandchild: 'value', - }, - }, - }); - - hooks.beforeEach(function () { - this.config = this.owner.lookup('service:config'); - }); - - module('getValue', function () { - test('returns the value of a key', function (assert) { - assert.deepEqual( - this.config.getValue('key'), - { - child: { - grandchild: 'value', - }, - }, - 'We get the correct value.' - ); - }); - - test('returns the value of a nested key', function (assert) { - assert.deepEqual( - this.config.getValue('key.child'), - { - grandchild: 'value', - }, - 'We get the correct value. (1)' - ); - - assert.strictEqual( - this.config.getValue('key.child.grandchild'), - 'value', - 'We get the correct value. (2)' - ); - }); - }); - - module('isTestEnvironment', function () { - test('returns true in the test environment', function (assert) { - assert.true(this.config.isTestEnvironment, 'We get the correct value.'); - }); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/controllers/form/controller-test.js b/tests/fixtures/app/sass/input/tests/unit/controllers/form/controller-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/controllers/form/controller-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/controllers/products/controller-test.js b/tests/fixtures/app/sass/input/tests/unit/controllers/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/controllers/products/controller-test.js +++ /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/app/sass/input/tests/unit/experiments/service-test.js b/tests/fixtures/app/sass/input/tests/unit/experiments/service-test.js deleted file mode 100644 index f5770ec..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/experiments/service-test.js +++ /dev/null @@ -1,204 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Unit | Service | experiments', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - experiments: { - 'experiment-a': { - control: 0.5, - v1: 0.5, - }, - - 'experiment-b': { - control: 0.4, - v1: 0.3, - v2: 0.3, - }, - }, - }); - - hooks.beforeEach(function () { - this.experiments = this.owner.lookup('service:experiments'); - }); - - module('cachedVariants', function () { - test('returns an object, with each experiment mapped to undefined', function (assert) { - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': undefined, - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('getVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.getVariant('experiment-c'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: experiment-c is an unknown experiment. Please define the experiment in the config service.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('returns a variant at random when called initially', function (assert) { - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - - test('returns the cached variant when called again', function (assert) { - // Check one experiment - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('setVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.setVariant('experiment-a', 'v2'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: v2 is an unknown variant for experiment-a. Please check for typos.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('can be used to deterministically set the variant', function (assert) { - this.experiments.setVariant('experiment-a', 'v1'); - - assert.strictEqual( - this.experiments.getVariant('experiment-a'), - 'v1', - 'We get the correct value for variant.' - ); - }); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/form/controller-test.js b/tests/fixtures/app/sass/input/tests/unit/form/controller-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/form/controller-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/form/route-test.js b/tests/fixtures/app/sass/input/tests/unit/form/route-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/form/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/index/route-test.js b/tests/fixtures/app/sass/input/tests/unit/index/route-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/index/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/product-details/route-test.js b/tests/fixtures/app/sass/input/tests/unit/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/product-details/route-test.js +++ /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/sass/input/tests/unit/products/controller-test.js b/tests/fixtures/app/sass/input/tests/unit/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/products/controller-test.js +++ /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/app/sass/input/tests/unit/products/product/route-test.js b/tests/fixtures/app/sass/input/tests/unit/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/products/route-test.js b/tests/fixtures/app/sass/input/tests/unit/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/routes/application/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/application/route-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/application/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/routes/form/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/form/route-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/form/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/routes/index/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/index/route-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/index/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/routes/product-details/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/product-details/route-test.js +++ /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/sass/input/tests/unit/routes/products/product/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/input/tests/unit/routes/products/route-test.js b/tests/fixtures/app/sass/input/tests/unit/routes/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/sass/input/tests/unit/routes/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/app/adapters/application.js b/tests/fixtures/app/sass/output/app/adapters/application.js deleted file mode 100644 index 09a6c6c..0000000 --- a/tests/fixtures/app/sass/output/app/adapters/application.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPIAdapter from '@ember-data/adapter/json-api'; - -export default class ApplicationAdapter extends JSONAPIAdapter {} diff --git a/tests/fixtures/app/sass/output/app/components/product/card.hbs b/tests/fixtures/app/sass/output/app/components/product/card.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/card.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/product/card.scss b/tests/fixtures/app/sass/output/app/components/product/card.scss deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/card.scss +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/app/sass/output/app/components/product/details.hbs b/tests/fixtures/app/sass/output/app/components/product/details.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/details.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/product/details.js b/tests/fixtures/app/sass/output/app/components/product/details.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/details.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/app/sass/output/app/components/product/details.scss b/tests/fixtures/app/sass/output/app/components/product/details.scss deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/details.scss +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/app/sass/output/app/components/product/image.hbs b/tests/fixtures/app/sass/output/app/components/product/image.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/image.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/product/image.js b/tests/fixtures/app/sass/output/app/components/product/image.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/image.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/app/sass/output/app/components/product/image.scss b/tests/fixtures/app/sass/output/app/components/product/image.scss deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/app/sass/output/app/components/product/image.scss +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form.hbs b/tests/fixtures/app/sass/output/app/components/ui/form.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form.hbs +++ /dev/null @@ -1,70 +0,0 @@ -{{#let (unique-id) as |formId|}} -
- - - - {{yield - (hash - Checkbox=(component - "ui/form/checkbox" - changeset=this.changeset - isInline=true - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Input=(component - "ui/form/input" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Number=(component - "ui/form/number" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Select=(component - "ui/form/select" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - Textarea=(component - "ui/form/textarea" - changeset=this.changeset - isWide=CQ.features.wide - onUpdate=this.updateChangeset - ) - ) - }} - - -
- -
- -{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form.js b/tests/fixtures/app/sass/output/app/components/ui/form.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form.js +++ /dev/null @@ -1,17 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; -import { TrackedObject } from 'tracked-built-ins'; - -export default class UiFormComponent extends Component { - changeset = new TrackedObject(this.args.data ?? {}); - - @action submitForm(event) { - event.preventDefault(); - - this.args.onSubmit(this.changeset); - } - - @action updateChangeset({ key, value }) { - this.changeset[key] = value; - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form.scss b/tests/fixtures/app/sass/output/app/components/ui/form.scss deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form.scss +++ /dev/null @@ -1,19 +0,0 @@ -.form { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - padding: 1.25rem 1.5rem; -} - -.actions { - align-items: center; - display: flex; - justify-content: flex-end; - margin-top: 2rem; -} - -.submit-button { - padding: 0.5rem 3rem; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.hbs +++ /dev/null @@ -1,40 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - {{#if this.isChecked}} - - {{/if}} - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.js b/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.js deleted file mode 100644 index 9cfbe2c..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.js +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormCheckboxComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.isChecked, - valueType: 'boolean', - }); - } - - get isChecked() { - const { changeset, key } = this.args; - - return get(changeset, key) ?? undefined; - } - - @action updateValue() { - const { isDisabled, isReadOnly, key, onUpdate } = this.args; - - if (isDisabled || isReadOnly) { - return; - } - - const value = !this.isChecked; - - onUpdate({ key, value }); - } - - @action updateValueByPressingSpace(event) { - if (event.code === 'Space' || event.key === 'Space') { - this.updateValue(); - } - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.scss b/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.scss deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/checkbox.scss +++ /dev/null @@ -1,37 +0,0 @@ -.checkbox { - align-items: center; - background-color: white; - border: 0.125rem solid #ffd54f; - cursor: pointer; - display: flex; - height: 1rem; - justify-content: center; - position: relative; - width: 1rem; -} - -.checkbox:focus { - background-color: #ffecb3; - outline: 0; -} - -.checkbox:not(:focus) { - border-color: transparent; -} - -.checkbox.is-checked { - background-color: #1976d2; -} - -.checkbox.is-disabled { - background-color: #b2c9d4; - cursor: not-allowed; -} - -.checkmark-icon { - color: white; -} - -.checkbox.is-disabled .checkmark-icon { - color: #546e7a; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/field.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/field.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/field.hbs +++ /dev/null @@ -1,27 +0,0 @@ -{{#let (unique-id) as |inputId|}} -
-
- {{yield (hash inputId=inputId) to="label"}} -
- -
- {{yield (hash inputId=inputId) to="field"}} -
- - {{#if @errorMessage}} -
- {{@errorMessage}} -
- {{/if}} -
-{{/let}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/field.scss b/tests/fixtures/app/sass/output/app/components/ui/form/field.scss deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/field.scss +++ /dev/null @@ -1,83 +0,0 @@ -.container { - align-items: start; - display: grid; -} - -.container:not(.is-wide, .no-feedback) { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field" - "feedback"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr auto; -} - -.container:not(.is-wide).no-feedback { - grid-column-gap: 0; - grid-row-gap: 0.5rem; - grid-template-areas: - "label" - "field"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; -} - -.container.is-wide:not(.no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "label field" - "label feedback"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-wide.no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: "label field"; - grid-template-columns: 10rem 1fr; - grid-template-rows: 1fr; -} - -.label { - grid-area: label; - overflow: hidden; - word-break: break-word; -} - -.field { - grid-area: field; -} - -.feedback { - align-items: center; - display: flex; - font-size: 0.875rem; - grid-area: feedback; -} - -.feedback.is-error { - color: #ff5252; -} - -/* Exceptions for mobile */ -.container.is-inline:not(.is-wide, .no-feedback) { - grid-column-gap: 1rem; - grid-row-gap: 0.5rem; - grid-template-areas: - "field label" - "feedback feedback"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr auto; -} - -.container.is-inline:not(.is-wide).no-feedback { - grid-column-gap: 1rem; - grid-row-gap: 0; - grid-template-areas: "field label"; - grid-template-columns: auto 1fr; - grid-template-rows: 1fr; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/information.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/information.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/information.hbs +++ /dev/null @@ -1,23 +0,0 @@ -{{#if (or @title @instructions)}} -
- {{#if @title}} -
- {{@title}} -
- {{/if}} - - {{#if @instructions}} -

- {{@instructions}} -

- {{/if}} -
-{{/if}} \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/information.scss b/tests/fixtures/app/sass/output/app/components/ui/form/information.scss deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/information.scss +++ /dev/null @@ -1,16 +0,0 @@ -.container { - margin-bottom: 1rem; -} - -.title { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -.instructions { - font-size: 0.9rem; - font-weight: 300; - line-height: 1.25rem; - margin-bottom: 0.5rem; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/input.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/input.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/input.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/input.js b/tests/fixtures/app/sass/output/app/components/ui/form/input.js deleted file mode 100644 index 7fd3558..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/input.js +++ /dev/null @@ -1,42 +0,0 @@ -import { assert } from '@ember/debug'; -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormInputComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get type() { - const { type } = this.args; - - assert( - 'To render a number input, please use instead.', - type !== 'number' - ); - - return this.args.type ?? 'text'; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/input.scss b/tests/fixtures/app/sass/output/app/components/ui/form/input.scss deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/input.scss +++ /dev/null @@ -1,24 +0,0 @@ -.input { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.input:focus { - background-color: #ffecb3; - outline: 0; -} - -.input:not(:focus) { - border-color: transparent; -} - -.input::placeholder { - font-style: italic; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/number.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/number.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/number.hbs +++ /dev/null @@ -1,34 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/number.js b/tests/fixtures/app/sass/output/app/components/ui/form/number.js deleted file mode 100644 index 69b12c0..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/number.js +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormNumberComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'number', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - const valueAsNumber = Number.parseFloat(value); - - if (Number.isNaN(valueAsNumber)) { - onUpdate({ key, value: undefined }); - return; - } - - onUpdate({ key, value: valueAsNumber }); - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/number.scss b/tests/fixtures/app/sass/output/app/components/ui/form/number.scss deleted file mode 100644 index f24ae8e..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/number.scss +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-app/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/select.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/select.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/select.hbs +++ /dev/null @@ -1,79 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> -
- - - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/select.js b/tests/fixtures/app/sass/output/app/components/ui/form/select.js deleted file mode 100644 index efc8007..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/select.js +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormSelectComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get options() { - return this.args.options ?? []; - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action resetValue() { - const { key, onUpdate } = this.args; - - onUpdate({ key, value: undefined }); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/select.scss b/tests/fixtures/app/sass/output/app/components/ui/form/select.scss deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/select.scss +++ /dev/null @@ -1,33 +0,0 @@ -.select-container { - display: grid; - grid-column-gap: 0.75rem; - grid-template-areas: "select clear-button"; - grid-template-columns: 1fr auto; - grid-template-rows: 1fr; -} - -.select { - border: 0.125rem solid #ffd54f; - grid-area: select; - padding: 0.125rem 0.25rem; - width: 100%; -} - -.select:focus { - background-color: #ffecb3; - outline: 0; -} - -.select:not(:focus) { - border-color: transparent; -} - -.select.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} - -.clear-button { - grid-area: clear-button; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.hbs b/tests/fixtures/app/sass/output/app/components/ui/form/textarea.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.hbs +++ /dev/null @@ -1,33 +0,0 @@ - - <:label as |l|> - - - - <:field as |f|> - - - \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.js b/tests/fixtures/app/sass/output/app/components/ui/form/textarea.js deleted file mode 100644 index 29c258e..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.js +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-app/utils/components/form'; - -export default class UiFormTextareaComponent extends Component { - get errorMessage() { - const { isRequired } = this.args; - - return generateErrorMessage({ - options: { - isRequired, - }, - value: this.value, - valueType: 'string', - }); - } - - get value() { - const { changeset, key } = this.args; - - return (get(changeset, key) ?? '').toString(); - } - - @action updateValue(event) { - const { key, onUpdate } = this.args; - const { value } = event.target; - - onUpdate({ key, value }); - } -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.scss b/tests/fixtures/app/sass/output/app/components/ui/form/textarea.scss deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/form/textarea.scss +++ /dev/null @@ -1,24 +0,0 @@ -.textarea { - border: 0.125rem solid #ffd54f; - padding: 0.125rem 0.25rem; - width: calc(100% - 0.75rem); -} - -.textarea:focus { - background-color: #ffecb3; - outline: 0; -} - -.textarea:not(:focus) { - border-color: transparent; -} - -.textarea::placeholder { - font-style: italic; -} - -.textarea.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/app/sass/output/app/components/ui/page.hbs b/tests/fixtures/app/sass/output/app/components/ui/page.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/page.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/ui/page.scss b/tests/fixtures/app/sass/output/app/components/ui/page.scss deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/app/sass/output/app/components/ui/page.scss +++ /dev/null @@ -1,20 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "body"; - grid-template-columns: 1fr; - grid-template-rows: auto 1fr; - height: calc(100% - 3em); - overflow-y: auto; - padding: 1.5rem 1rem; - scrollbar-gutter: stable; -} - -.header { - grid-area: header; -} - -.body { - grid-area: body; -} diff --git a/tests/fixtures/app/sass/output/app/controllers/form.js b/tests/fixtures/app/sass/output/app/controllers/form.js deleted file mode 100644 index 816335a..0000000 --- a/tests/fixtures/app/sass/output/app/controllers/form.js +++ /dev/null @@ -1,44 +0,0 @@ -import Controller from '@ember/controller'; -import { service } from '@ember/service'; -import { dropTask } from 'ember-concurrency'; -import fetch from 'fetch'; -import { generateBody } from 'my-app/utils/fetch'; - -export default class FormController extends Controller { - @service experiments; - - get initialData() { - if (this.isPartOfSubscribeToEmberTimesExperiment) { - return { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }; - } - - return { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }; - } - - get isPartOfSubscribeToEmberTimesExperiment() { - return this.experiments.getVariant('subscribe-to-ember-times') === 'v1'; - } - - submitForm = dropTask(async (data) => { - try { - const body = generateBody(data); - - await fetch('/contact-me', { - body, - method: 'POST', - }); - } catch (e) { - throw new Error(e); - } - }); -} diff --git a/tests/fixtures/app/sass/output/app/controllers/products.js b/tests/fixtures/app/sass/output/app/controllers/products.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/app/sass/output/app/controllers/products.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/app/sass/output/app/models/product.js b/tests/fixtures/app/sass/output/app/models/product.js deleted file mode 100644 index 3c6dd3d..0000000 --- a/tests/fixtures/app/sass/output/app/models/product.js +++ /dev/null @@ -1,11 +0,0 @@ -import Model, { attr } from '@ember-data/model'; - -export default class ProductModel extends Model { - @attr description; - @attr imageUrl; - @attr name; - @attr price; - @attr rating; - @attr seller; - @attr shortDescription; -} diff --git a/tests/fixtures/app/sass/output/app/routes/application.js b/tests/fixtures/app/sass/output/app/routes/application.js deleted file mode 100644 index 0a89bde..0000000 --- a/tests/fixtures/app/sass/output/app/routes/application.js +++ /dev/null @@ -1,10 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ApplicationRoute extends Route { - @service intl; - - beforeModel() { - this.intl.setLocale(['en-us']); - } -} diff --git a/tests/fixtures/app/sass/output/app/routes/form.js b/tests/fixtures/app/sass/output/app/routes/form.js deleted file mode 100644 index df63a89..0000000 --- a/tests/fixtures/app/sass/output/app/routes/form.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class FormRoute extends Route {} diff --git a/tests/fixtures/app/sass/output/app/routes/index.js b/tests/fixtures/app/sass/output/app/routes/index.js deleted file mode 100644 index accaec9..0000000 --- a/tests/fixtures/app/sass/output/app/routes/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Route from '@ember/routing/route'; - -export default class IndexRoute extends Route {} diff --git a/tests/fixtures/app/sass/output/app/routes/product-details.js b/tests/fixtures/app/sass/output/app/routes/product-details.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/app/sass/output/app/routes/product-details.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/sass/output/app/routes/products.js b/tests/fixtures/app/sass/output/app/routes/products.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/app/sass/output/app/routes/products.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/app/sass/output/app/routes/products/product.js b/tests/fixtures/app/sass/output/app/routes/products/product.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/app/sass/output/app/routes/products/product.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/app/sass/output/app/serializers/application.js b/tests/fixtures/app/sass/output/app/serializers/application.js deleted file mode 100644 index 2341d47..0000000 --- a/tests/fixtures/app/sass/output/app/serializers/application.js +++ /dev/null @@ -1,3 +0,0 @@ -import JSONAPISerializer from '@ember-data/serializer/json-api'; - -export default class ApplicationSerializer extends JSONAPISerializer {} diff --git a/tests/fixtures/app/sass/output/app/services/config.js b/tests/fixtures/app/sass/output/app/services/config.js deleted file mode 100644 index acc692f..0000000 --- a/tests/fixtures/app/sass/output/app/services/config.js +++ /dev/null @@ -1,25 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; -import config from 'my-app/config/environment'; - -export default class ConfigService extends Service { - customization = { - experiments: { - 'nest-product-details': { - control: 0.5, - v1: 0.5, - }, - - 'subscribe-to-ember-times': { - control: 0.7, - v1: 0.3, - }, - }, - }; - - isTestEnvironment = config.environment === 'test'; - - getValue(key) { - return get(this.customization, key); - } -} diff --git a/tests/fixtures/app/sass/output/app/services/experiments.js b/tests/fixtures/app/sass/output/app/services/experiments.js deleted file mode 100644 index 83cdf3c..0000000 --- a/tests/fixtures/app/sass/output/app/services/experiments.js +++ /dev/null @@ -1,82 +0,0 @@ -import { assert } from '@ember/debug'; -import Service, { service } from '@ember/service'; -import { cached } from '@glimmer/tracking'; - -export default class ExperimentsService extends Service { - @service config; - - @cached get cdfs() { - const experiments = this.config.getValue('experiments') ?? {}; - const cdfs = new Map(); - - for (const [experimentName, pdf] of Object.entries(experiments)) { - const cdf = new Map(); - let total = 0; - - for (const [variant, probability] of Object.entries(pdf)) { - total += probability; - cdf.set(variant, total); - } - - cdfs.set(experimentName, cdf); - } - - return cdfs; - } - - constructor() { - super(...arguments); - - this.#initializeVariants(); - } - - getVariant(experimentName) { - assert( - `${experimentName} is an unknown experiment. Please define the experiment in the config service.`, - this.cdfs.has(experimentName) - ); - - const cachedVariant = this.cachedVariants[experimentName]; - - if (cachedVariant) { - return cachedVariant; - } - - this.#determineVariant(experimentName); - - return this.cachedVariants[experimentName]; - } - - setVariant(experimentName, variant) { - const cdf = this.cdfs.get(experimentName); - - assert( - `${variant} is an unknown variant for ${experimentName}. Please check for typos.`, - cdf.has(variant) - ); - - this.cachedVariants[experimentName] = variant; - } - - #determineVariant(experimentName) { - const cdf = this.cdfs.get(experimentName); - const sample = Math.random(); - - for (const [variant, total] of cdf.entries()) { - if (sample < total) { - this.setVariant(experimentName, variant); - break; - } - } - } - - #initializeVariants() { - const cachedVariants = {}; - - this.cdfs.forEach((cdf, experimentName) => { - cachedVariants[experimentName] = undefined; - }); - - this.cachedVariants = cachedVariants; - } -} diff --git a/tests/fixtures/app/sass/output/app/styles/app.scss b/tests/fixtures/app/sass/output/app/styles/app.scss deleted file mode 100644 index 210d088..0000000 --- a/tests/fixtures/app/sass/output/app/styles/app.scss +++ /dev/null @@ -1,109 +0,0 @@ -html { - font-size: 16px; - height: 100%; -} - -body { - background-color: #020e1c; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-weight: 400; - height: 100%; - letter-spacing: 0.03rem; - margin: 0; -} - -* { - margin: 0; - padding: 0; -} - -h1 { - font-size: 2.25em; - font-weight: 700; - margin-bottom: 1.5rem; -} - -h2 { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -h3 { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -h4 { - font-size: 1rem; - font-weight: 700; - margin-bottom: 0.5rem; -} - -a { - color: rgb(245 255 250 / 88%); -} - -button { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - padding: 0.25rem 0.5rem; -} - -button:hover { - background-color: rgb(255 255 255 / 22.5%); - cursor: pointer; - transition: background-color 0.17s; -} - -input { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -p { - margin-bottom: 0.75rem; -} - -select { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -table { - border-collapse: collapse; - width: 100%; -} - -textarea { - background-color: #fff; - font-family: Raleway, sans-serif; - font-size: 1rem; -} - -th, -td { - border: 0.0625rem solid rgb(112 128 144 / 100%); - padding: 0.25rem 0.5rem; -} - -ul { - list-style-type: none; -} - -/* stylelint-disable selector-pseudo-class-no-unknown */ -:global(#ember-testing-container) { - overflow: hidden !important; -} - -:global(#ember-testing) { - background-color: #020e1c !important; -} diff --git a/tests/fixtures/app/sass/output/app/styles/application.scss b/tests/fixtures/app/sass/output/app/styles/application.scss deleted file mode 100644 index 16fae37..0000000 --- a/tests/fixtures/app/sass/output/app/styles/application.scss +++ /dev/null @@ -1,55 +0,0 @@ -.application { - display: grid; - grid-template-areas: - ". header ." - "main main main" - ". footer ."; - grid-template-columns: 1fr minmax(auto, 75rem) 1fr; - grid-template-rows: auto 1fr auto; - height: 100%; - overflow: hidden; - width: 100vw; -} - -.header { - grid-area: header; - min-height: 2.75rem; - overflow-x: auto; -} - -.main { - background-color: rgb(255 255 255 / 4.5%); - border-bottom: 0.0625rem solid rgb(211 211 211 / 15%); - border-top: 0.0625rem solid rgb(211 211 211 / 15%); - display: flex; - flex: 1; - grid-area: main; - justify-content: center; - overflow-y: hidden; -} - -.center { - display: flex; - flex-direction: column; - max-width: 75rem; - overflow-y: auto; - width: 100%; -} - -.footer { - align-items: center; - display: flex; - grid-area: footer; - justify-content: center; - min-height: 2.375rem; -} - -.copyright { - color: rgb(128 191 255 / 90%); - font-size: 0.75rem; - padding: 0.75rem 0; -} - -.copyright a { - color: rgb(128 191 255 / 90%); -} diff --git a/tests/fixtures/app/sass/output/app/styles/form.scss b/tests/fixtures/app/sass/output/app/styles/form.scss deleted file mode 100644 index 8ba2936..0000000 --- a/tests/fixtures/app/sass/output/app/styles/form.scss +++ /dev/null @@ -1,7 +0,0 @@ -.field { - margin-bottom: 1.25rem; -} - -.field:last-of-type { - margin-bottom: 0; -} diff --git a/tests/fixtures/app/sass/output/app/styles/index.scss b/tests/fixtures/app/sass/output/app/styles/index.scss deleted file mode 100644 index ea2d8d7..0000000 --- a/tests/fixtures/app/sass/output/app/styles/index.scss +++ /dev/null @@ -1,3 +0,0 @@ -.container { - padding: 1.5rem 1rem; -} diff --git a/tests/fixtures/app/sass/output/app/styles/product-details.scss b/tests/fixtures/app/sass/output/app/styles/product-details.scss deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/app/sass/output/app/styles/product-details.scss +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/app/sass/output/app/styles/products.scss b/tests/fixtures/app/sass/output/app/styles/products.scss deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/app/sass/output/app/styles/products.scss +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/app/sass/output/app/styles/products/product.scss b/tests/fixtures/app/sass/output/app/styles/products/product.scss deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/app/sass/output/app/styles/products/product.scss +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/app/sass/output/app/templates/application.hbs b/tests/fixtures/app/sass/output/app/templates/application.hbs deleted file mode 100644 index 57bb661..0000000 --- a/tests/fixtures/app/sass/output/app/templates/application.hbs +++ /dev/null @@ -1,47 +0,0 @@ -{{page-title (t "routes.application.app-name")}} - -
-
- - - -
- -
-
- {{outlet}} -
-
- -
- - {{t "routes.application.copyright" htmlSafe=true}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/templates/form.hbs b/tests/fixtures/app/sass/output/app/templates/form.hbs deleted file mode 100644 index af78c5e..0000000 --- a/tests/fixtures/app/sass/output/app/templates/form.hbs +++ /dev/null @@ -1,76 +0,0 @@ -{{page-title (t "routes.form.title")}} - - - -
- -
- -
- -
- -
- -
- - {{#if this.isPartOfSubscribeToEmberTimesExperiment}} -
- -
- - {{else}} -
- -
- - {{/if}} -
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/templates/index.hbs b/tests/fixtures/app/sass/output/app/templates/index.hbs deleted file mode 100644 index a5b7cf9..0000000 --- a/tests/fixtures/app/sass/output/app/templates/index.hbs +++ /dev/null @@ -1,5 +0,0 @@ - -

- {{t "routes.index.description" htmlSafe=true}} -

-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/templates/product-details.hbs b/tests/fixtures/app/sass/output/app/templates/product-details.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/app/sass/output/app/templates/product-details.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/templates/products.hbs b/tests/fixtures/app/sass/output/app/templates/products.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/app/sass/output/app/templates/products.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/templates/products/product.hbs b/tests/fixtures/app/sass/output/app/templates/products/product.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/app/sass/output/app/templates/products/product.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/utils/components/form/index.js b/tests/fixtures/app/sass/output/app/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/app/sass/output/app/utils/components/form/index.js +++ /dev/null @@ -1,26 +0,0 @@ -export function generateErrorMessage({ options = {}, value, valueType }) { - const { isRequired } = options; - - if (isRequired) { - switch (valueType) { - case 'boolean': { - if (value === undefined || value === false) { - return 'Please select the checkbox.'; - } - - break; - } - - case 'number': - case 'string': { - if (value === undefined || value === '') { - return 'Please provide a value.'; - } - - break; - } - } - } - - return undefined; -} diff --git a/tests/fixtures/app/sass/output/app/utils/fetch.js b/tests/fixtures/app/sass/output/app/utils/fetch.js deleted file mode 100644 index 0e5ef3f..0000000 --- a/tests/fixtures/app/sass/output/app/utils/fetch.js +++ /dev/null @@ -1,11 +0,0 @@ -function replacer(key, value) { - if (typeof value === 'undefined') { - return null; - } - - return value; -} - -export function generateBody(data = {}) { - return JSON.stringify(data, replacer); -} diff --git a/tests/fixtures/app/sass/output/package.json b/tests/fixtures/app/sass/output/package.json deleted file mode 100644 index 1692de1..0000000 --- a/tests/fixtures/app/sass/output/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "my-app", - "version": "0.0.0" -} diff --git a/tests/fixtures/app/sass/output/tests/helpers/components/form/index.js b/tests/fixtures/app/sass/output/tests/helpers/components/form/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/app/sass/output/tests/helpers/components/form/index.js +++ /dev/null @@ -1,10 +0,0 @@ -import { assert } from '@ember/debug'; -import { find, select } from '@ember/test-helpers'; - -export async function selectByLabel(selector, label) { - const option = find(`[data-test-option="${label}"]`); - - assert(`${label} is an unknown option. Please check for typos.`, option); - - await select(selector, option.value); -} diff --git a/tests/fixtures/app/sass/output/tests/helpers/index.js b/tests/fixtures/app/sass/output/tests/helpers/index.js deleted file mode 100644 index 432eab0..0000000 --- a/tests/fixtures/app/sass/output/tests/helpers/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from 'my-app/tests/helpers/components/ui/form'; -export * from 'my-app/tests/helpers/services/config'; -export * from 'my-app/tests/helpers/services/experiments'; diff --git a/tests/fixtures/app/sass/output/tests/helpers/services/config.js b/tests/fixtures/app/sass/output/tests/helpers/services/config.js deleted file mode 100644 index a5f0e5e..0000000 --- a/tests/fixtures/app/sass/output/tests/helpers/services/config.js +++ /dev/null @@ -1,23 +0,0 @@ -import { get } from '@ember/object'; -import Service from '@ember/service'; - -export function setupConfigService(hooks, customization = {}) { - hooks.beforeEach(function () { - this.owner.register( - 'service:config', - class ConfigService extends Service { - customization = customization; - - isTestEnvironment = true; - - getValue(key) { - return get(this.customization, key); - } - } - ); - }); - - hooks.afterEach(function () { - this.owner.unregister('service:config'); - }); -} diff --git a/tests/fixtures/app/sass/output/tests/helpers/services/experiments.js b/tests/fixtures/app/sass/output/tests/helpers/services/experiments.js deleted file mode 100644 index 017f498..0000000 --- a/tests/fixtures/app/sass/output/tests/helpers/services/experiments.js +++ /dev/null @@ -1,10 +0,0 @@ -import { getContext } from '@ember/test-helpers'; - -export function assignVariants(mapping = {}) { - const { owner } = getContext(); - const experiments = owner.lookup('service:experiments'); - - for (const [experimentName, variant] of Object.entries(mapping)) { - experiments.setVariant(experimentName, variant); - } -} diff --git a/tests/fixtures/app/sass/output/tests/integration/components/navigation-menu-test.js b/tests/fixtures/app/sass/output/tests/integration/components/navigation-menu-test.js deleted file mode 100644 index 53d5827..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/navigation-menu-test.js +++ /dev/null @@ -1,45 +0,0 @@ -import { findAll, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | navigation-menu', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a navigation menu', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-nav="Main Navigation"]') - .hasAria( - 'label', - 'Main Navigation', - 'We can pass @name to specify the navigation.' - ) - .hasTagName('nav', 'We see the correct tag name.'); - - const links = findAll('[data-test-link]'); - - assert.strictEqual(links.length, 1, 'We see 1 link.'); - - assert - .dom(links[0]) - .hasAttribute('href', '/', 'We see the correct href for the 1st link.') - .hasText('Home', 'We see the correct label for the 1st link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/product/card-test.js b/tests/fixtures/app/sass/output/tests/integration/components/product/card-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/product/card-test.js +++ /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/app/sass/output/tests/integration/components/product/details-test.js b/tests/fixtures/app/sass/output/tests/integration/components/product/details-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/product/details-test.js +++ /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/app/sass/output/tests/integration/components/product/image-test.js b/tests/fixtures/app/sass/output/tests/integration/components/product/image-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/product/image-test.js +++ /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/app/sass/output/tests/integration/components/ui/form-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form-test.js +++ /dev/null @@ -1,179 +0,0 @@ -import { click, fillIn, find, 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 | ui/form', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - test('The component renders a form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - const titleId = find('[data-test-title]').getAttribute('id'); - const instructionsId = find('[data-test-instructions]').getAttribute('id'); - - assert - .dom('[data-test-form="Contact me"]') - .hasAria( - 'describedby', - instructionsId, - 'We see the correct aria-describedby.' - ) - .hasAria('labelledby', titleId, 'We see the correct aria-labelledby.'); - - assert.dom('[data-test-field]').exists({ count: 5 }, 'We see 5 fields.'); - - assert - .dom('[data-test-button="Submit"]') - .hasAttribute('type', 'submit', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Submit', 'We see the submit button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can submit the form', async function (assert) { - this.submitForm = sinon.spy(); - - await render(hbs` - -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-
- `); - - await fillIn('[data-test-field="Name"]', 'Zoey'); - await fillIn('[data-test-field="Email"]', 'zoey@emberjs.com'); - await fillIn('[data-test-field="Message"]', 'Gude!'); - await click('[data-test-field="Subscribe to The Ember Times?"]'); - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - await click('[data-test-button="Submit"]'); - - assert.true( - this.submitForm.calledOnceWith({ - donation: 10000, - email: 'zoey@emberjs.com', - message: 'Gude!', - name: 'Zoey', - subscribe: false, - }), - 'We called @onSubmit once.' - ); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/checkbox-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/checkbox-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/checkbox-test.js +++ /dev/null @@ -1,209 +0,0 @@ -import { set } from '@ember/object'; -import { click, render, triggerKeyEvent } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/checkbox', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: true, - }; - }); - - test('The component renders a label and a checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Subscribe to The Ember Times?', 'We see the correct label.'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('disabled', 'false', 'The checkbox should be enabled.') - .hasAria('readonly', 'false', 'The checkbox should not be readonly.') - .hasAria('required', 'false', 'The checkbox should not be required.') - .hasAttribute('role', 'checkbox', 'We see the correct role.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.') - .hasTagName('span', 'We see the correct tag name.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the checkbox', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .doesNotHaveAttribute('tabindex', 'The checkbox should not be focusable.') - .hasAria('disabled', 'true', 'The checkbox is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.') - .hasAria('readonly', 'true', 'We see the aria-readonly attribute.') - .hasAttribute('tabindex', '0', 'The checkbox is focusable.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Subscribe to The Ember Times? *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('required', 'true', 'The checkbox is required.'); - }); - - test('We can click on the checkbox to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Click the checkbox - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Click the checkbox again - expectedValue = true; - - await click('[data-test-field="Subscribe to The Ember Times?"]'); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can press the Space key to toggle the value', async function (assert) { - assert.expect(6); - - let expectedValue = false; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Press the Space key - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'false', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please select the checkbox.', 'We see an error message.'); - - // Press the Space key again - expectedValue = true; - - await triggerKeyEvent( - '[data-test-field="Subscribe to The Ember Times?"]', - 'keypress', - 'Space' - ); - - assert - .dom('[data-test-field="Subscribe to The Ember Times?"]') - .hasAria('checked', 'true', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/field-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/field-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/field-test.js +++ /dev/null @@ -1,74 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/field', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the field layout', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert.dom('[data-test-label]').hasText('Name', 'We see the label.'); - - assert.dom('[data-test-field="Name"]').hasValue('', 'We see the field.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can pass @errorMessage to show an error message', async function (assert) { - await render(hbs` - - <:label as |l|> - - - - <:field as |f|> - - - - `); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see the error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/information-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/information-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/information-test.js +++ /dev/null @@ -1,63 +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 | ui/form/information', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders nothing when we do not pass @title or @instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @title to display the form title', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .hasAttribute('id', 'ember123-title', 'We see the correct ID.') - .hasText('Contact me', 'We see the form title.'); - - assert - .dom('[data-test-instructions]') - .doesNotExist('We should not see the form instructions.'); - }); - - test('We can pass @instructions to display the form instructions', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-title]') - .doesNotExist('We should not see the form title.'); - - assert - .dom('[data-test-instructions]') - .hasAttribute('id', 'ember123-instructions', 'We see the correct ID.') - .hasText( - 'Still have questions about ember-container-query? Try sending me a message.', - 'We see the form instructions.' - ); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/input-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/input-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/input-test.js +++ /dev/null @@ -1,169 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/input', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name', 'We see the correct label.'); - - assert - .dom('[data-test-field="Name"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'text', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('Zoey', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert.dom('[data-test-field="Name"]').isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('Zoey', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Name *', 'The label shows that the field is required.'); - - assert.dom('[data-test-field="Name"]').isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Name"]', ''); - - assert - .dom('[data-test-field="Name"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Tomster'; - - await fillIn('[data-test-field="Name"]', 'Tomster'); - - assert - .dom('[data-test-field="Name"]') - .hasValue('Tomster', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @type to create an email input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Email', 'We see the correct label.'); - - assert - .dom('[data-test-field="Email"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'email', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('zoey@emberjs.com', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/number-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/number-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/number-test.js +++ /dev/null @@ -1,159 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/number', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - donation: 1000, - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and an input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Donation amount ($)', 'We see the correct label.'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .doesNotHaveAttribute('readonly', 'The input should not be readonly.') - .hasAttribute('type', 'number', 'We see the correct type.') - .hasTagName('input', 'We see the correct tag name.') - .hasValue('1000', 'We see the correct value.') - .isEnabled('The input should be enabled.') - .isNotRequired('The input should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the input', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isDisabled('The input is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('1000', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText( - 'Donation amount ($) *', - 'The label shows that the field is required.' - ); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .isRequired('The input is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = undefined; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Donation amount ($)"]', ''); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 10000; - - await fillIn('[data-test-field="Donation amount ($)"]', '10000'); - - assert - .dom('[data-test-field="Donation amount ($)"]') - .hasValue('10000', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/select-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/select-test.js deleted file mode 100644 index 20ea0b9..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/select-test.js +++ /dev/null @@ -1,244 +0,0 @@ -import { set } from '@ember/object'; -import { click, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { selectByLabel } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/select', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.changeset = { - sortBy: 'name:asc', - }; - - this.optionsForSorting = [ - { - label: 'Name: A to Z', - value: 'name:asc', - }, - { - label: 'Name: Z to A', - value: 'name:desc', - }, - { - label: 'Price: Low to High', - value: 'price:asc', - }, - { - label: 'Price: High to Low', - value: 'price:desc', - }, - ]; - }); - - test('The component renders a label and a select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('name:asc', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 4 }, 'We see 4 options.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Name: A to Z', 'We see the correct selected option.'); - - assert - .dom('[data-test-button="Clear"]') - .hasAria( - 'label', - 'Clear option for Sort by', - 'We see the correct aria-label.' - ) - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('✕', 'we see the correct label.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('The component renders when @options is undefined', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by', 'We see the correct label.'); - - assert - .dom('[data-test-field="Sort by"]') - .hasTagName('select', 'We see the correct tag name.') - .hasValue('', 'We see the correct value.') - .isEnabled('The select should be enabled.') - .isNotRequired('The select should not be required.'); - - assert - .dom('[data-test-option]:not(:disabled)') - .exists({ count: 0 }, 'We see 0 options.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the select', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('name:asc', 'We see the correct value.') - .isDisabled('The select is disabled.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Sort by *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Sort by"]') - .isRequired('The select is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(5); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - 'price:desc', - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await selectByLabel('[data-test-field="Sort by"]', 'Price: High to Low'); - - assert - .dom('[data-test-field="Sort by"]') - .hasValue('price:desc', 'We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .hasAttribute('selected', '', 'We see the selected attribute.') - .hasText('Price: High to Low', 'We see the correct selected option.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can click on the clear button to reset the option', async function (assert) { - assert.expect(4); - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - undefined, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - await click('[data-test-button="Clear"]'); - - assert - .dom('[data-test-field="Sort by"]') - .hasNoValue('We see the correct value.'); - - assert - .dom('[data-test-option]:checked') - .doesNotExist('We should not see a selected option.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/textarea-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/form/textarea-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/form/textarea-test.js +++ /dev/null @@ -1,144 +0,0 @@ -import { set } from '@ember/object'; -import { fillIn, render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/form/textarea', function (hooks) { - setupRenderingTest(hooks); - - hooks.beforeEach(function () { - this.changeset = { - email: 'zoey@emberjs.com', - message: 'I 🧡 container queries!', - name: 'Zoey', - subscribe: false, - }; - }); - - test('The component renders a label and a textarea', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message', 'We see the correct label.'); - - assert - .dom('[data-test-field="Message"]') - .doesNotHaveAttribute('readonly', 'The textarea should not be readonly.') - .hasTagName('textarea', 'We see the correct tag name.') - .hasValue('I 🧡 container queries!', 'We see the correct value.') - .isEnabled('The textarea should be enabled.') - .isNotRequired('The textarea should not be required.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); - - test('We can pass @isDisabled to disable the text area', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .isDisabled('The textarea is disabled.'); - }); - - test('We can pass @isReadOnly to display the value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Message"]') - .hasAttribute('readonly', '', 'We see the readonly attribute.') - .hasValue('I 🧡 container queries!', 'We see the correct value.'); - }); - - test('We can pass @isRequired to require a value', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-label]') - .hasText('Message *', 'The label shows that the field is required.'); - - assert - .dom('[data-test-field="Message"]') - .isRequired('The textarea is required.'); - }); - - test('We can pass @onUpdate to get the updated value', async function (assert) { - assert.expect(6); - - let expectedValue = ''; - - this.updateChangeset = ({ key, value }) => { - assert.strictEqual( - value, - expectedValue, - 'The changeset has the correct value.' - ); - - set(this.changeset, key, value); - }; - - await render(hbs` - - `); - - // Update the value - await fillIn('[data-test-field="Message"]', ''); - - assert - .dom('[data-test-field="Message"]') - .hasValue('', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .hasText('Please provide a value.', 'We see an error message.'); - - // Update the value again - expectedValue = 'Keep up the good work!'; - - await fillIn('[data-test-field="Message"]', 'Keep up the good work!'); - - assert - .dom('[data-test-field="Message"]') - .hasValue('Keep up the good work!', 'We see the correct value.'); - - assert - .dom('[data-test-feedback]') - .doesNotExist('We should not see an error message.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/integration/components/ui/page-test.js b/tests/fixtures/app/sass/output/tests/integration/components/ui/page-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/app/sass/output/tests/integration/components/ui/page-test.js +++ /dev/null @@ -1,29 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | ui/page', function (hooks) { - setupRenderingTest(hooks); - - test('The component handles the page layout', async function (assert) { - await render(hbs` - -
- Content goes here. -
-
- `); - - assert.dom('h1').hasText('Forms', 'We see the title.'); - - assert.dom('[data-test-content]').exists('We see the yielded content.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/controllers/form-test.js b/tests/fixtures/app/sass/output/tests/unit/controllers/form-test.js deleted file mode 100644 index b24ef94..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/controllers/form-test.js +++ /dev/null @@ -1,82 +0,0 @@ -import { setupMirage } from 'ember-cli-mirage/test-support'; -import { setupTest } from 'ember-qunit'; -import { assignVariants } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Controller | form', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:form'); - }); - - module('initialData', function () { - test('subscribe-to-ember-times, control', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'control', - }); - - assert.deepEqual( - this.controller.initialData, - { - donation: undefined, - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - }, - 'We get the correct value.' - ); - }); - - test('subscribe-to-ember-times, v1', function (assert) { - assignVariants({ - 'subscribe-to-ember-times': 'v1', - }); - - assert.deepEqual( - this.controller.initialData, - { - email: undefined, - message: 'I 🧡 container queries!', - name: undefined, - subscribe: true, - }, - 'We get the correct value.' - ); - }); - }); - - module('submitForm', function (nestedHooks) { - setupMirage(nestedHooks); - - test('Calls POST /contact-me', async function (assert) { - assert.expect(1); - - this.server.post('/contact-me', (schema, request) => { - const json = JSON.parse(request.requestBody); - - assert.deepEqual( - json, - { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: null, - subscribe: false, - }, - 'We sent the correct request body.' - ); - }); - - const data = { - donation: 0, - email: '', - message: 'I 🧡 container queries!', - name: undefined, - subscribe: false, - }; - - await this.controller.submitForm.perform(data); - }); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/controllers/products-test.js b/tests/fixtures/app/sass/output/tests/unit/controllers/products-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/controllers/products-test.js +++ /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/app/sass/output/tests/unit/routes/application-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/application-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/application-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/routes/form-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/form-test.js deleted file mode 100644 index 270324c..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/form-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | form', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:form'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/routes/index-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/index-test.js deleted file mode 100644 index adfc664..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/index-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | index', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:index'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/routes/product-details-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/product-details-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/product-details-test.js +++ /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/sass/output/tests/unit/routes/products-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/products-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/products-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/routes/products/product-test.js b/tests/fixtures/app/sass/output/tests/unit/routes/products/product-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/routes/products/product-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/services/config-test.js b/tests/fixtures/app/sass/output/tests/unit/services/config-test.js deleted file mode 100644 index 8026782..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/services/config-test.js +++ /dev/null @@ -1,54 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; - -module('Unit | Service | config', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - key: { - child: { - grandchild: 'value', - }, - }, - }); - - hooks.beforeEach(function () { - this.config = this.owner.lookup('service:config'); - }); - - module('getValue', function () { - test('returns the value of a key', function (assert) { - assert.deepEqual( - this.config.getValue('key'), - { - child: { - grandchild: 'value', - }, - }, - 'We get the correct value.' - ); - }); - - test('returns the value of a nested key', function (assert) { - assert.deepEqual( - this.config.getValue('key.child'), - { - grandchild: 'value', - }, - 'We get the correct value. (1)' - ); - - assert.strictEqual( - this.config.getValue('key.child.grandchild'), - 'value', - 'We get the correct value. (2)' - ); - }); - }); - - module('isTestEnvironment', function () { - test('returns true in the test environment', function (assert) { - assert.true(this.config.isTestEnvironment, 'We get the correct value.'); - }); - }); -}); diff --git a/tests/fixtures/app/sass/output/tests/unit/services/experiments-test.js b/tests/fixtures/app/sass/output/tests/unit/services/experiments-test.js deleted file mode 100644 index f5770ec..0000000 --- a/tests/fixtures/app/sass/output/tests/unit/services/experiments-test.js +++ /dev/null @@ -1,204 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { setupConfigService } from 'my-app/tests/helpers'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Unit | Service | experiments', function (hooks) { - setupTest(hooks); - setupConfigService(hooks, { - experiments: { - 'experiment-a': { - control: 0.5, - v1: 0.5, - }, - - 'experiment-b': { - control: 0.4, - v1: 0.3, - v2: 0.3, - }, - }, - }); - - hooks.beforeEach(function () { - this.experiments = this.owner.lookup('service:experiments'); - }); - - module('cachedVariants', function () { - test('returns an object, with each experiment mapped to undefined', function (assert) { - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': undefined, - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('getVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.getVariant('experiment-c'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: experiment-c is an unknown experiment. Please define the experiment in the config service.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('returns a variant at random when called initially', function (assert) { - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - - test('returns the cached variant when called again', function (assert) { - // Check one experiment - const stubbedRandom = sinon.stub(Math, 'random'); - stubbedRandom.onCall(0).returns(0.045); - stubbedRandom.onCall(1).returns(0.779); - - let variant = this.experiments.getVariant('experiment-a'); - variant = this.experiments.getVariant('experiment-a'); - - assert.strictEqual( - variant, - 'control', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': undefined, - }, - 'We get the correct value for cachedVariants.' - ); - - // Check another experiment - stubbedRandom.reset(); - stubbedRandom.onCall(0).returns(0.913); - stubbedRandom.onCall(1).returns(0.278); - - variant = this.experiments.getVariant('experiment-b'); - variant = this.experiments.getVariant('experiment-b'); - - assert.strictEqual( - variant, - 'v2', - 'We get the correct value for variant.' - ); - - assert.strictEqual( - stubbedRandom.callCount, - 1, - 'We called _determineVariant once.' - ); - - assert.deepEqual( - this.experiments.cachedVariants, - { - 'experiment-a': 'control', - 'experiment-b': 'v2', - }, - 'We get the correct value for cachedVariants.' - ); - }); - }); - - module('setVariant', function () { - test('throws an error when the experiment is unknown', function (assert) { - assert.expect(1); - - assert.throws( - () => { - this.experiments.setVariant('experiment-a', 'v2'); - }, - (error) => { - return ( - error.message === - 'Assertion Failed: v2 is an unknown variant for experiment-a. Please check for typos.' - ); - }, - 'We see the correct error message.' - ); - }); - - test('can be used to deterministically set the variant', function (assert) { - this.experiments.setVariant('experiment-a', 'v1'); - - assert.strictEqual( - this.experiments.getVariant('experiment-a'), - 'v1', - 'We get the correct value for variant.' - ); - }); - }); -}); diff --git a/tests/fixtures/engine/javascript/index.ts b/tests/fixtures/engine/javascript/index.ts deleted file mode 100644 index 4090486..0000000 --- a/tests/fixtures/engine/javascript/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('engine/javascript/input'); -const outputProject = convertFixtureToJson('engine/javascript/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/card/styles.css b/tests/fixtures/engine/javascript/input/addon/components/product/card/styles.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/card/styles.css +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/card/template.hbs b/tests/fixtures/engine/javascript/input/addon/components/product/card/template.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/card/template.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/details/component.js b/tests/fixtures/engine/javascript/input/addon/components/product/details/component.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/details/component.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/details/styles.css b/tests/fixtures/engine/javascript/input/addon/components/product/details/styles.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/details/styles.css +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/details/template.hbs b/tests/fixtures/engine/javascript/input/addon/components/product/details/template.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/details/template.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/image/component.js b/tests/fixtures/engine/javascript/input/addon/components/product/image/component.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/image/component.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/image/styles.css b/tests/fixtures/engine/javascript/input/addon/components/product/image/styles.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/image/styles.css +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/engine/javascript/input/addon/components/product/image/template.hbs b/tests/fixtures/engine/javascript/input/addon/components/product/image/template.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/javascript/input/addon/components/product/image/template.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/addon/product-details/route.js b/tests/fixtures/engine/javascript/input/addon/product-details/route.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/javascript/input/addon/product-details/route.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/javascript/input/addon/product-details/styles.css b/tests/fixtures/engine/javascript/input/addon/product-details/styles.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/javascript/input/addon/product-details/styles.css +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/engine/javascript/input/addon/product-details/template.hbs b/tests/fixtures/engine/javascript/input/addon/product-details/template.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/javascript/input/addon/product-details/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/addon/products/controller.js b/tests/fixtures/engine/javascript/input/addon/products/controller.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/controller.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/engine/javascript/input/addon/products/product/route.js b/tests/fixtures/engine/javascript/input/addon/products/product/route.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/product/route.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/javascript/input/addon/products/product/template.hbs b/tests/fixtures/engine/javascript/input/addon/products/product/template.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/product/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/addon/products/route.js b/tests/fixtures/engine/javascript/input/addon/products/route.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/route.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/engine/javascript/input/addon/products/styles.css b/tests/fixtures/engine/javascript/input/addon/products/styles.css deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/styles.css +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/engine/javascript/input/addon/products/template.hbs b/tests/fixtures/engine/javascript/input/addon/products/template.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/engine/javascript/input/addon/products/template.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/input/package.json b/tests/fixtures/engine/javascript/input/package.json deleted file mode 100644 index 228c322..0000000 --- a/tests/fixtures/engine/javascript/input/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "my-engine", - "version": "0.0.0", - "keywords": [ - "ember-addon", - "ember-engine" - ], -} diff --git a/tests/fixtures/engine/javascript/input/tests/integration/components/product/card/component-test.js b/tests/fixtures/engine/javascript/input/tests/integration/components/product/card/component-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/javascript/input/tests/integration/components/product/card/component-test.js +++ /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/javascript/input/tests/integration/components/product/details/component-test.js b/tests/fixtures/engine/javascript/input/tests/integration/components/product/details/component-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/javascript/input/tests/integration/components/product/details/component-test.js +++ /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/javascript/input/tests/integration/components/product/image/component-test.js b/tests/fixtures/engine/javascript/input/tests/integration/components/product/image/component-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/javascript/input/tests/integration/components/product/image/component-test.js +++ /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/javascript/input/tests/unit/controllers/products/controller-test.js b/tests/fixtures/engine/javascript/input/tests/unit/controllers/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/controllers/products/controller-test.js +++ /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/javascript/input/tests/unit/product-details/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/product-details/route-test.js +++ /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/javascript/input/tests/unit/products/controller-test.js b/tests/fixtures/engine/javascript/input/tests/unit/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/products/controller-test.js +++ /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/javascript/input/tests/unit/products/product/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/javascript/input/tests/unit/products/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/javascript/input/tests/unit/routes/product-details/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/routes/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/routes/product-details/route-test.js +++ /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/javascript/input/tests/unit/routes/products/product/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/routes/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/routes/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/javascript/input/tests/unit/routes/products/route-test.js b/tests/fixtures/engine/javascript/input/tests/unit/routes/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/javascript/input/tests/unit/routes/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/card.css b/tests/fixtures/engine/javascript/output/addon/components/product/card.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/card.css +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/card.hbs b/tests/fixtures/engine/javascript/output/addon/components/product/card.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/card.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/details.css b/tests/fixtures/engine/javascript/output/addon/components/product/details.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/details.css +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/details.hbs b/tests/fixtures/engine/javascript/output/addon/components/product/details.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/details.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/details.js b/tests/fixtures/engine/javascript/output/addon/components/product/details.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/details.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/image.css b/tests/fixtures/engine/javascript/output/addon/components/product/image.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/image.css +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/image.hbs b/tests/fixtures/engine/javascript/output/addon/components/product/image.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/image.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/addon/components/product/image.js b/tests/fixtures/engine/javascript/output/addon/components/product/image.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/javascript/output/addon/components/product/image.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/engine/javascript/output/addon/controllers/products.js b/tests/fixtures/engine/javascript/output/addon/controllers/products.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/engine/javascript/output/addon/controllers/products.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/engine/javascript/output/addon/routes/product-details.js b/tests/fixtures/engine/javascript/output/addon/routes/product-details.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/javascript/output/addon/routes/product-details.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/javascript/output/addon/routes/products.js b/tests/fixtures/engine/javascript/output/addon/routes/products.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/engine/javascript/output/addon/routes/products.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/engine/javascript/output/addon/routes/products/product.js b/tests/fixtures/engine/javascript/output/addon/routes/products/product.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/engine/javascript/output/addon/routes/products/product.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/javascript/output/addon/styles/product-details.css b/tests/fixtures/engine/javascript/output/addon/styles/product-details.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/javascript/output/addon/styles/product-details.css +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/engine/javascript/output/addon/styles/products.css b/tests/fixtures/engine/javascript/output/addon/styles/products.css deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/engine/javascript/output/addon/styles/products.css +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/engine/javascript/output/addon/templates/product-details.hbs b/tests/fixtures/engine/javascript/output/addon/templates/product-details.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/javascript/output/addon/templates/product-details.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/addon/templates/products.hbs b/tests/fixtures/engine/javascript/output/addon/templates/products.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/engine/javascript/output/addon/templates/products.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/addon/templates/products/product.hbs b/tests/fixtures/engine/javascript/output/addon/templates/products/product.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/engine/javascript/output/addon/templates/products/product.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/engine/javascript/output/package.json b/tests/fixtures/engine/javascript/output/package.json deleted file mode 100644 index 228c322..0000000 --- a/tests/fixtures/engine/javascript/output/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "my-engine", - "version": "0.0.0", - "keywords": [ - "ember-addon", - "ember-engine" - ], -} diff --git a/tests/fixtures/engine/javascript/output/tests/integration/components/product/card-test.js b/tests/fixtures/engine/javascript/output/tests/integration/components/product/card-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/javascript/output/tests/integration/components/product/card-test.js +++ /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/javascript/output/tests/integration/components/product/details-test.js b/tests/fixtures/engine/javascript/output/tests/integration/components/product/details-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/javascript/output/tests/integration/components/product/details-test.js +++ /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/javascript/output/tests/integration/components/product/image-test.js b/tests/fixtures/engine/javascript/output/tests/integration/components/product/image-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/javascript/output/tests/integration/components/product/image-test.js +++ /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/javascript/output/tests/unit/controllers/products-test.js b/tests/fixtures/engine/javascript/output/tests/unit/controllers/products-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/javascript/output/tests/unit/controllers/products-test.js +++ /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/javascript/output/tests/unit/routes/product-details-test.js b/tests/fixtures/engine/javascript/output/tests/unit/routes/product-details-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/javascript/output/tests/unit/routes/product-details-test.js +++ /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/javascript/output/tests/unit/routes/products-test.js b/tests/fixtures/engine/javascript/output/tests/unit/routes/products-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/javascript/output/tests/unit/routes/products-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/javascript/output/tests/unit/routes/products/product-test.js b/tests/fixtures/engine/javascript/output/tests/unit/routes/products/product-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/javascript/output/tests/unit/routes/products/product-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/index.ts b/tests/fixtures/engine/sass/index.ts deleted file mode 100644 index b37dc65..0000000 --- a/tests/fixtures/engine/sass/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('engine/sass/input'); -const outputProject = convertFixtureToJson('engine/sass/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/engine/sass/input/addon/components/product/card/styles.scss b/tests/fixtures/engine/sass/input/addon/components/product/card/styles.scss deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/card/styles.scss +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/sass/input/addon/components/product/card/template.hbs b/tests/fixtures/engine/sass/input/addon/components/product/card/template.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/card/template.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/addon/components/product/details/component.js b/tests/fixtures/engine/sass/input/addon/components/product/details/component.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/details/component.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/engine/sass/input/addon/components/product/details/styles.scss b/tests/fixtures/engine/sass/input/addon/components/product/details/styles.scss deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/details/styles.scss +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/sass/input/addon/components/product/details/template.hbs b/tests/fixtures/engine/sass/input/addon/components/product/details/template.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/details/template.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/addon/components/product/image/component.js b/tests/fixtures/engine/sass/input/addon/components/product/image/component.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/image/component.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/engine/sass/input/addon/components/product/image/styles.scss b/tests/fixtures/engine/sass/input/addon/components/product/image/styles.scss deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/image/styles.scss +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/engine/sass/input/addon/components/product/image/template.hbs b/tests/fixtures/engine/sass/input/addon/components/product/image/template.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/sass/input/addon/components/product/image/template.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/addon/product-details/route.js b/tests/fixtures/engine/sass/input/addon/product-details/route.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/sass/input/addon/product-details/route.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/sass/input/addon/product-details/styles.scss b/tests/fixtures/engine/sass/input/addon/product-details/styles.scss deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/sass/input/addon/product-details/styles.scss +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/engine/sass/input/addon/product-details/template.hbs b/tests/fixtures/engine/sass/input/addon/product-details/template.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/sass/input/addon/product-details/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/addon/products/controller.js b/tests/fixtures/engine/sass/input/addon/products/controller.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/controller.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/engine/sass/input/addon/products/product/route.js b/tests/fixtures/engine/sass/input/addon/products/product/route.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/product/route.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/sass/input/addon/products/product/styles.scss b/tests/fixtures/engine/sass/input/addon/products/product/styles.scss deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/product/styles.scss +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/engine/sass/input/addon/products/product/template.hbs b/tests/fixtures/engine/sass/input/addon/products/product/template.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/product/template.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/addon/products/route.js b/tests/fixtures/engine/sass/input/addon/products/route.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/route.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/engine/sass/input/addon/products/styles.scss b/tests/fixtures/engine/sass/input/addon/products/styles.scss deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/styles.scss +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/engine/sass/input/addon/products/template.hbs b/tests/fixtures/engine/sass/input/addon/products/template.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/engine/sass/input/addon/products/template.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/input/package.json b/tests/fixtures/engine/sass/input/package.json deleted file mode 100644 index 228c322..0000000 --- a/tests/fixtures/engine/sass/input/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "my-engine", - "version": "0.0.0", - "keywords": [ - "ember-addon", - "ember-engine" - ], -} diff --git a/tests/fixtures/engine/sass/input/tests/integration/components/product/card/component-test.js b/tests/fixtures/engine/sass/input/tests/integration/components/product/card/component-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/sass/input/tests/integration/components/product/card/component-test.js +++ /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/sass/input/tests/integration/components/product/details/component-test.js b/tests/fixtures/engine/sass/input/tests/integration/components/product/details/component-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/sass/input/tests/integration/components/product/details/component-test.js +++ /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/sass/input/tests/integration/components/product/image/component-test.js b/tests/fixtures/engine/sass/input/tests/integration/components/product/image/component-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/sass/input/tests/integration/components/product/image/component-test.js +++ /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/sass/input/tests/unit/controllers/products/controller-test.js b/tests/fixtures/engine/sass/input/tests/unit/controllers/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/controllers/products/controller-test.js +++ /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/sass/input/tests/unit/product-details/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/product-details/route-test.js +++ /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/sass/input/tests/unit/products/controller-test.js b/tests/fixtures/engine/sass/input/tests/unit/products/controller-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/products/controller-test.js +++ /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/sass/input/tests/unit/products/product/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/input/tests/unit/products/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/input/tests/unit/routes/product-details/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/routes/product-details/route-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/routes/product-details/route-test.js +++ /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/sass/input/tests/unit/routes/products/product/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/routes/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/routes/products/product/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/input/tests/unit/routes/products/route-test.js b/tests/fixtures/engine/sass/input/tests/unit/routes/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/sass/input/tests/unit/routes/products/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/output/addon/components/product/card.hbs b/tests/fixtures/engine/sass/output/addon/components/product/card.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/card.hbs +++ /dev/null @@ -1,51 +0,0 @@ - -
-

- {{@product.name}} -

-
- -
- -
- -
-

- {{@product.shortDescription}} -

- - {{#if @product.price}} -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

- {{/if}} -
- -
- - {{t "components.products.product.card.learn-more.label"}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/addon/components/product/card.scss b/tests/fixtures/engine/sass/output/addon/components/product/card.scss deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/card.scss +++ /dev/null @@ -1,101 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; - height: calc(100% - 2rem); - padding: 1rem; - position: relative; - width: calc(100% - 2rem); -} - -.container:hover { - background: #26313d; - transform: translateY(-0.25rem); - transition: all 0.25s; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.25rem; - font-weight: 700; - margin-bottom: 0.75rem; -} - -.image-container { - grid-area: image-container; - max-height: 6rem; - max-width: 8rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.description, -.price { - font-size: 0.875rem; - margin-bottom: 0.375rem; -} - -.actions { - align-items: center; - display: flex; - grid-area: actions; - justify-content: flex-end; -} - -.link { - background: transparent; - border: 0.0625rem solid rgb(247 252 251 / 50%); - border-radius: 0.15rem; - color: rgb(247 252 251 / 90%); - font-family: Raleway, sans-serif; - font-size: 0.875rem; - margin-top: 0.5rem; - padding: 0.25rem 0.5rem; - text-decoration: none; -} - -.link::after { - content: ""; - height: 100%; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -.link:focus { - outline: 0; -} - -.link:focus::after { - border: 1px solid orange; -} - -.container[data-container-query-wide] { - grid-column-gap: 1.5rem; - grid-template-areas: - "image-container header" - "image-container body" - "image-container actions"; - grid-template-columns: auto 1fr; - grid-template-rows: auto 1fr auto; -} - -.container[data-container-query-wide] .body { - margin-top: 0; -} - -.container[data-container-query-wide] .link { - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/sass/output/addon/components/product/details.hbs b/tests/fixtures/engine/sass/output/addon/components/product/details.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/details.hbs +++ /dev/null @@ -1,72 +0,0 @@ -
-
-

- {{@product.name}} -

-
- -
- -
- -
-
-

- {{t "components.products.product.details.description"}} -

- -

- {{@product.description}} -

-
- - {{#if @product.price}} -
-

- {{t "components.products.product.details.price"}} -

- -

- {{format-number - @product.price - currency="USD" - minimumFractionDigits=0 - style="currency" - }} -

-
- {{/if}} - -
-

- {{t "components.products.product.details.rating"}} -

- -

- {{t - "components.products.product.details.rating-value" - productRating=@product.rating - }} -

-
- -
-

- {{t "components.products.product.details.seller"}} -

- -

{{@product.seller}}

-
-
- -
- -
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/addon/components/product/details.js b/tests/fixtures/engine/sass/output/addon/components/product/details.js deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/details.js +++ /dev/null @@ -1,8 +0,0 @@ -import { action } from '@ember/object'; -import Component from '@glimmer/component'; - -export default class ProductsProductDetailsComponent extends Component { - @action addProductToCart(product) { - console.log(`${product.name} has been added to the cart.`); - } -} diff --git a/tests/fixtures/engine/sass/output/addon/components/product/details.scss b/tests/fixtures/engine/sass/output/addon/components/product/details.scss deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/details.scss +++ /dev/null @@ -1,45 +0,0 @@ -.container { - display: grid; - grid-template-areas: - "header" - "image-container" - "body" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr auto; -} - -.header { - grid-area: header; -} - -.name { - font-size: 1.5rem; - font-weight: 700; - margin-bottom: 1rem; -} - -.image-container { - grid-area: image-container; - margin-top: 0.5rem; - max-height: 18rem; - max-width: 24rem; -} - -.body { - grid-area: body; - margin-top: 1rem; -} - -.field { - margin-top: 1rem; -} - -.field:first-of-type { - margin-top: 0; -} - -.actions { - grid-area: actions; - margin-top: 1rem; -} diff --git a/tests/fixtures/engine/sass/output/addon/components/product/image.hbs b/tests/fixtures/engine/sass/output/addon/components/product/image.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/image.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if this.config.isTestEnvironment}} -
- -{{else}} - - -{{/if}} \ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/addon/components/product/image.js b/tests/fixtures/engine/sass/output/addon/components/product/image.js deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/image.js +++ /dev/null @@ -1,6 +0,0 @@ -import { service } from '@ember/service'; -import Component from '@glimmer/component'; - -export default class ProductsProductImageComponent extends Component { - @service config; -} diff --git a/tests/fixtures/engine/sass/output/addon/components/product/image.scss b/tests/fixtures/engine/sass/output/addon/components/product/image.scss deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/sass/output/addon/components/product/image.scss +++ /dev/null @@ -1,15 +0,0 @@ -.image, -.placeholder-image { - aspect-ratio: 4 / 3; - border-radius: 0.75rem; - width: 100%; -} - -.image { - object-fit: cover; -} - -.placeholder-image { - background: linear-gradient(36deg, rgb(255 224 130 / 40%) 15%, rgb(255 248 225 / 80%) 90%); - min-width: 8rem; -} diff --git a/tests/fixtures/engine/sass/output/addon/controllers/products.js b/tests/fixtures/engine/sass/output/addon/controllers/products.js deleted file mode 100644 index dc6d34e..0000000 --- a/tests/fixtures/engine/sass/output/addon/controllers/products.js +++ /dev/null @@ -1,59 +0,0 @@ -import Controller from '@ember/controller'; -import { action } from '@ember/object'; -import { service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { restartableTask, timeout } from 'ember-concurrency'; - -export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; - - queryParams = ['name', 'sortBy']; - - @tracked name; - @tracked sortBy; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - get optionsForSorting() { - return [ - { - label: this.intl.t('routes.products.sort-by.name-ascending'), - value: 'name:asc', - }, - { - label: this.intl.t('routes.products.sort-by.name-descending'), - value: 'name:desc', - }, - { - label: this.intl.t('routes.products.sort-by.price-ascending'), - value: 'price:asc', - }, - { - label: this.intl.t('routes.products.sort-by.price-descending'), - value: 'price:desc', - }, - ]; - } - - @action resetQueryParameters() { - this.name = null; - this.sortBy = null; - } - - updateQueryParameters = restartableTask(async ({ key, value }) => { - const TIMEOUT_IN_MILLISECONDS = this.config.isTestEnvironment ? 1 : 300; - - await timeout(TIMEOUT_IN_MILLISECONDS); - - if (value === undefined || value === '') { - this[key] = null; - return; - } - - this[key] = value; - }); -} diff --git a/tests/fixtures/engine/sass/output/addon/routes/product-details.js b/tests/fixtures/engine/sass/output/addon/routes/product-details.js deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/sass/output/addon/routes/product-details.js +++ /dev/null @@ -1,32 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductDetailsRoute extends Route { - @service experiments; - @service router; - @service store; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('products.product', id); - return; - } - } - - model(params) { - const { id } = params; - - return this.store.findRecord('product', id); - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/sass/output/addon/routes/products.js b/tests/fixtures/engine/sass/output/addon/routes/products.js deleted file mode 100644 index 4a66f4c..0000000 --- a/tests/fixtures/engine/sass/output/addon/routes/products.js +++ /dev/null @@ -1,19 +0,0 @@ -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsRoute extends Route { - @service store; - - queryParams = { - name: { - refreshModel: true, - }, - sortBy: { - refreshModel: false, - }, - }; - - model(params) { - return this.store.query('product', params); - } -} diff --git a/tests/fixtures/engine/sass/output/addon/routes/products/product.js b/tests/fixtures/engine/sass/output/addon/routes/products/product.js deleted file mode 100644 index 4c21255..0000000 --- a/tests/fixtures/engine/sass/output/addon/routes/products/product.js +++ /dev/null @@ -1,38 +0,0 @@ -import { action } from '@ember/object'; -import Route from '@ember/routing/route'; -import { service } from '@ember/service'; - -export default class ProductsProductRoute extends Route { - @service experiments; - @service router; - - get isPartOfNestProductDetailsExperiment() { - return this.experiments.getVariant('nest-product-details') === 'v1'; - } - - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { - const { id } = params; - const products = this.modelFor('products'); - - const product = products.find((product) => product.id === id); - - if (!product) { - throw new Error(`Could not find the product with ID ${id}.`); - } - - return product; - } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } -} diff --git a/tests/fixtures/engine/sass/output/addon/styles/product-details.scss b/tests/fixtures/engine/sass/output/addon/styles/product-details.scss deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/sass/output/addon/styles/product-details.scss +++ /dev/null @@ -1,17 +0,0 @@ -.products { - display: grid; - grid-template-areas: - "product-details" - "actions"; - grid-template-columns: 1fr; - grid-template-rows: 1fr auto; -} - -.product-details { - grid-area: product-details; -} - -.actions { - grid-area: actions; - margin-top: 2rem; -} diff --git a/tests/fixtures/engine/sass/output/addon/styles/products.scss b/tests/fixtures/engine/sass/output/addon/styles/products.scss deleted file mode 100644 index ad39931..0000000 --- a/tests/fixtures/engine/sass/output/addon/styles/products.scss +++ /dev/null @@ -1,73 +0,0 @@ -.products-with-details { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto auto 1fr; - position: relative; -} - -.products { - display: grid; - grid-template-areas: - "filters" - "product-details" - "list"; - grid-template-columns: 1fr; - grid-template-rows: auto 0 1fr; - position: relative; -} - -.filters { - background-color: #15202d; - border-radius: 0.25rem; - box-shadow: inset 0 0 0.125rem #26313d; - display: flex; - flex-direction: column; - grid-area: filters; - margin-bottom: 2rem; - padding: 0.75rem 1.5rem 1.5rem; - position: sticky; - top: -1.5rem; - z-index: 100; -} - -.filter { - margin-bottom: 1.25rem; -} - -.filter:last-of-type { - margin-bottom: 0; -} - -.list { - display: grid; - grid-gap: 1.5rem 1rem; - grid-template-columns: - repeat( - auto-fit, - minmax(min(20rem, 100%), 1fr) - ); - grid-template-rows: 1fr; -} - -.product-details { - grid-area: product-details; -} - -@media screen and (min-width: 40rem) { - .products-with-details { - grid-template-areas: - "filters filters" - "list product-details"; - grid-template-columns: 1fr auto; - grid-template-rows: auto 1fr; - } - - .products-with-details .list { - /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ - height: max-content; - } -} diff --git a/tests/fixtures/engine/sass/output/addon/styles/products/product.scss b/tests/fixtures/engine/sass/output/addon/styles/products/product.scss deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/engine/sass/output/addon/styles/products/product.scss +++ /dev/null @@ -1,13 +0,0 @@ -.product-details { - margin-bottom: 3rem; - margin-left: 0; - width: 100%; -} - -@media screen and (min-width: 40rem) { - .product-details { - margin-bottom: 0; - margin-left: 2rem; - width: 25rem; - } -} diff --git a/tests/fixtures/engine/sass/output/addon/templates/product-details.hbs b/tests/fixtures/engine/sass/output/addon/templates/product-details.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/sass/output/addon/templates/product-details.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{page-title @model.name}} - - -
-
- -
- -
- - {{t "routes.product-details.back"}} - -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/addon/templates/products.hbs b/tests/fixtures/engine/sass/output/addon/templates/products.hbs deleted file mode 100644 index e2aeaf7..0000000 --- a/tests/fixtures/engine/sass/output/addon/templates/products.hbs +++ /dev/null @@ -1,62 +0,0 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
- -
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

- {{t "routes.products.no-products-found"}} -

- {{/each}} -
- -
- {{outlet}} -
-
-
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/addon/templates/products/product.hbs b/tests/fixtures/engine/sass/output/addon/templates/products/product.hbs deleted file mode 100644 index 6bd6231..0000000 --- a/tests/fixtures/engine/sass/output/addon/templates/products/product.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{page-title @model.name}} - -
- -
\ No newline at end of file diff --git a/tests/fixtures/engine/sass/output/package.json b/tests/fixtures/engine/sass/output/package.json deleted file mode 100644 index 228c322..0000000 --- a/tests/fixtures/engine/sass/output/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "my-engine", - "version": "0.0.0", - "keywords": [ - "ember-addon", - "ember-engine" - ], -} diff --git a/tests/fixtures/engine/sass/output/tests/integration/components/product/card-test.js b/tests/fixtures/engine/sass/output/tests/integration/components/product/card-test.js deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/sass/output/tests/integration/components/product/card-test.js +++ /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/sass/output/tests/integration/components/product/details-test.js b/tests/fixtures/engine/sass/output/tests/integration/components/product/details-test.js deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/sass/output/tests/integration/components/product/details-test.js +++ /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/sass/output/tests/integration/components/product/image-test.js b/tests/fixtures/engine/sass/output/tests/integration/components/product/image-test.js deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/sass/output/tests/integration/components/product/image-test.js +++ /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/sass/output/tests/unit/controllers/products-test.js b/tests/fixtures/engine/sass/output/tests/unit/controllers/products-test.js deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/sass/output/tests/unit/controllers/products-test.js +++ /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/sass/output/tests/unit/routes/product-details-test.js b/tests/fixtures/engine/sass/output/tests/unit/routes/product-details-test.js deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/sass/output/tests/unit/routes/product-details-test.js +++ /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/sass/output/tests/unit/routes/products-test.js b/tests/fixtures/engine/sass/output/tests/unit/routes/products-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/sass/output/tests/unit/routes/products-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/sass/output/tests/unit/routes/products/product-test.js b/tests/fixtures/engine/sass/output/tests/unit/routes/products/product-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/sass/output/tests/unit/routes/products/product-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -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'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/addon/application/route.ts b/tests/fixtures/engine/typescript/input/addon/application/route.ts new file mode 100644 index 0000000..72f0d5e --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/application/route.ts @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ApplicationRoute extends Route {} diff --git a/tests/fixtures/engine/typescript/input/addon/application/template.hbs b/tests/fixtures/engine/typescript/input/addon/application/template.hbs new file mode 100644 index 0000000..b18df32 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/application/template.hbs @@ -0,0 +1,3 @@ +{{page-title "My Engine"}} + +{{outlet}} \ No newline at end of file diff --git a/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/component.ts b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/component.ts new file mode 100644 index 0000000..4d05f3d --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/component.ts @@ -0,0 +1,18 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +type MenuItem = { + label: string; + route: string; +}; + +interface NavigationMenuSignature { + Args: { + menuItems: MenuItem[]; + name?: string; + }; +} + +const NavigationMenuComponent = + templateOnlyComponent(); + +export default NavigationMenuComponent; diff --git a/tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.css similarity index 85% rename from tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css rename to tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.css index 9bee6e9..7fdf679 100644 --- a/tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css +++ b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.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/input/app/components/navigation-menu/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs similarity index 91% rename from tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs rename to tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs index 061bf4c..1b36915 100644 --- a/tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs +++ b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs @@ -1,7 +1,7 @@