From 584b6b019f651a4c1d4711584c239c00b06ccd34 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Fri, 11 Oct 2024 18:37:36 +0200 Subject: [PATCH 1/5] chore: Recreated test fixtures (v1-addon) --- tests/fixtures/v1-addon/javascript/index.ts | 6 - .../components/ui/form/checkbox/component.js | 41 --- .../components/ui/form/checkbox/styles.css | 37 --- .../components/ui/form/checkbox/template.hbs | 40 --- .../addon/components/ui/form/component.js | 17 -- .../addon/components/ui/form/field/styles.css | 83 ------ .../components/ui/form/field/template.hbs | 27 -- .../components/ui/form/information/styles.css | 16 -- .../ui/form/information/template.hbs | 23 -- .../components/ui/form/input/component.js | 42 --- .../addon/components/ui/form/input/styles.css | 24 -- .../components/ui/form/input/template.hbs | 33 --- .../components/ui/form/number/component.js | 37 --- .../components/ui/form/number/styles.css | 9 - .../components/ui/form/number/template.hbs | 34 --- .../components/ui/form/select/component.js | 40 --- .../components/ui/form/select/styles.css | 33 --- .../components/ui/form/select/template.hbs | 79 ------ .../input/addon/components/ui/form/styles.css | 19 -- .../addon/components/ui/form/template.hbs | 70 ----- .../components/ui/form/textarea/component.js | 30 --- .../components/ui/form/textarea/styles.css | 24 -- .../components/ui/form/textarea/template.hbs | 33 --- .../input/addon/components/ui/page/styles.css | 20 -- .../addon/components/ui/page/template.hbs | 9 - .../addon/utils/components/form/index.js | 26 -- .../components/ui/form/checkbox/component.js | 1 - .../components/ui/form/checkbox/template.js | 1 - .../input/app/components/ui/form/component.js | 1 - .../app/components/ui/form/field/template.js | 1 - .../ui/form/information/template.js | 1 - .../app/components/ui/form/input/component.js | 1 - .../app/components/ui/form/input/template.js | 1 - .../components/ui/form/number/component.js | 1 - .../app/components/ui/form/number/template.js | 1 - .../components/ui/form/select/component.js | 1 - .../app/components/ui/form/select/template.js | 1 - .../input/app/components/ui/form/template.js | 1 - .../components/ui/form/textarea/component.js | 1 - .../components/ui/form/textarea/template.js | 1 - .../input/app/components/ui/page/template.js | 1 - .../v1-addon/javascript/input/package.json | 7 - .../javascript/input/tests/helpers/index.js | 10 - .../ui/form/checkbox/component-test.js | 209 --------------- .../components/ui/form/component-test.js | 179 ------------- .../ui/form/field/component-test.js | 74 ------ .../ui/form/information/component-test.js | 63 ----- .../ui/form/input/component-test.js | 169 ------------ .../ui/form/number/component-test.js | 159 ------------ .../ui/form/select/component-test.js | 244 ------------------ .../ui/form/textarea/component-test.js | 144 ----------- .../components/ui/page/component-test.js | 29 --- .../output/addon/components/ui/form.css | 19 -- .../output/addon/components/ui/form.hbs | 70 ----- .../output/addon/components/ui/form.js | 17 -- .../addon/components/ui/form/checkbox.css | 37 --- .../addon/components/ui/form/checkbox.hbs | 40 --- .../addon/components/ui/form/checkbox.js | 41 --- .../output/addon/components/ui/form/field.css | 83 ------ .../output/addon/components/ui/form/field.hbs | 27 -- .../addon/components/ui/form/information.css | 16 -- .../addon/components/ui/form/information.hbs | 23 -- .../output/addon/components/ui/form/input.css | 24 -- .../output/addon/components/ui/form/input.hbs | 33 --- .../output/addon/components/ui/form/input.js | 42 --- .../addon/components/ui/form/number.css | 9 - .../addon/components/ui/form/number.hbs | 34 --- .../output/addon/components/ui/form/number.js | 37 --- .../addon/components/ui/form/select.css | 33 --- .../addon/components/ui/form/select.hbs | 79 ------ .../output/addon/components/ui/form/select.js | 40 --- .../addon/components/ui/form/textarea.css | 24 -- .../addon/components/ui/form/textarea.hbs | 33 --- .../addon/components/ui/form/textarea.js | 30 --- .../output/addon/components/ui/page.css | 20 -- .../output/addon/components/ui/page.hbs | 9 - .../addon/utils/components/form/index.js | 26 -- .../output/app/components/ui/form.js | 1 - .../output/app/components/ui/form/checkbox.js | 1 - .../output/app/components/ui/form/field.js | 1 - .../app/components/ui/form/information.js | 1 - .../output/app/components/ui/form/input.js | 1 - .../output/app/components/ui/form/number.js | 1 - .../output/app/components/ui/form/select.js | 1 - .../output/app/components/ui/form/textarea.js | 1 - .../output/app/components/ui/page.js | 1 - .../v1-addon/javascript/output/package.json | 7 - .../javascript/output/tests/helpers/index.js | 10 - .../integration/components/ui/form-test.js | 179 ------------- .../components/ui/form/checkbox-test.js | 209 --------------- .../components/ui/form/field-test.js | 74 ------ .../components/ui/form/information-test.js | 63 ----- .../components/ui/form/input-test.js | 169 ------------ .../components/ui/form/number-test.js | 159 ------------ .../components/ui/form/select-test.js | 244 ------------------ .../components/ui/form/textarea-test.js | 144 ----------- .../integration/components/ui/page-test.js | 29 --- tests/fixtures/v1-addon/sass/index.ts | 6 - .../components/ui/form/checkbox/component.js | 41 --- .../components/ui/form/checkbox/styles.scss | 37 --- .../components/ui/form/checkbox/template.hbs | 40 --- .../addon/components/ui/form/component.js | 17 -- .../components/ui/form/field/styles.scss | 83 ------ .../components/ui/form/field/template.hbs | 27 -- .../ui/form/information/styles.scss | 16 -- .../ui/form/information/template.hbs | 23 -- .../components/ui/form/input/component.js | 42 --- .../components/ui/form/input/styles.scss | 24 -- .../components/ui/form/input/template.hbs | 33 --- .../components/ui/form/number/component.js | 37 --- .../components/ui/form/number/styles.scss | 9 - .../components/ui/form/number/template.hbs | 34 --- .../components/ui/form/select/component.js | 40 --- .../components/ui/form/select/styles.scss | 33 --- .../components/ui/form/select/template.hbs | 79 ------ .../addon/components/ui/form/styles.scss | 19 -- .../addon/components/ui/form/template.hbs | 70 ----- .../components/ui/form/textarea/component.js | 30 --- .../components/ui/form/textarea/styles.scss | 24 -- .../components/ui/form/textarea/template.hbs | 33 --- .../addon/components/ui/page/styles.scss | 20 -- .../addon/components/ui/page/template.hbs | 9 - .../addon/utils/components/form/index.js | 26 -- .../components/ui/form/checkbox/component.js | 1 - .../components/ui/form/checkbox/template.js | 1 - .../input/app/components/ui/form/component.js | 1 - .../app/components/ui/form/field/template.js | 1 - .../ui/form/information/template.js | 1 - .../app/components/ui/form/input/component.js | 1 - .../app/components/ui/form/input/template.js | 1 - .../components/ui/form/number/component.js | 1 - .../app/components/ui/form/number/template.js | 1 - .../components/ui/form/select/component.js | 1 - .../app/components/ui/form/select/template.js | 1 - .../input/app/components/ui/form/template.js | 1 - .../components/ui/form/textarea/component.js | 1 - .../components/ui/form/textarea/template.js | 1 - .../input/app/components/ui/page/template.js | 1 - .../fixtures/v1-addon/sass/input/package.json | 7 - .../sass/input/tests/helpers/index.js | 10 - .../ui/form/checkbox/component-test.js | 209 --------------- .../components/ui/form/component-test.js | 179 ------------- .../ui/form/field/component-test.js | 74 ------ .../ui/form/information/component-test.js | 63 ----- .../ui/form/input/component-test.js | 169 ------------ .../ui/form/number/component-test.js | 159 ------------ .../ui/form/select/component-test.js | 244 ------------------ .../ui/form/textarea/component-test.js | 144 ----------- .../components/ui/page/component-test.js | 29 --- .../sass/output/addon/components/ui/form.hbs | 70 ----- .../sass/output/addon/components/ui/form.js | 17 -- .../sass/output/addon/components/ui/form.scss | 19 -- .../addon/components/ui/form/checkbox.hbs | 40 --- .../addon/components/ui/form/checkbox.js | 41 --- .../addon/components/ui/form/checkbox.scss | 37 --- .../output/addon/components/ui/form/field.hbs | 27 -- .../addon/components/ui/form/field.scss | 83 ------ .../addon/components/ui/form/information.hbs | 23 -- .../addon/components/ui/form/information.scss | 16 -- .../output/addon/components/ui/form/input.hbs | 33 --- .../output/addon/components/ui/form/input.js | 42 --- .../addon/components/ui/form/input.scss | 24 -- .../addon/components/ui/form/number.hbs | 34 --- .../output/addon/components/ui/form/number.js | 37 --- .../addon/components/ui/form/number.scss | 9 - .../addon/components/ui/form/select.hbs | 79 ------ .../output/addon/components/ui/form/select.js | 40 --- .../addon/components/ui/form/select.scss | 33 --- .../addon/components/ui/form/textarea.hbs | 33 --- .../addon/components/ui/form/textarea.js | 30 --- .../addon/components/ui/form/textarea.scss | 24 -- .../sass/output/addon/components/ui/page.hbs | 9 - .../sass/output/addon/components/ui/page.scss | 20 -- .../addon/utils/components/form/index.js | 26 -- .../sass/output/app/components/ui/form.js | 1 - .../output/app/components/ui/form/checkbox.js | 1 - .../output/app/components/ui/form/field.js | 1 - .../app/components/ui/form/information.js | 1 - .../output/app/components/ui/form/input.js | 1 - .../output/app/components/ui/form/number.js | 1 - .../output/app/components/ui/form/select.js | 1 - .../output/app/components/ui/form/textarea.js | 1 - .../sass/output/app/components/ui/page.js | 1 - .../v1-addon/sass/output/package.json | 7 - .../sass/output/tests/helpers/index.js | 10 - .../integration/components/ui/form-test.js | 179 ------------- .../components/ui/form/checkbox-test.js | 209 --------------- .../components/ui/form/field-test.js | 74 ------ .../components/ui/form/information-test.js | 63 ----- .../components/ui/form/input-test.js | 169 ------------ .../components/ui/form/number-test.js | 159 ------------ .../components/ui/form/select-test.js | 244 ------------------ .../components/ui/form/textarea-test.js | 144 ----------- .../integration/components/ui/page-test.js | 29 --- .../components/navigation-menu/component.ts | 18 ++ .../components/navigation-menu/styles.css | 21 ++ .../components/navigation-menu/template.hbs | 15 ++ .../components/ui/form/checkbox/component.ts | 41 --- .../components/ui/form/checkbox/styles.css | 37 --- .../components/ui/form/checkbox/template.hbs | 40 --- .../addon/components/ui/form/component.ts | 17 -- .../addon/components/ui/form/field/styles.css | 83 ------ .../components/ui/form/field/template.hbs | 27 -- .../components/ui/form/information/styles.css | 16 -- .../ui/form/information/template.hbs | 23 -- .../components/ui/form/input/component.ts | 42 --- .../addon/components/ui/form/input/styles.css | 24 -- .../components/ui/form/input/template.hbs | 33 --- .../components/ui/form/number/component.ts | 37 --- .../components/ui/form/number/styles.css | 9 - .../components/ui/form/number/template.hbs | 34 --- .../components/ui/form/select/component.ts | 40 --- .../components/ui/form/select/styles.css | 33 --- .../components/ui/form/select/template.hbs | 79 ------ .../input/addon/components/ui/form/styles.css | 19 -- .../addon/components/ui/form/template.hbs | 70 ----- .../components/ui/form/textarea/component.ts | 30 --- .../components/ui/form/textarea/styles.css | 24 -- .../components/ui/form/textarea/template.hbs | 33 --- .../addon/components/ui/page/component.d.ts | 0 .../addon/components/ui/page/component.ts | 14 + .../input/addon/components/ui/page/styles.css | 12 +- .../addon/components/ui/page/template.hbs | 4 +- .../input/addon/experiments/service.ts | 15 ++ .../v1-addon/typescript/input/addon/index.ts | 2 + .../input/addon/products/controller.ts | 13 + .../addon/products/product/controller.ts | 7 + .../input/addon/products/product/route.ts | 22 ++ .../input/addon/products/product/styles.css | 13 + .../input/addon/products/product/template.hbs | 5 + .../typescript/input/addon/products/route.ts | 37 +++ .../input/addon/products/styles.css | 20 ++ .../input/addon/products/template.hbs | 13 + .../component.d.ts => styles/.placeholder} | 0 .../input/addon/template-registry.ts | 9 + .../addon/utils/components/form/index.ts | 26 -- .../input/addon/utils/routes/index.ts | 14 + .../input/addon/utils/routes/products.ts | 11 + .../components/navigation-menu/component.js | 1 + .../components/navigation-menu/template.js | 1 + .../components/ui/form/checkbox/component.js | 1 - .../components/ui/form/checkbox/template.js | 1 - .../input/app/components/ui/form/component.js | 1 - .../app/components/ui/form/field/template.js | 1 - .../ui/form/information/template.js | 1 - .../app/components/ui/form/input/component.js | 1 - .../app/components/ui/form/input/template.js | 1 - .../components/ui/form/number/component.js | 1 - .../app/components/ui/form/number/template.js | 1 - .../components/ui/form/select/component.js | 1 - .../app/components/ui/form/select/template.js | 1 - .../input/app/components/ui/form/template.js | 1 - .../components/ui/form/textarea/component.js | 1 - .../components/ui/form/textarea/template.js | 1 - .../input/app/components/ui/page/component.js | 1 + .../input/app/experiments/service.js | 1 + .../input/app/products/controller.js | 1 + .../input/app/products/product/controller.js | 1 + .../input/app/products/product/route.js | 1 + .../input/app/products/product/template.js | 1 + .../typescript/input/app/products/route.js | 1 + .../typescript/input/app/products/template.js | 1 + .../typescript/input/tests/helpers/index.ts | 10 - .../navigation-menu/component-test.ts | 21 ++ .../ui/form/checkbox/component-test.ts | 209 --------------- .../components/ui/form/component-test.ts | 179 ------------- .../ui/form/field/component-test.ts | 74 ------ .../ui/form/information/component-test.ts | 63 ----- .../ui/form/input/component-test.ts | 169 ------------ .../ui/form/number/component-test.ts | 159 ------------ .../ui/form/select/component-test.ts | 244 ------------------ .../ui/form/textarea/component-test.ts | 144 ----------- .../components/ui/page/component-test.ts | 17 +- .../tests/unit/experiments/service-test.ts | 12 + .../tests/unit/products/controller-test.ts | 12 + .../unit/products/product/controller-test.ts | 12 + .../tests/unit/products/product/route-test.ts | 11 + .../input/tests/unit/products/route-test.ts | 11 + .../addon/components/navigation-menu.css | 21 ++ .../addon/components/navigation-menu.hbs | 15 ++ .../addon/components/navigation-menu.ts | 18 ++ .../output/addon/components/ui/form.css | 19 -- .../output/addon/components/ui/form.hbs | 70 ----- .../output/addon/components/ui/form.ts | 17 -- .../addon/components/ui/form/checkbox.css | 37 --- .../addon/components/ui/form/checkbox.hbs | 40 --- .../addon/components/ui/form/checkbox.ts | 41 --- .../output/addon/components/ui/form/field.css | 83 ------ .../addon/components/ui/form/field.d.ts | 0 .../output/addon/components/ui/form/field.hbs | 27 -- .../addon/components/ui/form/information.css | 16 -- .../addon/components/ui/form/information.d.ts | 0 .../addon/components/ui/form/information.hbs | 23 -- .../output/addon/components/ui/form/input.css | 24 -- .../output/addon/components/ui/form/input.hbs | 33 --- .../output/addon/components/ui/form/input.ts | 42 --- .../addon/components/ui/form/number.css | 9 - .../addon/components/ui/form/number.hbs | 34 --- .../output/addon/components/ui/form/number.ts | 37 --- .../addon/components/ui/form/select.css | 33 --- .../addon/components/ui/form/select.hbs | 79 ------ .../output/addon/components/ui/form/select.ts | 40 --- .../addon/components/ui/form/textarea.css | 24 -- .../addon/components/ui/form/textarea.hbs | 33 --- .../addon/components/ui/form/textarea.ts | 30 --- .../output/addon/components/ui/page.css | 12 +- .../output/addon/components/ui/page.d.ts | 0 .../output/addon/components/ui/page.hbs | 4 +- .../output/addon/components/ui/page.ts | 14 + .../output/addon/controllers/products.ts | 13 + .../addon/controllers/products/product.ts | 7 + .../v1-addon/typescript/output/addon/index.ts | 2 + .../output/addon/routes/products.ts | 37 +++ .../output/addon/routes/products/product.ts | 22 ++ .../output/addon/services/experiments.ts | 15 ++ .../addon/styles/.placeholder} | 0 .../output/addon/styles/products.css | 20 ++ .../output/addon/styles/products/product.css | 13 + .../output/addon/template-registry.ts | 9 + .../output/addon/templates/products.hbs | 13 + .../addon/templates/products/product.hbs | 5 + .../addon/utils/components/form/index.ts | 26 -- .../output/addon/utils/routes/index.ts | 14 + .../output/addon/utils/routes/products.ts | 11 + .../output/app/components/navigation-menu.js | 1 + .../output/app/components/ui/form.js | 1 - .../output/app/components/ui/form/checkbox.js | 1 - .../output/app/components/ui/form/field.js | 1 - .../app/components/ui/form/information.js | 1 - .../output/app/components/ui/form/input.js | 1 - .../output/app/components/ui/form/number.js | 1 - .../output/app/components/ui/form/select.js | 1 - .../output/app/components/ui/form/textarea.js | 1 - .../output/app/controllers/products.js | 1 + .../app/controllers/products/product.js | 1 + .../typescript/output/app/routes/products.js | 1 + .../output/app/routes/products/product.js | 1 + .../output/app/services/experiments.js | 1 + .../output/app/templates/products.js | 1 + .../output/app/templates/products/product.js | 1 + .../typescript/output/tests/helpers/index.ts | 10 - .../components/navigation-menu-test.ts | 21 ++ .../integration/components/ui/form-test.ts | 179 ------------- .../components/ui/form/checkbox-test.ts | 209 --------------- .../components/ui/form/field-test.ts | 74 ------ .../components/ui/form/information-test.ts | 63 ----- .../components/ui/form/input-test.ts | 169 ------------ .../components/ui/form/number-test.ts | 159 ------------ .../components/ui/form/select-test.ts | 244 ------------------ .../components/ui/form/textarea-test.ts | 144 ----------- .../integration/components/ui/page-test.ts | 17 +- .../tests/unit/controllers/products-test.ts | 12 + .../unit/controllers/products/product-test.ts | 12 + .../output/tests/unit/routes/products-test.ts | 11 + .../unit/routes/products/product-test.ts | 11 + .../tests/unit/services/experiments-test.ts | 12 + update-test-fixtures.sh | 16 -- 357 files changed, 698 insertions(+), 12808 deletions(-) delete mode 100644 tests/fixtures/v1-addon/javascript/index.ts delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/field/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/field/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/information/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/information/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/page/styles.css delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/components/ui/page/template.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/input/addon/utils/components/form/index.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/field/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/information/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/app/components/ui/page/template.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/package.json delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/helpers/index.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/field/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/information/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/input/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/number/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/select/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/textarea/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/page/component-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/field.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/field.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/information.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/information.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.css delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.hbs delete mode 100644 tests/fixtures/v1-addon/javascript/output/addon/utils/components/form/index.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/field.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/information.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/input.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/number.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/select.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/form/textarea.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/app/components/ui/page.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/package.json delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/helpers/index.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/checkbox-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/field-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/information-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/input-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/number-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/select-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/textarea-test.js delete mode 100644 tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/page-test.js delete mode 100644 tests/fixtures/v1-addon/sass/index.ts delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/field/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/field/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/information/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/information/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/page/styles.scss delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/components/ui/page/template.hbs delete mode 100644 tests/fixtures/v1-addon/sass/input/addon/utils/components/form/index.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/field/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/information/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/app/components/ui/page/template.js delete mode 100644 tests/fixtures/v1-addon/sass/input/package.json delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/helpers/index.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/checkbox/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/field/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/information/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/input/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/number/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/select/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/textarea/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/page/component-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/field.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/field.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/information.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/information.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.js delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/page.hbs delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/components/ui/page.scss delete mode 100644 tests/fixtures/v1-addon/sass/output/addon/utils/components/form/index.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/field.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/information.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/input.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/number.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/select.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/form/textarea.js delete mode 100644 tests/fixtures/v1-addon/sass/output/app/components/ui/page.js delete mode 100644 tests/fixtures/v1-addon/sass/output/package.json delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/helpers/index.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/checkbox-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/field-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/information-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/input-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/number-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/select-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/textarea-test.js delete mode 100644 tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/page-test.js create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/component.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/styles.css create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/component.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/styles.css delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/template.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.d.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/experiments/service.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/controller.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/product/controller.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/product/route.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/product/styles.css create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/product/template.hbs create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/route.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/styles.css create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/products/template.hbs rename tests/fixtures/v1-addon/typescript/input/addon/{components/ui/form/field/component.d.ts => styles/.placeholder} (100%) create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/template-registry.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/addon/utils/components/form/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/utils/routes/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/addon/utils/routes/products.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/component.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/field/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/information/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/template.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/components/ui/page/component.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/experiments/service.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/controller.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/product/controller.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/product/route.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/product/template.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/route.js create mode 100644 tests/fixtures/v1-addon/typescript/input/app/products/template.js delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/helpers/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/navigation-menu/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/checkbox/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/field/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/information/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/input/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/number/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/select/component-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/textarea/component-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/unit/experiments/service-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/unit/products/controller-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/controller-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/route-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/input/tests/unit/products/route-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.css create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.hbs create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.d.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.d.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.css delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.d.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/controllers/products.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/controllers/products/product.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/routes/products.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/routes/products/product.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/services/experiments.ts rename tests/fixtures/v1-addon/typescript/{input/addon/components/ui/form/information/component.d.ts => output/addon/styles/.placeholder} (100%) create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/styles/products.css create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/styles/products/product.css create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/template-registry.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/templates/products.hbs create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/templates/products/product.hbs delete mode 100644 tests/fixtures/v1-addon/typescript/output/addon/utils/components/form/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/utils/routes/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/addon/utils/routes/products.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/navigation-menu.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/field.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/information.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/input.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/number.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/select.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/app/components/ui/form/textarea.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/controllers/products.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/controllers/products/product.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/routes/products.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/routes/products/product.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/services/experiments.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/templates/products.js create mode 100644 tests/fixtures/v1-addon/typescript/output/app/templates/products/product.js delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/helpers/index.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/navigation-menu-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/checkbox-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/field-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/information-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/input-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/number-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/select-test.ts delete mode 100644 tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/textarea-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products/product-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products/product-test.ts create mode 100644 tests/fixtures/v1-addon/typescript/output/tests/unit/services/experiments-test.ts diff --git a/tests/fixtures/v1-addon/javascript/index.ts b/tests/fixtures/v1-addon/javascript/index.ts deleted file mode 100644 index c611a8d..0000000 --- a/tests/fixtures/v1-addon/javascript/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('v1-addon/javascript/input'); -const outputProject = convertFixtureToJson('v1-addon/javascript/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/component.js deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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-v1-addon/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/v1-addon/javascript/input/addon/components/ui/form/checkbox/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/styles.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/checkbox/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/checkbox/template.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/component.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/field/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/field/styles.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/field/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/field/template.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/information/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/information/styles.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/information/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/information/template.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/input/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/component.js deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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-v1-addon/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/v1-addon/javascript/input/addon/components/ui/form/input/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/styles.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/input/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/input/template.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/number/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/component.js deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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-v1-addon/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/v1-addon/javascript/input/addon/components/ui/form/number/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/styles.css deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/styles.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/number/template.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/select/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/component.js deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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-v1-addon/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/v1-addon/javascript/input/addon/components/ui/form/select/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/styles.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/select/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/select/template.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/styles.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/template.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/textarea/component.js b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/component.js deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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-v1-addon/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/v1-addon/javascript/input/addon/components/ui/form/textarea/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/styles.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/form/textarea/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/form/textarea/template.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/page/styles.css b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/page/styles.css deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/addon/components/ui/page/template.hbs b/tests/fixtures/v1-addon/javascript/input/addon/components/ui/page/template.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/components/ui/page/template.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/javascript/input/addon/utils/components/form/index.js b/tests/fixtures/v1-addon/javascript/input/addon/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/javascript/input/addon/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/v1-addon/javascript/input/app/components/ui/form/checkbox/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/component.js deleted file mode 100644 index 480bdc5..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/template.js deleted file mode 100644 index ba69d19..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/checkbox/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/component.js deleted file mode 100644 index 275e1c7..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/field/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/field/template.js deleted file mode 100644 index db01216..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/field/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/information/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/information/template.js deleted file mode 100644 index 560f113..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/information/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/component.js deleted file mode 100644 index 026b7d6..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/template.js deleted file mode 100644 index 9b230c6..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/input/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/component.js deleted file mode 100644 index b6add9f..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/template.js deleted file mode 100644 index 2cbd3b3..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/number/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/component.js deleted file mode 100644 index b33a875..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/template.js deleted file mode 100644 index 472f876..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/select/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/template.js deleted file mode 100644 index 2c23d79..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/component.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/component.js deleted file mode 100644 index b88612b..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/component'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/template.js deleted file mode 100644 index 0157909..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/form/textarea/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/app/components/ui/page/template.js b/tests/fixtures/v1-addon/javascript/input/app/components/ui/page/template.js deleted file mode 100644 index 3561bd5..0000000 --- a/tests/fixtures/v1-addon/javascript/input/app/components/ui/page/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/page/template'; diff --git a/tests/fixtures/v1-addon/javascript/input/package.json b/tests/fixtures/v1-addon/javascript/input/package.json deleted file mode 100644 index 8915041..0000000 --- a/tests/fixtures/v1-addon/javascript/input/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "my-v1-addon", - "version": "0.0.0", - "keywords": [ - "ember-addon" - ], -} diff --git a/tests/fixtures/v1-addon/javascript/input/tests/helpers/index.js b/tests/fixtures/v1-addon/javascript/input/tests/helpers/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/javascript/input/tests/helpers/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/v1-addon/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/component-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/field/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/field/component-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/information/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/information/component-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/input/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/input/component-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/number/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/number/component-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/select/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/select/component-test.js deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/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-v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/form/textarea/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/form/textarea/component-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/input/tests/integration/components/ui/page/component-test.js b/tests/fixtures/v1-addon/javascript/input/tests/integration/components/ui/page/component-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/addon/components/ui/form.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/checkbox.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/checkbox.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/checkbox.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/checkbox.js deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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-v1-addon/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/v1-addon/javascript/output/addon/components/ui/form/field.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/field.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/field.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/field.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/information.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/information.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/information.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/information.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/input.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/input.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/input.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/input.js deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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-v1-addon/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/v1-addon/javascript/output/addon/components/ui/form/number.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.css deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/number.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/number.js deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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-v1-addon/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/v1-addon/javascript/output/addon/components/ui/form/select.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/select.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/select.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/select.js deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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-v1-addon/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/v1-addon/javascript/output/addon/components/ui/form/textarea.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/textarea.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/addon/components/ui/form/textarea.js b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/form/textarea.js deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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-v1-addon/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/v1-addon/javascript/output/addon/components/ui/page.css b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.css deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.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/v1-addon/javascript/output/addon/components/ui/page.hbs b/tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/components/ui/page.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/javascript/output/addon/utils/components/form/index.js b/tests/fixtures/v1-addon/javascript/output/addon/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/javascript/output/addon/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/v1-addon/javascript/output/app/components/ui/form.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form.js deleted file mode 100644 index b6b748f..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/checkbox.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/checkbox.js deleted file mode 100644 index 54e6449..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/checkbox.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/field.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/field.js deleted file mode 100644 index 0939d04..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/field.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/information.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/information.js deleted file mode 100644 index 72d6356..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/information.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/input.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/input.js deleted file mode 100644 index 9125a59..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/input.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/number.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/number.js deleted file mode 100644 index b11f9f2..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/number.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/select.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/select.js deleted file mode 100644 index 796e903..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/select.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/textarea.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/textarea.js deleted file mode 100644 index 9604d0a..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/form/textarea.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea'; diff --git a/tests/fixtures/v1-addon/javascript/output/app/components/ui/page.js b/tests/fixtures/v1-addon/javascript/output/app/components/ui/page.js deleted file mode 100644 index 50ab105..0000000 --- a/tests/fixtures/v1-addon/javascript/output/app/components/ui/page.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/page'; diff --git a/tests/fixtures/v1-addon/javascript/output/package.json b/tests/fixtures/v1-addon/javascript/output/package.json deleted file mode 100644 index 8915041..0000000 --- a/tests/fixtures/v1-addon/javascript/output/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "my-v1-addon", - "version": "0.0.0", - "keywords": [ - "ember-addon" - ], -} diff --git a/tests/fixtures/v1-addon/javascript/output/tests/helpers/index.js b/tests/fixtures/v1-addon/javascript/output/tests/helpers/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/javascript/output/tests/helpers/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/v1-addon/javascript/output/tests/integration/components/ui/form-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/checkbox-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/checkbox-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/field-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/field-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/information-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/information-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/input-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/input-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/number-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/number-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/select-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/select-test.js deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/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-v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/form/textarea-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/form/textarea-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/javascript/output/tests/integration/components/ui/page-test.js b/tests/fixtures/v1-addon/javascript/output/tests/integration/components/ui/page-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/index.ts b/tests/fixtures/v1-addon/sass/index.ts deleted file mode 100644 index 727e1fd..0000000 --- a/tests/fixtures/v1-addon/sass/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { convertFixtureToJson } from '@codemod-utils/tests'; - -const inputProject = convertFixtureToJson('v1-addon/sass/input'); -const outputProject = convertFixtureToJson('v1-addon/sass/output'); - -export { inputProject, outputProject }; diff --git a/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/component.js deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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-v1-addon/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/v1-addon/sass/input/addon/components/ui/form/checkbox/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/styles.scss deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/checkbox/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/checkbox/template.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/component.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/field/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/field/styles.scss deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/field/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/field/template.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/information/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/information/styles.scss deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/information/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/information/template.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/input/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/component.js deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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-v1-addon/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/v1-addon/sass/input/addon/components/ui/form/input/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/styles.scss deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/input/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/input/template.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/number/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/component.js deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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-v1-addon/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/v1-addon/sass/input/addon/components/ui/form/number/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/styles.scss deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/styles.scss +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/number/template.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/select/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/component.js deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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-v1-addon/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/v1-addon/sass/input/addon/components/ui/form/select/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/styles.scss deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/select/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/select/template.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/styles.scss deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/template.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/textarea/component.js b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/component.js deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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-v1-addon/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/v1-addon/sass/input/addon/components/ui/form/textarea/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/styles.scss deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/form/textarea/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/form/textarea/template.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/page/styles.scss b/tests/fixtures/v1-addon/sass/input/addon/components/ui/page/styles.scss deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/addon/components/ui/page/template.hbs b/tests/fixtures/v1-addon/sass/input/addon/components/ui/page/template.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/components/ui/page/template.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/sass/input/addon/utils/components/form/index.js b/tests/fixtures/v1-addon/sass/input/addon/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/sass/input/addon/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/v1-addon/sass/input/app/components/ui/form/checkbox/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/component.js deleted file mode 100644 index 480bdc5..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/template.js deleted file mode 100644 index ba69d19..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/checkbox/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/component.js deleted file mode 100644 index 275e1c7..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/field/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/field/template.js deleted file mode 100644 index db01216..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/field/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/information/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/information/template.js deleted file mode 100644 index 560f113..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/information/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/component.js deleted file mode 100644 index 026b7d6..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/template.js deleted file mode 100644 index 9b230c6..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/input/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/component.js deleted file mode 100644 index b6add9f..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/template.js deleted file mode 100644 index 2cbd3b3..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/number/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/component.js deleted file mode 100644 index b33a875..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/template.js deleted file mode 100644 index 472f876..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/select/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/template.js deleted file mode 100644 index 2c23d79..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/component.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/component.js deleted file mode 100644 index b88612b..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/component'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/template.js deleted file mode 100644 index 0157909..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/form/textarea/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/template'; diff --git a/tests/fixtures/v1-addon/sass/input/app/components/ui/page/template.js b/tests/fixtures/v1-addon/sass/input/app/components/ui/page/template.js deleted file mode 100644 index 3561bd5..0000000 --- a/tests/fixtures/v1-addon/sass/input/app/components/ui/page/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/page/template'; diff --git a/tests/fixtures/v1-addon/sass/input/package.json b/tests/fixtures/v1-addon/sass/input/package.json deleted file mode 100644 index 8915041..0000000 --- a/tests/fixtures/v1-addon/sass/input/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "my-v1-addon", - "version": "0.0.0", - "keywords": [ - "ember-addon" - ], -} diff --git a/tests/fixtures/v1-addon/sass/input/tests/helpers/index.js b/tests/fixtures/v1-addon/sass/input/tests/helpers/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/sass/input/tests/helpers/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/v1-addon/sass/input/tests/integration/components/ui/form/checkbox/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/checkbox/component-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/component-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/field/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/field/component-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/information/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/information/component-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/input/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/input/component-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/number/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/number/component-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/select/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/select/component-test.js deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/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-v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/form/textarea/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/form/textarea/component-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/input/tests/integration/components/ui/page/component-test.js b/tests/fixtures/v1-addon/sass/input/tests/integration/components/ui/page/component-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/addon/components/ui/form.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form.js deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form.scss deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/checkbox.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/checkbox.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.js deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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-v1-addon/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/v1-addon/sass/output/addon/components/ui/form/checkbox.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/checkbox.scss deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/field.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/field.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/field.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/field.scss deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/information.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/information.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/information.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/information.scss deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/input.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/input.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.js deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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-v1-addon/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/v1-addon/sass/output/addon/components/ui/form/input.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/input.scss deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/number.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/number.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.js deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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-v1-addon/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/v1-addon/sass/output/addon/components/ui/form/number.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.scss deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/number.scss +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/select.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.js deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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-v1-addon/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/v1-addon/sass/output/addon/components/ui/form/select.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/select.scss deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/textarea.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/form/textarea.js b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.js deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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-v1-addon/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/v1-addon/sass/output/addon/components/ui/form/textarea.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/form/textarea.scss deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/components/ui/page.hbs b/tests/fixtures/v1-addon/sass/output/addon/components/ui/page.hbs deleted file mode 100644 index 7d90711..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/components/ui/page.hbs +++ /dev/null @@ -1,9 +0,0 @@ -
-

- {{@title}} -

- -
- {{yield}} -
-
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/sass/output/addon/components/ui/page.scss b/tests/fixtures/v1-addon/sass/output/addon/components/ui/page.scss deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/addon/utils/components/form/index.js b/tests/fixtures/v1-addon/sass/output/addon/utils/components/form/index.js deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/sass/output/addon/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/v1-addon/sass/output/app/components/ui/form.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form.js deleted file mode 100644 index b6b748f..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/checkbox.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/checkbox.js deleted file mode 100644 index 54e6449..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/checkbox.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/field.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/field.js deleted file mode 100644 index 0939d04..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/field.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/information.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/information.js deleted file mode 100644 index 72d6356..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/information.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/input.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/input.js deleted file mode 100644 index 9125a59..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/input.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/number.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/number.js deleted file mode 100644 index b11f9f2..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/number.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/select.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/select.js deleted file mode 100644 index 796e903..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/select.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/textarea.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/form/textarea.js deleted file mode 100644 index 9604d0a..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/form/textarea.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea'; diff --git a/tests/fixtures/v1-addon/sass/output/app/components/ui/page.js b/tests/fixtures/v1-addon/sass/output/app/components/ui/page.js deleted file mode 100644 index 50ab105..0000000 --- a/tests/fixtures/v1-addon/sass/output/app/components/ui/page.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/page'; diff --git a/tests/fixtures/v1-addon/sass/output/package.json b/tests/fixtures/v1-addon/sass/output/package.json deleted file mode 100644 index 8915041..0000000 --- a/tests/fixtures/v1-addon/sass/output/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "my-v1-addon", - "version": "0.0.0", - "keywords": [ - "ember-addon" - ], -} diff --git a/tests/fixtures/v1-addon/sass/output/tests/helpers/index.js b/tests/fixtures/v1-addon/sass/output/tests/helpers/index.js deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/sass/output/tests/helpers/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/v1-addon/sass/output/tests/integration/components/ui/form-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form-test.js deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/checkbox-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/checkbox-test.js deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/field-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/field-test.js deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/information-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/information-test.js deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/input-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/input-test.js deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/number-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/number-test.js deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/select-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/select-test.js deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/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-v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/form/textarea-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/form/textarea-test.js deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/sass/output/tests/integration/components/ui/page-test.js b/tests/fixtures/v1-addon/sass/output/tests/integration/components/ui/page-test.js deleted file mode 100644 index f73bfa2..0000000 --- a/tests/fixtures/v1-addon/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/v1-addon/typescript/input/addon/components/navigation-menu/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/component.ts new file mode 100644 index 0000000..4d05f3d --- /dev/null +++ b/tests/fixtures/v1-addon/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/v1-addon/typescript/input/addon/components/navigation-menu/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/styles.css new file mode 100644 index 0000000..7fdf679 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/styles.css @@ -0,0 +1,21 @@ +.list { + align-items: center; + display: flex; +} + +.link { + display: inline-block; + font-size: 0.875rem; + padding: 0.875rem 1rem; + text-decoration: none; + white-space: nowrap; +} + +.link:global(.active) { + background-color: #15202d; +} + +.link:hover { + background-color: #26313d; + transition: background-color 0.17s; +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/template.hbs new file mode 100644 index 0000000..1b36915 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/components/navigation-menu/template.hbs @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/component.ts deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/component.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/input/addon/components/ui/form/checkbox/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/styles.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/checkbox/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/checkbox/template.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/component.ts deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/component.ts +++ /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/v1-addon/typescript/input/addon/components/ui/form/field/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/styles.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/field/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/template.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/information/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/styles.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/information/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/template.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/input/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/component.ts deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/component.ts +++ /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-v1-addon/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/v1-addon/typescript/input/addon/components/ui/form/input/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/styles.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/input/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/input/template.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/number/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/component.ts deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/input/addon/components/ui/form/number/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/styles.css deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/styles.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/number/template.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/select/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/component.ts deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/input/addon/components/ui/form/select/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/styles.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/select/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/select/template.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/styles.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/template.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/textarea/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/component.ts deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/input/addon/components/ui/form/textarea/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/styles.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/form/textarea/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/textarea/template.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/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/v1-addon/typescript/input/addon/components/ui/page/component.d.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.ts b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.ts new file mode 100644 index 0000000..ce86432 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/component.ts @@ -0,0 +1,14 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +interface UiPageSignature { + Args: { + title: string; + }; + Blocks: { + default: []; + }; +} + +const UiPageComponent = templateOnlyComponent(); + +export default UiPageComponent; diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/styles.css index ee54620..24409c1 100644 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/styles.css +++ b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/styles.css @@ -1,8 +1,8 @@ .container { display: grid; grid-template-areas: - "header" - "body"; + "title" + "content"; grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100% - 3em); @@ -11,10 +11,10 @@ scrollbar-gutter: stable; } -.header { - grid-area: header; +.title { + grid-area: title; } -.body { - grid-area: body; +.content { + grid-area: content; } diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/template.hbs index 7d90711..1c5ed81 100644 --- a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/template.hbs +++ b/tests/fixtures/v1-addon/typescript/input/addon/components/ui/page/template.hbs @@ -1,9 +1,9 @@
-

+

{{@title}}

-
+
{{yield}}
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/input/addon/experiments/service.ts b/tests/fixtures/v1-addon/typescript/input/addon/experiments/service.ts new file mode 100644 index 0000000..0dff7b6 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/experiments/service.ts @@ -0,0 +1,15 @@ +import Service from '@ember/service'; + +export default class ExperimentsService extends Service { + decideVariant(experimentName: string): void { + if (experimentName === 'nest-product-details') { + // TODO + } + } +} + +declare module '@ember/service' { + interface Registry { + experiments: ExperimentsService; + } +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/index.ts b/tests/fixtures/v1-addon/typescript/input/addon/index.ts new file mode 100644 index 0000000..5695b40 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/index.ts @@ -0,0 +1,2 @@ +export { default as NavigationMenu } from './components/navigation-menu/component'; +export { default as UiPage } from './components/ui/page/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/controller.ts b/tests/fixtures/v1-addon/typescript/input/addon/products/controller.ts new file mode 100644 index 0000000..6db2eeb --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/controller.ts @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; +import { tracked } from '@glimmer/tracking'; + +import type { Model } from './route'; + +export default class ProductsController extends Controller { + declare model: Model; + + queryParams = ['name', 'sortBy']; + + @tracked name: string | null = null; + @tracked sortBy: string | null = null; +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/product/controller.ts b/tests/fixtures/v1-addon/typescript/input/addon/products/product/controller.ts new file mode 100644 index 0000000..0dc16dc --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/product/controller.ts @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +import type { Model } from './route'; + +export default class ProductsProductController extends Controller { + declare model: Model; +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/product/route.ts b/tests/fixtures/v1-addon/typescript/input/addon/products/product/route.ts new file mode 100644 index 0000000..d5d7508 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/product/route.ts @@ -0,0 +1,22 @@ +import Route from '@ember/routing/route'; + +import type { ModelFrom } from '../../utils/routes'; +import type { Product } from '../../utils/routes/products'; +import type ProductsRoute from '../route'; + +export default class ProductsProductRoute extends Route { + model(params: { id: string }): Product { + const { id } = params; + const products = this.modelFor('products') as ModelFrom; + + const product = products.find((product) => product.id === id); + + if (!product) { + throw new Error(`Could not find the product with ID ${id}.`); + } + + return product; + } +} + +export type Model = ModelFrom; diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/product/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/products/product/styles.css new file mode 100644 index 0000000..afa2d07 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/product/styles.css @@ -0,0 +1,13 @@ +.product-details { + margin-bottom: 3rem; + margin-left: 0; + width: 100%; +} + +@media screen and (width >= 40rem) { + .product-details { + margin-bottom: 0; + margin-left: 2rem; + width: 25rem; + } +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/product/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/products/product/template.hbs new file mode 100644 index 0000000..26c4d6f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/product/template.hbs @@ -0,0 +1,5 @@ +{{page-title this.model.name}} + +
+ Product details go here. +
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/route.ts b/tests/fixtures/v1-addon/typescript/input/addon/products/route.ts new file mode 100644 index 0000000..fd4a40f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/route.ts @@ -0,0 +1,37 @@ +import type Owner from '@ember/owner'; +import Route from '@ember/routing/route'; +import { type Registry as Services, service } from '@ember/service'; + +import type { ModelFrom } from '../utils/routes'; +import type { Product } from '../utils/routes/products'; +import type ProductsController from './controller'; + +export default class ProductsRoute extends Route { + @service declare experiments: Services['experiments']; + + queryParams = { + name: { + refreshModel: true, + }, + sortBy: { + refreshModel: false, + }, + }; + + constructor(owner: Owner) { + super(owner); + + this.experiments.decideVariant('nest-product-details'); + } + + model(): Product[] { + return []; + } + + resetController(controller: ProductsController) { + controller.name = null; + controller.sortBy = null; + } +} + +export type Model = ModelFrom; diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/styles.css b/tests/fixtures/v1-addon/typescript/input/addon/products/styles.css new file mode 100644 index 0000000..93cb5f8 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/styles.css @@ -0,0 +1,20 @@ +.products { + display: grid; + grid-template-areas: + "product-details" + "list"; + grid-template-columns: 1fr; + grid-template-rows: 0 1fr; + position: relative; +} + +.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; +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/products/template.hbs b/tests/fixtures/v1-addon/typescript/input/addon/products/template.hbs new file mode 100644 index 0000000..9c2596a --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/products/template.hbs @@ -0,0 +1,13 @@ +{{page-title "Products"}} + + +
+
+ List of products goes here. +
+ +
+ {{outlet}} +
+
+
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/component.d.ts b/tests/fixtures/v1-addon/typescript/input/addon/styles/.placeholder similarity index 100% rename from tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/field/component.d.ts rename to tests/fixtures/v1-addon/typescript/input/addon/styles/.placeholder diff --git a/tests/fixtures/v1-addon/typescript/input/addon/template-registry.ts b/tests/fixtures/v1-addon/typescript/input/addon/template-registry.ts new file mode 100644 index 0000000..14570ca --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/template-registry.ts @@ -0,0 +1,9 @@ +import type NavigationMenuComponent from './components/navigation-menu/component'; +import type UiPageComponent from './components/ui/page/component'; + +export default interface MyV1AddonRegistry { + NavigationMenu: typeof NavigationMenuComponent; + 'Ui::Page': typeof UiPageComponent; + 'navigation-menu': typeof NavigationMenuComponent; + 'ui/page': typeof UiPageComponent; +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/utils/components/form/index.ts b/tests/fixtures/v1-addon/typescript/input/addon/utils/components/form/index.ts deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/typescript/input/addon/utils/components/form/index.ts +++ /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/v1-addon/typescript/input/addon/utils/routes/index.ts b/tests/fixtures/v1-addon/typescript/input/addon/utils/routes/index.ts new file mode 100644 index 0000000..41a2270 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/utils/routes/index.ts @@ -0,0 +1,14 @@ +/* + https://docs.ember-cli-typescript.com/cookbook/working-with-route-models +*/ +import type Route from '@ember/routing/route'; + +/** + Get the resolved type of an item. + - If the item is a promise, the result will be the resolved value type + - If the item is not a promise, the result will just be the type of the item + */ +type Resolved

= P extends Promise ? T : P; + +/** Get the resolved model value from a route. */ +export type ModelFrom = Resolved>; diff --git a/tests/fixtures/v1-addon/typescript/input/addon/utils/routes/products.ts b/tests/fixtures/v1-addon/typescript/input/addon/utils/routes/products.ts new file mode 100644 index 0000000..e7240b3 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/addon/utils/routes/products.ts @@ -0,0 +1,11 @@ +export type Product = { + categoryId: string; + description: string; + id: string; + imageUrl: string; + name: string; + price: number; + rating: number; + seller: string; + shortDescription: string; +}; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/component.js new file mode 100644 index 0000000..548640b --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/component.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/components/navigation-menu/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/template.js new file mode 100644 index 0000000..8d33ce7 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/components/navigation-menu/template.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/components/navigation-menu/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/component.js deleted file mode 100644 index 480bdc5..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/template.js deleted file mode 100644 index ba69d19..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/checkbox/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/component.js deleted file mode 100644 index 275e1c7..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/field/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/field/template.js deleted file mode 100644 index db01216..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/field/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/information/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/information/template.js deleted file mode 100644 index 560f113..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/information/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/component.js deleted file mode 100644 index 026b7d6..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/template.js deleted file mode 100644 index 9b230c6..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/input/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/component.js deleted file mode 100644 index b6add9f..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/template.js deleted file mode 100644 index 2cbd3b3..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/number/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/component.js deleted file mode 100644 index b33a875..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/template.js deleted file mode 100644 index 472f876..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/select/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/template.js deleted file mode 100644 index 2c23d79..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/component.js deleted file mode 100644 index b88612b..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/component.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/template.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/template.js deleted file mode 100644 index 0157909..0000000 --- a/tests/fixtures/v1-addon/typescript/input/app/components/ui/form/textarea/template.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/components/ui/page/component.js b/tests/fixtures/v1-addon/typescript/input/app/components/ui/page/component.js new file mode 100644 index 0000000..cb0ab0c --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/components/ui/page/component.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/components/ui/page/component'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/experiments/service.js b/tests/fixtures/v1-addon/typescript/input/app/experiments/service.js new file mode 100644 index 0000000..3c9901c --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/experiments/service.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/experiments/service'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/controller.js b/tests/fixtures/v1-addon/typescript/input/app/products/controller.js new file mode 100644 index 0000000..f5f5082 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/controller.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/controller'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/product/controller.js b/tests/fixtures/v1-addon/typescript/input/app/products/product/controller.js new file mode 100644 index 0000000..7a88118 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/product/controller.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/product/controller'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/product/route.js b/tests/fixtures/v1-addon/typescript/input/app/products/product/route.js new file mode 100644 index 0000000..cf1d13f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/product/route.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/product/route'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/product/template.js b/tests/fixtures/v1-addon/typescript/input/app/products/product/template.js new file mode 100644 index 0000000..fe7dd24 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/product/template.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/product/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/route.js b/tests/fixtures/v1-addon/typescript/input/app/products/route.js new file mode 100644 index 0000000..617bdd2 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/route.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/route'; diff --git a/tests/fixtures/v1-addon/typescript/input/app/products/template.js b/tests/fixtures/v1-addon/typescript/input/app/products/template.js new file mode 100644 index 0000000..ee0f3e2 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/app/products/template.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/products/template'; diff --git a/tests/fixtures/v1-addon/typescript/input/tests/helpers/index.ts b/tests/fixtures/v1-addon/typescript/input/tests/helpers/index.ts deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/helpers/index.ts +++ /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/v1-addon/typescript/input/tests/integration/components/navigation-menu/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/navigation-menu/component-test.ts new file mode 100644 index 0000000..b0d6f92 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/navigation-menu/component-test.ts @@ -0,0 +1,21 @@ +import { render } from '@ember/test-helpers'; +import { setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | navigation-menu', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/checkbox/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/checkbox/component-test.ts deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/checkbox/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/component-test.ts deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/field/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/field/component-test.ts deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/field/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/information/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/information/component-test.ts deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/information/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/input/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/input/component-test.ts deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/input/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/number/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/number/component-test.ts deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/number/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/form/select/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/select/component-test.ts deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/select/component-test.ts +++ /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-v1-addon/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/v1-addon/typescript/input/tests/integration/components/ui/form/textarea/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/textarea/component-test.ts deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/form/textarea/component-test.ts +++ /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/v1-addon/typescript/input/tests/integration/components/ui/page/component-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/page/component-test.ts index f73bfa2..38acff3 100644 --- a/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/page/component-test.ts +++ b/tests/fixtures/v1-addon/typescript/input/tests/integration/components/ui/page/component-test.ts @@ -1,29 +1,20 @@ import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; +import { setupRenderingTest } from 'dummy/tests/helpers'; 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) { + test('it renders', 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.'); + assert.ok(true); }); }); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/unit/experiments/service-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/unit/experiments/service-test.ts new file mode 100644 index 0000000..cd9b19c --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/unit/experiments/service-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Service | experiments', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const service = this.owner.lookup('service:experiments'); + assert.ok(service); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/unit/products/controller-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/controller-test.ts new file mode 100644 index 0000000..25d4c13 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/controller-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.owner.lookup('controller:products'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/controller-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/controller-test.ts new file mode 100644 index 0000000..7742978 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/controller-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products/product', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.owner.lookup('controller:products/product'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/route-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/route-test.ts new file mode 100644 index 0000000..0bff25f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/product/route-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | products/product', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.owner.lookup('route:products/product'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/input/tests/unit/products/route-test.ts b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/route-test.ts new file mode 100644 index 0000000..c295452 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/input/tests/unit/products/route-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | products', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.owner.lookup('route:products'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.css b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.css new file mode 100644 index 0000000..7fdf679 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.css @@ -0,0 +1,21 @@ +.list { + align-items: center; + display: flex; +} + +.link { + display: inline-block; + font-size: 0.875rem; + padding: 0.875rem 1rem; + text-decoration: none; + white-space: nowrap; +} + +.link:global(.active) { + background-color: #15202d; +} + +.link:hover { + background-color: #26313d; + transition: background-color 0.17s; +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.hbs new file mode 100644 index 0000000..1b36915 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.hbs @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.ts new file mode 100644 index 0000000..4d05f3d --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/navigation-menu.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/v1-addon/typescript/output/addon/components/ui/form.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.css deleted file mode 100644 index 99368b4..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.hbs deleted file mode 100644 index 7bf9a49..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.ts deleted file mode 100644 index c106bc5..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form.ts +++ /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/v1-addon/typescript/output/addon/components/ui/form/checkbox.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.css deleted file mode 100644 index bc12045..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/checkbox.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.hbs deleted file mode 100644 index 5602a6e..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/checkbox.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.ts deleted file mode 100644 index c940d10..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/checkbox.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/output/addon/components/ui/form/field.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.css deleted file mode 100644 index 37822f1..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/field.d.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/field.hbs deleted file mode 100644 index 524b0dd..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/information.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.css deleted file mode 100644 index 12527a6..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/information.d.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/information.hbs deleted file mode 100644 index aedd03f..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/input.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.css deleted file mode 100644 index 86fb423..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/input.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.hbs deleted file mode 100644 index a8b3326..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/input.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.ts deleted file mode 100644 index b4f1ee8..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/input.ts +++ /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-v1-addon/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/v1-addon/typescript/output/addon/components/ui/form/number.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.css deleted file mode 100644 index 3802a5a..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.css +++ /dev/null @@ -1,9 +0,0 @@ -.input { - composes: input from "my-v1-addon/components/ui/form/input"; -} - -.input.is-disabled { - background-color: #b2c9d4; - color: #546e7a; - cursor: not-allowed; -} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.hbs deleted file mode 100644 index 32a1e0d..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/number.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.ts deleted file mode 100644 index c2dc0c4..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/number.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/output/addon/components/ui/form/select.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.css deleted file mode 100644 index ca1b585..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/select.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.hbs deleted file mode 100644 index 5492e8f..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/select.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.ts deleted file mode 100644 index 8a6a2be..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/select.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/output/addon/components/ui/form/textarea.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.css deleted file mode 100644 index dae135d..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/textarea.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.hbs deleted file mode 100644 index b4a57e8..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/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/v1-addon/typescript/output/addon/components/ui/form/textarea.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.ts deleted file mode 100644 index ca9d087..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/form/textarea.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { action, get } from '@ember/object'; -import Component from '@glimmer/component'; -import { generateErrorMessage } from 'my-v1-addon/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/v1-addon/typescript/output/addon/components/ui/page.css b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.css index ee54620..24409c1 100644 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.css +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.css @@ -1,8 +1,8 @@ .container { display: grid; grid-template-areas: - "header" - "body"; + "title" + "content"; grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: calc(100% - 3em); @@ -11,10 +11,10 @@ scrollbar-gutter: stable; } -.header { - grid-area: header; +.title { + grid-area: title; } -.body { - grid-area: body; +.content { + grid-area: content; } diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.d.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.hbs b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.hbs index 7d90711..1c5ed81 100644 --- a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.hbs +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.hbs @@ -1,9 +1,9 @@
-

+

{{@title}}

-
+
{{yield}}
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.ts b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.ts new file mode 100644 index 0000000..ce86432 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/components/ui/page.ts @@ -0,0 +1,14 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +interface UiPageSignature { + Args: { + title: string; + }; + Blocks: { + default: []; + }; +} + +const UiPageComponent = templateOnlyComponent(); + +export default UiPageComponent; diff --git a/tests/fixtures/v1-addon/typescript/output/addon/controllers/products.ts b/tests/fixtures/v1-addon/typescript/output/addon/controllers/products.ts new file mode 100644 index 0000000..6db2eeb --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/controllers/products.ts @@ -0,0 +1,13 @@ +import Controller from '@ember/controller'; +import { tracked } from '@glimmer/tracking'; + +import type { Model } from './route'; + +export default class ProductsController extends Controller { + declare model: Model; + + queryParams = ['name', 'sortBy']; + + @tracked name: string | null = null; + @tracked sortBy: string | null = null; +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/controllers/products/product.ts b/tests/fixtures/v1-addon/typescript/output/addon/controllers/products/product.ts new file mode 100644 index 0000000..0dc16dc --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/controllers/products/product.ts @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +import type { Model } from './route'; + +export default class ProductsProductController extends Controller { + declare model: Model; +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/index.ts b/tests/fixtures/v1-addon/typescript/output/addon/index.ts new file mode 100644 index 0000000..5695b40 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/index.ts @@ -0,0 +1,2 @@ +export { default as NavigationMenu } from './components/navigation-menu/component'; +export { default as UiPage } from './components/ui/page/component'; diff --git a/tests/fixtures/v1-addon/typescript/output/addon/routes/products.ts b/tests/fixtures/v1-addon/typescript/output/addon/routes/products.ts new file mode 100644 index 0000000..fd4a40f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/routes/products.ts @@ -0,0 +1,37 @@ +import type Owner from '@ember/owner'; +import Route from '@ember/routing/route'; +import { type Registry as Services, service } from '@ember/service'; + +import type { ModelFrom } from '../utils/routes'; +import type { Product } from '../utils/routes/products'; +import type ProductsController from './controller'; + +export default class ProductsRoute extends Route { + @service declare experiments: Services['experiments']; + + queryParams = { + name: { + refreshModel: true, + }, + sortBy: { + refreshModel: false, + }, + }; + + constructor(owner: Owner) { + super(owner); + + this.experiments.decideVariant('nest-product-details'); + } + + model(): Product[] { + return []; + } + + resetController(controller: ProductsController) { + controller.name = null; + controller.sortBy = null; + } +} + +export type Model = ModelFrom; diff --git a/tests/fixtures/v1-addon/typescript/output/addon/routes/products/product.ts b/tests/fixtures/v1-addon/typescript/output/addon/routes/products/product.ts new file mode 100644 index 0000000..d5d7508 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/routes/products/product.ts @@ -0,0 +1,22 @@ +import Route from '@ember/routing/route'; + +import type { ModelFrom } from '../../utils/routes'; +import type { Product } from '../../utils/routes/products'; +import type ProductsRoute from '../route'; + +export default class ProductsProductRoute extends Route { + model(params: { id: string }): Product { + const { id } = params; + const products = this.modelFor('products') as ModelFrom; + + const product = products.find((product) => product.id === id); + + if (!product) { + throw new Error(`Could not find the product with ID ${id}.`); + } + + return product; + } +} + +export type Model = ModelFrom; diff --git a/tests/fixtures/v1-addon/typescript/output/addon/services/experiments.ts b/tests/fixtures/v1-addon/typescript/output/addon/services/experiments.ts new file mode 100644 index 0000000..0dff7b6 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/services/experiments.ts @@ -0,0 +1,15 @@ +import Service from '@ember/service'; + +export default class ExperimentsService extends Service { + decideVariant(experimentName: string): void { + if (experimentName === 'nest-product-details') { + // TODO + } + } +} + +declare module '@ember/service' { + interface Registry { + experiments: ExperimentsService; + } +} diff --git a/tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/component.d.ts b/tests/fixtures/v1-addon/typescript/output/addon/styles/.placeholder similarity index 100% rename from tests/fixtures/v1-addon/typescript/input/addon/components/ui/form/information/component.d.ts rename to tests/fixtures/v1-addon/typescript/output/addon/styles/.placeholder diff --git a/tests/fixtures/v1-addon/typescript/output/addon/styles/products.css b/tests/fixtures/v1-addon/typescript/output/addon/styles/products.css new file mode 100644 index 0000000..93cb5f8 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/styles/products.css @@ -0,0 +1,20 @@ +.products { + display: grid; + grid-template-areas: + "product-details" + "list"; + grid-template-columns: 1fr; + grid-template-rows: 0 1fr; + position: relative; +} + +.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; +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/styles/products/product.css b/tests/fixtures/v1-addon/typescript/output/addon/styles/products/product.css new file mode 100644 index 0000000..afa2d07 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/styles/products/product.css @@ -0,0 +1,13 @@ +.product-details { + margin-bottom: 3rem; + margin-left: 0; + width: 100%; +} + +@media screen and (width >= 40rem) { + .product-details { + margin-bottom: 0; + margin-left: 2rem; + width: 25rem; + } +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/template-registry.ts b/tests/fixtures/v1-addon/typescript/output/addon/template-registry.ts new file mode 100644 index 0000000..14570ca --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/template-registry.ts @@ -0,0 +1,9 @@ +import type NavigationMenuComponent from './components/navigation-menu/component'; +import type UiPageComponent from './components/ui/page/component'; + +export default interface MyV1AddonRegistry { + NavigationMenu: typeof NavigationMenuComponent; + 'Ui::Page': typeof UiPageComponent; + 'navigation-menu': typeof NavigationMenuComponent; + 'ui/page': typeof UiPageComponent; +} diff --git a/tests/fixtures/v1-addon/typescript/output/addon/templates/products.hbs b/tests/fixtures/v1-addon/typescript/output/addon/templates/products.hbs new file mode 100644 index 0000000..9c2596a --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/templates/products.hbs @@ -0,0 +1,13 @@ +{{page-title "Products"}} + + +
+
+ List of products goes here. +
+ +
+ {{outlet}} +
+
+
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/output/addon/templates/products/product.hbs b/tests/fixtures/v1-addon/typescript/output/addon/templates/products/product.hbs new file mode 100644 index 0000000..26c4d6f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/templates/products/product.hbs @@ -0,0 +1,5 @@ +{{page-title this.model.name}} + +
+ Product details go here. +
\ No newline at end of file diff --git a/tests/fixtures/v1-addon/typescript/output/addon/utils/components/form/index.ts b/tests/fixtures/v1-addon/typescript/output/addon/utils/components/form/index.ts deleted file mode 100644 index 2045f9e..0000000 --- a/tests/fixtures/v1-addon/typescript/output/addon/utils/components/form/index.ts +++ /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/v1-addon/typescript/output/addon/utils/routes/index.ts b/tests/fixtures/v1-addon/typescript/output/addon/utils/routes/index.ts new file mode 100644 index 0000000..41a2270 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/utils/routes/index.ts @@ -0,0 +1,14 @@ +/* + https://docs.ember-cli-typescript.com/cookbook/working-with-route-models +*/ +import type Route from '@ember/routing/route'; + +/** + Get the resolved type of an item. + - If the item is a promise, the result will be the resolved value type + - If the item is not a promise, the result will just be the type of the item + */ +type Resolved

= P extends Promise ? T : P; + +/** Get the resolved model value from a route. */ +export type ModelFrom = Resolved>; diff --git a/tests/fixtures/v1-addon/typescript/output/addon/utils/routes/products.ts b/tests/fixtures/v1-addon/typescript/output/addon/utils/routes/products.ts new file mode 100644 index 0000000..e7240b3 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/addon/utils/routes/products.ts @@ -0,0 +1,11 @@ +export type Product = { + categoryId: string; + description: string; + id: string; + imageUrl: string; + name: string; + price: number; + rating: number; + seller: string; + shortDescription: string; +}; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/navigation-menu.js b/tests/fixtures/v1-addon/typescript/output/app/components/navigation-menu.js new file mode 100644 index 0000000..d2e21a3 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/components/navigation-menu.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/components/navigation-menu'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form.js deleted file mode 100644 index b6b748f..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/checkbox.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/checkbox.js deleted file mode 100644 index 54e6449..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/checkbox.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/checkbox'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/field.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/field.js deleted file mode 100644 index 0939d04..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/field.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/field'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/information.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/information.js deleted file mode 100644 index 72d6356..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/information.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/information'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/input.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/input.js deleted file mode 100644 index 9125a59..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/input.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/input'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/number.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/number.js deleted file mode 100644 index b11f9f2..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/number.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/number'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/select.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/select.js deleted file mode 100644 index 796e903..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/select.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/select'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/textarea.js b/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/textarea.js deleted file mode 100644 index 9604d0a..0000000 --- a/tests/fixtures/v1-addon/typescript/output/app/components/ui/form/textarea.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'my-v1-addon/components/ui/form/textarea'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/controllers/products.js b/tests/fixtures/v1-addon/typescript/output/app/controllers/products.js new file mode 100644 index 0000000..f183c52 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/controllers/products.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/controllers/products'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/controllers/products/product.js b/tests/fixtures/v1-addon/typescript/output/app/controllers/products/product.js new file mode 100644 index 0000000..6e39d3a --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/controllers/products/product.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/controllers/products/product'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/routes/products.js b/tests/fixtures/v1-addon/typescript/output/app/routes/products.js new file mode 100644 index 0000000..9ab88d2 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/routes/products.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/routes/products'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/routes/products/product.js b/tests/fixtures/v1-addon/typescript/output/app/routes/products/product.js new file mode 100644 index 0000000..464fb4a --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/routes/products/product.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/routes/products/product'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/services/experiments.js b/tests/fixtures/v1-addon/typescript/output/app/services/experiments.js new file mode 100644 index 0000000..b17371b --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/services/experiments.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/services/experiments'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/templates/products.js b/tests/fixtures/v1-addon/typescript/output/app/templates/products.js new file mode 100644 index 0000000..977d9d1 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/templates/products.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/templates/products'; diff --git a/tests/fixtures/v1-addon/typescript/output/app/templates/products/product.js b/tests/fixtures/v1-addon/typescript/output/app/templates/products/product.js new file mode 100644 index 0000000..3ba11a7 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/app/templates/products/product.js @@ -0,0 +1 @@ +export { default } from 'my-v1-addon/templates/products/product'; diff --git a/tests/fixtures/v1-addon/typescript/output/tests/helpers/index.ts b/tests/fixtures/v1-addon/typescript/output/tests/helpers/index.ts deleted file mode 100644 index 61ba67e..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/helpers/index.ts +++ /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/v1-addon/typescript/output/tests/integration/components/navigation-menu-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/navigation-menu-test.ts new file mode 100644 index 0000000..b0d6f92 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/navigation-menu-test.ts @@ -0,0 +1,21 @@ +import { render } from '@ember/test-helpers'; +import { setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | navigation-menu', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form-test.ts deleted file mode 100644 index a923cec..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/checkbox-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/checkbox-test.ts deleted file mode 100644 index 26452d0..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/checkbox-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/field-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/field-test.ts deleted file mode 100644 index 269ce1e..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/field-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/information-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/information-test.ts deleted file mode 100644 index 33a66ce..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/information-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/input-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/input-test.ts deleted file mode 100644 index 1dd2c13..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/input-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/number-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/number-test.ts deleted file mode 100644 index 0587bcc..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/number-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/form/select-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/select-test.ts deleted file mode 100644 index 2c0d7f2..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/select-test.ts +++ /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-v1-addon/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/v1-addon/typescript/output/tests/integration/components/ui/form/textarea-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/textarea-test.ts deleted file mode 100644 index a7fbc25..0000000 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/form/textarea-test.ts +++ /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/v1-addon/typescript/output/tests/integration/components/ui/page-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/page-test.ts index f73bfa2..38acff3 100644 --- a/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/page-test.ts +++ b/tests/fixtures/v1-addon/typescript/output/tests/integration/components/ui/page-test.ts @@ -1,29 +1,20 @@ import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; +import { setupRenderingTest } from 'dummy/tests/helpers'; 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) { + test('it renders', 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.'); + assert.ok(true); }); }); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products-test.ts new file mode 100644 index 0000000..25d4c13 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.owner.lookup('controller:products'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products/product-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products/product-test.ts new file mode 100644 index 0000000..7742978 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/unit/controllers/products/product-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products/product', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.owner.lookup('controller:products/product'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products-test.ts new file mode 100644 index 0000000..c295452 --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | products', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.owner.lookup('route:products'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products/product-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products/product-test.ts new file mode 100644 index 0000000..0bff25f --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/unit/routes/products/product-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | products/product', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.owner.lookup('route:products/product'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/v1-addon/typescript/output/tests/unit/services/experiments-test.ts b/tests/fixtures/v1-addon/typescript/output/tests/unit/services/experiments-test.ts new file mode 100644 index 0000000..cd9b19c --- /dev/null +++ b/tests/fixtures/v1-addon/typescript/output/tests/unit/services/experiments-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Service | experiments', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const service = this.owner.lookup('service:experiments'); + assert.ok(service); + }); +}); diff --git a/update-test-fixtures.sh b/update-test-fixtures.sh index 5fe11a1..f35a7c9 100755 --- a/update-test-fixtures.sh +++ b/update-test-fixtures.sh @@ -15,22 +15,6 @@ # Compile TypeScript pnpm build -# Update fixtures -rm -r "tests/fixtures/v1-addon/javascript/output" -cp -r "tests/fixtures/v1-addon/javascript/input" "tests/fixtures/v1-addon/javascript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/v1-addon/javascript/output" \ - --type v1-addon - -# Update fixtures -rm -r "tests/fixtures/v1-addon/sass/output" -cp -r "tests/fixtures/v1-addon/sass/input" "tests/fixtures/v1-addon/sass/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/v1-addon/sass/output" \ - --type v1-addon - # Update fixtures rm -r "tests/fixtures/v1-addon/typescript/output" cp -r "tests/fixtures/v1-addon/typescript/input" "tests/fixtures/v1-addon/typescript/output" From 56ac52c57b3105b9e78b9b9b96dfa9e227f29597 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Fri, 11 Oct 2024 18:54:23 +0200 Subject: [PATCH 2/5] chore: Recreated test fixtures (engine) --- tests/fixtures/engine/javascript/index.ts | 6 -- .../addon/components/product/card/styles.css | 101 ------------------ .../components/product/card/template.hbs | 51 --------- .../components/product/details/component.js | 8 -- .../components/product/details/styles.css | 45 -------- .../components/product/details/template.hbs | 72 ------------- .../components/product/image/component.js | 6 -- .../addon/components/product/image/styles.css | 15 --- .../components/product/image/template.hbs | 12 --- .../input/addon/product-details/route.js | 32 ------ .../input/addon/product-details/styles.css | 17 --- .../input/addon/product-details/template.hbs | 15 --- .../input/addon/products/controller.js | 59 ---------- .../input/addon/products/product/route.js | 38 ------- .../input/addon/products/product/styles.css | 13 --- .../input/addon/products/product/template.hbs | 5 - .../javascript/input/addon/products/route.js | 19 ---- .../input/addon/products/styles.css | 73 ------------- .../input/addon/products/template.hbs | 62 ----------- .../engine/javascript/input/package.json | 8 -- .../components/product/card/component-test.js | 71 ------------ .../product/details/component-test.js | 89 --------------- .../product/image/component-test.js | 18 ---- .../controllers/products/controller-test.js | 95 ---------------- .../tests/unit/product-details/route-test.js | 11 -- .../tests/unit/products/controller-test.js | 95 ---------------- .../tests/unit/products/product/route-test.js | 11 -- .../input/tests/unit/products/route-test.js | 11 -- .../unit/routes/product-details/route-test.js | 11 -- .../routes/products/product/route-test.js | 11 -- .../tests/unit/routes/products/route-test.js | 11 -- .../output/addon/components/product/card.css | 101 ------------------ .../output/addon/components/product/card.hbs | 51 --------- .../addon/components/product/details.css | 45 -------- .../addon/components/product/details.hbs | 72 ------------- .../addon/components/product/details.js | 8 -- .../output/addon/components/product/image.css | 15 --- .../output/addon/components/product/image.hbs | 12 --- .../output/addon/components/product/image.js | 6 -- .../output/addon/controllers/products.js | 59 ---------- .../output/addon/routes/product-details.js | 32 ------ .../output/addon/routes/products.js | 19 ---- .../output/addon/routes/products/product.js | 38 ------- .../output/addon/styles/product-details.css | 17 --- .../output/addon/styles/products.css | 73 ------------- .../output/addon/styles/products/product.css | 13 --- .../addon/templates/product-details.hbs | 15 --- .../output/addon/templates/products.hbs | 62 ----------- .../addon/templates/products/product.hbs | 5 - .../engine/javascript/output/package.json | 8 -- .../components/product/card-test.js | 71 ------------ .../components/product/details-test.js | 89 --------------- .../components/product/image-test.js | 18 ---- .../tests/unit/controllers/products-test.js | 95 ---------------- .../tests/unit/routes/product-details-test.js | 11 -- .../output/tests/unit/routes/products-test.js | 11 -- .../unit/routes/products/product-test.js | 11 -- tests/fixtures/engine/sass/index.ts | 6 -- .../addon/components/product/card/styles.scss | 101 ------------------ .../components/product/card/template.hbs | 51 --------- .../components/product/details/component.js | 8 -- .../components/product/details/styles.scss | 45 -------- .../components/product/details/template.hbs | 72 ------------- .../components/product/image/component.js | 6 -- .../components/product/image/styles.scss | 15 --- .../components/product/image/template.hbs | 12 --- .../sass/input/addon/product-details/route.js | 32 ------ .../input/addon/product-details/styles.scss | 17 --- .../input/addon/product-details/template.hbs | 15 --- .../sass/input/addon/products/controller.js | 59 ---------- .../input/addon/products/product/route.js | 38 ------- .../input/addon/products/product/styles.scss | 13 --- .../input/addon/products/product/template.hbs | 5 - .../engine/sass/input/addon/products/route.js | 19 ---- .../sass/input/addon/products/styles.scss | 73 ------------- .../sass/input/addon/products/template.hbs | 62 ----------- tests/fixtures/engine/sass/input/package.json | 8 -- .../components/product/card/component-test.js | 71 ------------ .../product/details/component-test.js | 89 --------------- .../product/image/component-test.js | 18 ---- .../controllers/products/controller-test.js | 95 ---------------- .../tests/unit/product-details/route-test.js | 11 -- .../tests/unit/products/controller-test.js | 95 ---------------- .../tests/unit/products/product/route-test.js | 11 -- .../input/tests/unit/products/route-test.js | 11 -- .../unit/routes/product-details/route-test.js | 11 -- .../routes/products/product/route-test.js | 11 -- .../tests/unit/routes/products/route-test.js | 11 -- .../output/addon/components/product/card.hbs | 51 --------- .../output/addon/components/product/card.scss | 101 ------------------ .../addon/components/product/details.hbs | 72 ------------- .../addon/components/product/details.js | 8 -- .../addon/components/product/details.scss | 45 -------- .../output/addon/components/product/image.hbs | 12 --- .../output/addon/components/product/image.js | 6 -- .../addon/components/product/image.scss | 15 --- .../sass/output/addon/controllers/products.js | 59 ---------- .../output/addon/routes/product-details.js | 32 ------ .../sass/output/addon/routes/products.js | 19 ---- .../output/addon/routes/products/product.js | 38 ------- .../output/addon/styles/product-details.scss | 17 --- .../sass/output/addon/styles/products.scss | 73 ------------- .../output/addon/styles/products/product.scss | 13 --- .../addon/templates/product-details.hbs | 15 --- .../sass/output/addon/templates/products.hbs | 62 ----------- .../addon/templates/products/product.hbs | 5 - .../fixtures/engine/sass/output/package.json | 8 -- .../components/product/card-test.js | 71 ------------ .../components/product/details-test.js | 89 --------------- .../components/product/image-test.js | 18 ---- .../tests/unit/controllers/products-test.js | 95 ---------------- .../tests/unit/routes/product-details-test.js | 11 -- .../output/tests/unit/routes/products-test.js | 11 -- .../unit/routes/products/product-test.js | 11 -- .../input/addon/application/route.ts | 3 + .../input/addon/application/template.hbs | 3 + .../components/navigation-menu/component.ts | 18 ++++ .../components/navigation-menu/styles.css | 21 ++++ .../components/navigation-menu/template.hbs | 15 +++ .../addon/components/product/card/styles.css | 101 ------------------ .../components/product/card/template.hbs | 51 --------- .../components/product/details/component.ts | 8 -- .../components/product/details/styles.css | 45 -------- .../components/product/details/template.hbs | 72 ------------- .../components/product/image/component.ts | 6 -- .../addon/components/product/image/styles.css | 15 --- .../components/product/image/template.hbs | 12 --- .../addon/components/ui/page/component.ts | 14 +++ .../input/addon/components/ui/page/styles.css | 20 ++++ .../addon/components/ui/page/template.hbs | 9 ++ .../engine/typescript/input/addon/engine.ts | 14 +++ .../input/addon/experiments/service.ts | 15 +++ .../input/addon/product-details/route.ts | 32 ------ .../input/addon/product-details/styles.css | 17 --- .../input/addon/product-details/template.hbs | 15 --- .../input/addon/products/controller.ts | 56 +--------- .../addon/products/product/controller.ts | 7 ++ .../input/addon/products/product/route.ts | 32 ++---- .../input/addon/products/product/styles.css | 2 +- .../input/addon/products/product/template.hbs | 4 +- .../typescript/input/addon/products/route.ts | 26 ++++- .../input/addon/products/styles.css | 57 +--------- .../input/addon/products/template.hbs | 59 +--------- .../engine/typescript/input/addon/routes.ts | 7 ++ .../component.d.ts => styles/.placeholder} | 0 .../input/addon/template-registry.ts | 9 ++ .../input/addon/utils/routes/index.ts | 14 +++ .../input/addon/utils/routes/products.ts | 11 ++ .../navigation-menu/component-test.ts | 20 ++++ .../components/product/card/component-test.ts | 71 ------------ .../product/details/component-test.ts | 89 --------------- .../product/image/component-test.ts | 18 ---- .../components/ui/page/component-test.ts | 19 ++++ .../tests/unit/application/route-test.ts | 11 ++ .../controllers/products/controller-test.ts | 95 ---------------- .../tests/unit/experiments/service-test.ts | 12 +++ .../tests/unit/product-details/route-test.ts | 11 -- .../tests/unit/products/controller-test.ts | 93 +--------------- .../unit/products/product/controller-test.ts | 12 +++ .../tests/unit/products/product/route-test.ts | 4 +- .../input/tests/unit/products/route-test.ts | 4 +- .../unit/routes/product-details/route-test.ts | 11 -- .../routes/products/product/route-test.ts | 11 -- .../tests/unit/routes/products/route-test.ts | 11 -- .../addon/components/navigation-menu.css | 21 ++++ .../addon/components/navigation-menu.hbs | 15 +++ .../addon/components/navigation-menu.ts | 18 ++++ .../output/addon/components/product/card.css | 101 ------------------ .../output/addon/components/product/card.hbs | 51 --------- .../addon/components/product/details.css | 45 -------- .../addon/components/product/details.hbs | 72 ------------- .../addon/components/product/details.ts | 8 -- .../output/addon/components/product/image.css | 15 --- .../output/addon/components/product/image.hbs | 12 --- .../output/addon/components/product/image.ts | 6 -- .../output/addon/components/ui/page.css | 20 ++++ .../output/addon/components/ui/page.hbs | 9 ++ .../output/addon/components/ui/page.ts | 14 +++ .../output/addon/controllers/products.ts | 56 +--------- .../addon/controllers/products/product.ts | 7 ++ .../engine/typescript/output/addon/engine.ts | 14 +++ .../engine/typescript/output/addon/routes.ts | 7 ++ .../output/addon/routes/application.ts | 3 + .../output/addon/routes/product-details.ts | 32 ------ .../output/addon/routes/products.ts | 26 ++++- .../output/addon/routes/products/product.ts | 32 ++---- .../output/addon/services/experiments.ts | 15 +++ .../product/card.d.ts => styles/.placeholder} | 0 .../output/addon/styles/product-details.css | 17 --- .../output/addon/styles/products.css | 57 +--------- .../output/addon/styles/products/product.css | 2 +- .../output/addon/template-registry.ts | 9 ++ .../output/addon/templates/application.hbs | 3 + .../addon/templates/product-details.hbs | 15 --- .../output/addon/templates/products.hbs | 59 +--------- .../addon/templates/products/product.hbs | 4 +- .../output/addon/utils/routes/index.ts | 14 +++ .../output/addon/utils/routes/products.ts | 11 ++ .../components/navigation-menu-test.ts | 20 ++++ .../components/product/card-test.ts | 71 ------------ .../components/product/details-test.ts | 89 --------------- .../components/product/image-test.ts | 18 ---- .../integration/components/ui/page-test.ts | 19 ++++ .../tests/unit/controllers/products-test.ts | 93 +--------------- .../unit/controllers/products/product-test.ts | 12 +++ .../tests/unit/routes/application-test.ts | 11 ++ .../tests/unit/routes/product-details-test.ts | 11 -- .../output/tests/unit/routes/products-test.ts | 4 +- .../unit/routes/products/product-test.ts | 4 +- .../tests/unit/services/experiments-test.ts | 12 +++ update-test-fixtures.sh | 32 ++---- 211 files changed, 624 insertions(+), 5940 deletions(-) delete mode 100644 tests/fixtures/engine/javascript/index.ts delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/card/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/card/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/details/component.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/details/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/details/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/image/component.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/image/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/components/product/image/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/addon/product-details/route.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/product-details/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/product-details/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/controller.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/product/route.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/product/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/product/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/route.js delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/styles.css delete mode 100644 tests/fixtures/engine/javascript/input/addon/products/template.hbs delete mode 100644 tests/fixtures/engine/javascript/input/package.json delete mode 100644 tests/fixtures/engine/javascript/input/tests/integration/components/product/card/component-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/integration/components/product/details/component-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/integration/components/product/image/component-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/controllers/products/controller-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/product-details/route-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/products/controller-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/products/product/route-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/products/route-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/routes/product-details/route-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/routes/products/product/route-test.js delete mode 100644 tests/fixtures/engine/javascript/input/tests/unit/routes/products/route-test.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/card.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/card.hbs delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/details.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/details.hbs delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/details.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/image.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/image.hbs delete mode 100644 tests/fixtures/engine/javascript/output/addon/components/product/image.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/controllers/products.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/routes/product-details.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/routes/products.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/routes/products/product.js delete mode 100644 tests/fixtures/engine/javascript/output/addon/styles/product-details.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/styles/products.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/styles/products/product.css delete mode 100644 tests/fixtures/engine/javascript/output/addon/templates/product-details.hbs delete mode 100644 tests/fixtures/engine/javascript/output/addon/templates/products.hbs delete mode 100644 tests/fixtures/engine/javascript/output/addon/templates/products/product.hbs delete mode 100644 tests/fixtures/engine/javascript/output/package.json delete mode 100644 tests/fixtures/engine/javascript/output/tests/integration/components/product/card-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/integration/components/product/details-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/integration/components/product/image-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/unit/controllers/products-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/unit/routes/product-details-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/unit/routes/products-test.js delete mode 100644 tests/fixtures/engine/javascript/output/tests/unit/routes/products/product-test.js delete mode 100644 tests/fixtures/engine/sass/index.ts delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/card/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/card/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/details/component.js delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/details/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/details/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/image/component.js delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/image/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/components/product/image/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/addon/product-details/route.js delete mode 100644 tests/fixtures/engine/sass/input/addon/product-details/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/product-details/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/addon/products/controller.js delete mode 100644 tests/fixtures/engine/sass/input/addon/products/product/route.js delete mode 100644 tests/fixtures/engine/sass/input/addon/products/product/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/products/product/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/addon/products/route.js delete mode 100644 tests/fixtures/engine/sass/input/addon/products/styles.scss delete mode 100644 tests/fixtures/engine/sass/input/addon/products/template.hbs delete mode 100644 tests/fixtures/engine/sass/input/package.json delete mode 100644 tests/fixtures/engine/sass/input/tests/integration/components/product/card/component-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/integration/components/product/details/component-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/integration/components/product/image/component-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/controllers/products/controller-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/product-details/route-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/products/controller-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/products/product/route-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/products/route-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/routes/product-details/route-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/routes/products/product/route-test.js delete mode 100644 tests/fixtures/engine/sass/input/tests/unit/routes/products/route-test.js delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/card.hbs delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/card.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/details.hbs delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/details.js delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/details.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/image.hbs delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/image.js delete mode 100644 tests/fixtures/engine/sass/output/addon/components/product/image.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/controllers/products.js delete mode 100644 tests/fixtures/engine/sass/output/addon/routes/product-details.js delete mode 100644 tests/fixtures/engine/sass/output/addon/routes/products.js delete mode 100644 tests/fixtures/engine/sass/output/addon/routes/products/product.js delete mode 100644 tests/fixtures/engine/sass/output/addon/styles/product-details.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/styles/products.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/styles/products/product.scss delete mode 100644 tests/fixtures/engine/sass/output/addon/templates/product-details.hbs delete mode 100644 tests/fixtures/engine/sass/output/addon/templates/products.hbs delete mode 100644 tests/fixtures/engine/sass/output/addon/templates/products/product.hbs delete mode 100644 tests/fixtures/engine/sass/output/package.json delete mode 100644 tests/fixtures/engine/sass/output/tests/integration/components/product/card-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/integration/components/product/details-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/integration/components/product/image-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/unit/controllers/products-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/unit/routes/product-details-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/unit/routes/products-test.js delete mode 100644 tests/fixtures/engine/sass/output/tests/unit/routes/products/product-test.js create mode 100644 tests/fixtures/engine/typescript/input/addon/application/route.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/application/template.hbs create mode 100644 tests/fixtures/engine/typescript/input/addon/components/navigation-menu/component.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.css create mode 100644 tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/card/styles.css delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/card/template.hbs delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/details/component.ts delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/details/styles.css delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/details/template.hbs delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/image/component.ts delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/image/styles.css delete mode 100644 tests/fixtures/engine/typescript/input/addon/components/product/image/template.hbs create mode 100644 tests/fixtures/engine/typescript/input/addon/components/ui/page/component.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/components/ui/page/styles.css create mode 100644 tests/fixtures/engine/typescript/input/addon/components/ui/page/template.hbs create mode 100644 tests/fixtures/engine/typescript/input/addon/engine.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/experiments/service.ts delete mode 100644 tests/fixtures/engine/typescript/input/addon/product-details/route.ts delete mode 100644 tests/fixtures/engine/typescript/input/addon/product-details/styles.css delete mode 100644 tests/fixtures/engine/typescript/input/addon/product-details/template.hbs create mode 100644 tests/fixtures/engine/typescript/input/addon/products/product/controller.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/routes.ts rename tests/fixtures/engine/typescript/input/addon/{components/product/card/component.d.ts => styles/.placeholder} (100%) create mode 100644 tests/fixtures/engine/typescript/input/addon/template-registry.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts create mode 100644 tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts create mode 100644 tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts create mode 100644 tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts create mode 100644 tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts create mode 100644 tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts create mode 100644 tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/unit/routes/products/product/route-test.ts delete mode 100644 tests/fixtures/engine/typescript/input/tests/unit/routes/products/route-test.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css create mode 100644 tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs create mode 100644 tests/fixtures/engine/typescript/output/addon/components/navigation-menu.ts delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/card.css delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/card.hbs delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/details.css delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/details.hbs delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/details.ts delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/image.css delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/image.hbs delete mode 100644 tests/fixtures/engine/typescript/output/addon/components/product/image.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/components/ui/page.css create mode 100644 tests/fixtures/engine/typescript/output/addon/components/ui/page.hbs create mode 100644 tests/fixtures/engine/typescript/output/addon/components/ui/page.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/controllers/products/product.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/engine.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/routes.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/routes/application.ts delete mode 100644 tests/fixtures/engine/typescript/output/addon/routes/product-details.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/services/experiments.ts rename tests/fixtures/engine/typescript/output/addon/{components/product/card.d.ts => styles/.placeholder} (100%) delete mode 100644 tests/fixtures/engine/typescript/output/addon/styles/product-details.css create mode 100644 tests/fixtures/engine/typescript/output/addon/template-registry.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/templates/application.hbs delete mode 100644 tests/fixtures/engine/typescript/output/addon/templates/product-details.hbs create mode 100644 tests/fixtures/engine/typescript/output/addon/utils/routes/index.ts create mode 100644 tests/fixtures/engine/typescript/output/addon/utils/routes/products.ts create mode 100644 tests/fixtures/engine/typescript/output/tests/integration/components/navigation-menu-test.ts delete mode 100644 tests/fixtures/engine/typescript/output/tests/integration/components/product/card-test.ts delete mode 100644 tests/fixtures/engine/typescript/output/tests/integration/components/product/details-test.ts delete mode 100644 tests/fixtures/engine/typescript/output/tests/integration/components/product/image-test.ts create mode 100644 tests/fixtures/engine/typescript/output/tests/integration/components/ui/page-test.ts create mode 100644 tests/fixtures/engine/typescript/output/tests/unit/controllers/products/product-test.ts create mode 100644 tests/fixtures/engine/typescript/output/tests/unit/routes/application-test.ts delete mode 100644 tests/fixtures/engine/typescript/output/tests/unit/routes/product-details-test.ts create mode 100644 tests/fixtures/engine/typescript/output/tests/unit/services/experiments-test.ts 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/styles.css b/tests/fixtures/engine/javascript/input/addon/products/product/styles.css deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/engine/javascript/input/addon/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/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/styles/products/product.css b/tests/fixtures/engine/javascript/output/addon/styles/products/product.css deleted file mode 100644 index 735cb06..0000000 --- a/tests/fixtures/engine/javascript/output/addon/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/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/engine/typescript/input/addon/components/navigation-menu/styles.css b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.css new file mode 100644 index 0000000..7fdf679 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/styles.css @@ -0,0 +1,21 @@ +.list { + align-items: center; + display: flex; +} + +.link { + display: inline-block; + font-size: 0.875rem; + padding: 0.875rem 1rem; + text-decoration: none; + white-space: nowrap; +} + +.link:global(.active) { + background-color: #15202d; +} + +.link:hover { + background-color: #26313d; + transition: background-color 0.17s; +} diff --git a/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs new file mode 100644 index 0000000..1b36915 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/navigation-menu/template.hbs @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/tests/fixtures/engine/typescript/input/addon/components/product/card/styles.css b/tests/fixtures/engine/typescript/input/addon/components/product/card/styles.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/product/card/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/product/card/template.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/product/details/component.ts b/tests/fixtures/engine/typescript/input/addon/components/product/details/component.ts deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/typescript/input/addon/components/product/details/component.ts +++ /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/typescript/input/addon/components/product/details/styles.css b/tests/fixtures/engine/typescript/input/addon/components/product/details/styles.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/product/details/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/product/details/template.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/product/image/component.ts b/tests/fixtures/engine/typescript/input/addon/components/product/image/component.ts deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/typescript/input/addon/components/product/image/component.ts +++ /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/typescript/input/addon/components/product/image/styles.css b/tests/fixtures/engine/typescript/input/addon/components/product/image/styles.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/product/image/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/product/image/template.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/components/ui/page/component.ts b/tests/fixtures/engine/typescript/input/addon/components/ui/page/component.ts new file mode 100644 index 0000000..ce86432 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/ui/page/component.ts @@ -0,0 +1,14 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +interface UiPageSignature { + Args: { + title: string; + }; + Blocks: { + default: []; + }; +} + +const UiPageComponent = templateOnlyComponent(); + +export default UiPageComponent; diff --git a/tests/fixtures/engine/typescript/input/addon/components/ui/page/styles.css b/tests/fixtures/engine/typescript/input/addon/components/ui/page/styles.css new file mode 100644 index 0000000..24409c1 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/ui/page/styles.css @@ -0,0 +1,20 @@ +.container { + display: grid; + grid-template-areas: + "title" + "content"; + grid-template-columns: 1fr; + grid-template-rows: auto 1fr; + height: calc(100% - 3em); + overflow-y: auto; + padding: 1.5rem 1rem; + scrollbar-gutter: stable; +} + +.title { + grid-area: title; +} + +.content { + grid-area: content; +} diff --git a/tests/fixtures/engine/typescript/input/addon/components/ui/page/template.hbs b/tests/fixtures/engine/typescript/input/addon/components/ui/page/template.hbs new file mode 100644 index 0000000..1c5ed81 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/components/ui/page/template.hbs @@ -0,0 +1,9 @@ +
+

+ {{@title}} +

+ +
+ {{yield}} +
+
\ No newline at end of file diff --git a/tests/fixtures/engine/typescript/input/addon/engine.ts b/tests/fixtures/engine/typescript/input/addon/engine.ts new file mode 100644 index 0000000..d23ffbe --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/engine.ts @@ -0,0 +1,14 @@ +import Engine from '@ember/engine'; +import loadInitializers from 'ember-load-initializers'; +import Resolver from 'ember-resolver'; + +import config from './config/environment'; + +const { modulePrefix } = config; + +export default class MyEngine extends Engine { + modulePrefix = modulePrefix; + Resolver = Resolver; +} + +loadInitializers(MyEngine, modulePrefix); diff --git a/tests/fixtures/engine/typescript/input/addon/experiments/service.ts b/tests/fixtures/engine/typescript/input/addon/experiments/service.ts new file mode 100644 index 0000000..0dff7b6 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/experiments/service.ts @@ -0,0 +1,15 @@ +import Service from '@ember/service'; + +export default class ExperimentsService extends Service { + decideVariant(experimentName: string): void { + if (experimentName === 'nest-product-details') { + // TODO + } + } +} + +declare module '@ember/service' { + interface Registry { + experiments: ExperimentsService; + } +} diff --git a/tests/fixtures/engine/typescript/input/addon/product-details/route.ts b/tests/fixtures/engine/typescript/input/addon/product-details/route.ts deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/typescript/input/addon/product-details/route.ts +++ /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/typescript/input/addon/product-details/styles.css b/tests/fixtures/engine/typescript/input/addon/product-details/styles.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/product-details/template.hbs b/tests/fixtures/engine/typescript/input/addon/product-details/template.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/input/addon/products/controller.ts b/tests/fixtures/engine/typescript/input/addon/products/controller.ts index dc6d34e..6db2eeb 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/controller.ts +++ b/tests/fixtures/engine/typescript/input/addon/products/controller.ts @@ -1,59 +1,13 @@ 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'; + +import type { Model } from './route'; export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; + declare model: Model; 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; - }); + @tracked name: string | null = null; + @tracked sortBy: string | null = null; } diff --git a/tests/fixtures/engine/typescript/input/addon/products/product/controller.ts b/tests/fixtures/engine/typescript/input/addon/products/product/controller.ts new file mode 100644 index 0000000..0dc16dc --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/products/product/controller.ts @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +import type { Model } from './route'; + +export default class ProductsProductController extends Controller { + declare model: Model; +} diff --git a/tests/fixtures/engine/typescript/input/addon/products/product/route.ts b/tests/fixtures/engine/typescript/input/addon/products/product/route.ts index 4c21255..d5d7508 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/product/route.ts +++ b/tests/fixtures/engine/typescript/input/addon/products/product/route.ts @@ -1,27 +1,13 @@ -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'; - } +import type { ModelFrom } from '../../utils/routes'; +import type { Product } from '../../utils/routes/products'; +import type ProductsRoute from '../route'; - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { +export default class ProductsProductRoute extends Route { + model(params: { id: string }): Product { const { id } = params; - const products = this.modelFor('products'); + const products = this.modelFor('products') as ModelFrom; const product = products.find((product) => product.id === id); @@ -31,8 +17,6 @@ export default class ProductsProductRoute extends Route { return product; } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } } + +export type Model = ModelFrom; diff --git a/tests/fixtures/engine/typescript/input/addon/products/product/styles.css b/tests/fixtures/engine/typescript/input/addon/products/product/styles.css index 735cb06..afa2d07 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/product/styles.css +++ b/tests/fixtures/engine/typescript/input/addon/products/product/styles.css @@ -4,7 +4,7 @@ width: 100%; } -@media screen and (min-width: 40rem) { +@media screen and (width >= 40rem) { .product-details { margin-bottom: 0; margin-left: 2rem; diff --git a/tests/fixtures/engine/typescript/input/addon/products/product/template.hbs b/tests/fixtures/engine/typescript/input/addon/products/product/template.hbs index 6bd6231..26c4d6f 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/product/template.hbs +++ b/tests/fixtures/engine/typescript/input/addon/products/product/template.hbs @@ -1,5 +1,5 @@ -{{page-title @model.name}} +{{page-title this.model.name}}
- + Product details go here.
\ No newline at end of file diff --git a/tests/fixtures/engine/typescript/input/addon/products/route.ts b/tests/fixtures/engine/typescript/input/addon/products/route.ts index 4a66f4c..fd4a40f 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/route.ts +++ b/tests/fixtures/engine/typescript/input/addon/products/route.ts @@ -1,8 +1,13 @@ +import type Owner from '@ember/owner'; import Route from '@ember/routing/route'; -import { service } from '@ember/service'; +import { type Registry as Services, service } from '@ember/service'; + +import type { ModelFrom } from '../utils/routes'; +import type { Product } from '../utils/routes/products'; +import type ProductsController from './controller'; export default class ProductsRoute extends Route { - @service store; + @service declare experiments: Services['experiments']; queryParams = { name: { @@ -13,7 +18,20 @@ export default class ProductsRoute extends Route { }, }; - model(params) { - return this.store.query('product', params); + constructor(owner: Owner) { + super(owner); + + this.experiments.decideVariant('nest-product-details'); + } + + model(): Product[] { + return []; + } + + resetController(controller: ProductsController) { + controller.name = null; + controller.sortBy = null; } } + +export type Model = ModelFrom; diff --git a/tests/fixtures/engine/typescript/input/addon/products/styles.css b/tests/fixtures/engine/typescript/input/addon/products/styles.css index ad39931..93cb5f8 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/styles.css +++ b/tests/fixtures/engine/typescript/input/addon/products/styles.css @@ -1,73 +1,20 @@ -.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; + grid-template-rows: 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-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/typescript/input/addon/products/template.hbs b/tests/fixtures/engine/typescript/input/addon/products/template.hbs index e2aeaf7..9c2596a 100644 --- a/tests/fixtures/engine/typescript/input/addon/products/template.hbs +++ b/tests/fixtures/engine/typescript/input/addon/products/template.hbs @@ -1,61 +1,12 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
+{{page-title "Products"}} + +
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

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

- {{/each}} + List of products goes here.
-
+
{{outlet}}
diff --git a/tests/fixtures/engine/typescript/input/addon/routes.ts b/tests/fixtures/engine/typescript/input/addon/routes.ts new file mode 100644 index 0000000..7f0bcdb --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/routes.ts @@ -0,0 +1,7 @@ +import buildRoutes from 'ember-engines/routes'; + +export default buildRoutes(function () { + this.route('products', function () { + this.route('product' , { path: '/:id' }); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/addon/components/product/card/component.d.ts b/tests/fixtures/engine/typescript/input/addon/styles/.placeholder similarity index 100% rename from tests/fixtures/engine/typescript/input/addon/components/product/card/component.d.ts rename to tests/fixtures/engine/typescript/input/addon/styles/.placeholder diff --git a/tests/fixtures/engine/typescript/input/addon/template-registry.ts b/tests/fixtures/engine/typescript/input/addon/template-registry.ts new file mode 100644 index 0000000..14570ca --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/template-registry.ts @@ -0,0 +1,9 @@ +import type NavigationMenuComponent from './components/navigation-menu/component'; +import type UiPageComponent from './components/ui/page/component'; + +export default interface MyV1AddonRegistry { + NavigationMenu: typeof NavigationMenuComponent; + 'Ui::Page': typeof UiPageComponent; + 'navigation-menu': typeof NavigationMenuComponent; + 'ui/page': typeof UiPageComponent; +} diff --git a/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts b/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts new file mode 100644 index 0000000..41a2270 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/utils/routes/index.ts @@ -0,0 +1,14 @@ +/* + https://docs.ember-cli-typescript.com/cookbook/working-with-route-models +*/ +import type Route from '@ember/routing/route'; + +/** + Get the resolved type of an item. + - If the item is a promise, the result will be the resolved value type + - If the item is not a promise, the result will just be the type of the item + */ +type Resolved

= P extends Promise ? T : P; + +/** Get the resolved model value from a route. */ +export type ModelFrom = Resolved>; diff --git a/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts b/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts new file mode 100644 index 0000000..e7240b3 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/addon/utils/routes/products.ts @@ -0,0 +1,11 @@ +export type Product = { + categoryId: string; + description: string; + id: string; + imageUrl: string; + name: string; + price: number; + rating: number; + seller: string; + shortDescription: string; +}; diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts new file mode 100644 index 0000000..df6b0a4 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/tests/integration/components/navigation-menu/component-test.ts @@ -0,0 +1,20 @@ +import { render, setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | navigation-menu', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/card/component-test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | products/product/card', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.product = { - description: 'Made with organic herbs', - id: '1', - name: 'Vanilla Ice Cream Cake', - price: 40, - rating: 4.5, - seller: "Amy's", - shortDescription: 'Made with organic herbs', - }; - }); - - test('The component renders when @product is undefined', async function (assert) { - await render(hbs` - - `); - - assert.ok(true); - }); - - test('The component renders a product', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasText('Vanilla Ice Cream Cake', 'We see the product name.'); - - assert - .dom('[data-test-field="Short Description"]') - .hasText( - 'Made with organic herbs', - 'We see the product short description.' - ); - - assert - .dom('[data-test-field="Price"]') - .hasText('$40', 'We see the product price.'); - - assert - .dom('[data-test-link="Learn More"]') - .hasAria( - 'label', - 'Learn more about Vanilla Ice Cream Cake', - 'We see the correct aria-label.' - ) - .hasTagName('a', 'We see the correct tag name.') - .hasText('Learn more', 'We see the learn more link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/details/component-test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { click, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Integration | Component | products/product/details', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.product = { - description: 'Made with organic herbs', - id: '1', - name: 'Vanilla Ice Cream Cake', - price: 40, - rating: 4.5, - seller: "Amy's", - shortDescription: 'Made with organic herbs', - }; - }); - - test('The component renders when @product is undefined', async function (assert) { - await render(hbs` - - `); - - assert.ok(true); - }); - - test('The component renders a product', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasText('Vanilla Ice Cream Cake', 'We see the product name.'); - - assert - .dom('[data-test-field="Description"]') - .hasText('Made with organic herbs', 'We see the product description.'); - - assert - .dom('[data-test-field="Price"]') - .hasText('$40', 'We see the product price.'); - - assert - .dom('[data-test-field="Rating"]') - .hasText('4.5 out of 5 stars', 'We see the product rating.'); - - assert - .dom('[data-test-field="Seller"]') - .hasText("Amy's", 'We see the product seller.'); - - assert - .dom('[data-test-button="Add to Cart"]') - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Add to Cart', 'We see the add to cart button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can click on the add to cart button', async function (assert) { - const stubbedLog = sinon.stub(console, 'log'); - - await render(hbs` - - `); - - await click('[data-test-button="Add to Cart"]'); - - assert.true( - stubbedLog.calledOnceWith( - 'Vanilla Ice Cream Cake has been added to the cart.' - ), - 'We logged a message to the user.' - ); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/typescript/input/tests/integration/components/product/image/component-test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | products/product/image', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a placeholder in test environment', async function (assert) { - await render(hbs` - - `); - - assert.dom('img').doesNotExist('We should not make a network request.'); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts b/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts new file mode 100644 index 0000000..4145b79 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/tests/integration/components/ui/page/component-test.ts @@ -0,0 +1,19 @@ +import { render, setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | ui/page', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + +

+ Content goes here. +
+ + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts new file mode 100644 index 0000000..038b79d --- /dev/null +++ b/tests/fixtures/engine/typescript/input/tests/unit/application/route-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | application', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.engine.lookup('route:application'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts deleted file mode 100644 index 80722a4..0000000 --- a/tests/fixtures/engine/typescript/input/tests/unit/controllers/products/controller-test.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Controller | products', function (hooks) { - setupTest(hooks); - - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:products'); - }); - - module('resetQueryParameters', function (nestedHooks) { - nestedHooks.beforeEach(function () { - this.controller.name = 'fresh'; - this.controller.sortBy = 'price:asc'; - }); - - test('resets all query parameters', function (assert) { - this.controller.resetQueryParameters(); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); - }); - - module('updateQueryParameters', function () { - test('updates a query parameter', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: 'fresh', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - undefined, - 'We should not update the sortBy query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: 'price:asc', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We should not update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - 'price:asc', - 'We update the sortBy query parameter.' - ); - }); - - test('casts undefined and empty string to null', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: '', - }); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: undefined, - }); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts new file mode 100644 index 0000000..df22145 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/tests/unit/experiments/service-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Service | experiments', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const service = this.engine.lookup('service:experiments'); + assert.ok(service); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/typescript/input/tests/unit/product-details/route-test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | product-details', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:product-details'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts index 80722a4..b0c6e5e 100644 --- a/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts +++ b/tests/fixtures/engine/typescript/input/tests/unit/products/controller-test.ts @@ -1,95 +1,12 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Controller | products', function (hooks) { setupTest(hooks); - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:products'); - }); - - module('resetQueryParameters', function (nestedHooks) { - nestedHooks.beforeEach(function () { - this.controller.name = 'fresh'; - this.controller.sortBy = 'price:asc'; - }); - - test('resets all query parameters', function (assert) { - this.controller.resetQueryParameters(); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); - }); - - module('updateQueryParameters', function () { - test('updates a query parameter', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: 'fresh', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - undefined, - 'We should not update the sortBy query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: 'price:asc', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We should not update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - 'price:asc', - 'We update the sortBy query parameter.' - ); - }); - - test('casts undefined and empty string to null', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: '', - }); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: undefined, - }); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.engine.lookup('controller:products'); + assert.ok(controller); }); }); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts new file mode 100644 index 0000000..1ac4216 --- /dev/null +++ b/tests/fixtures/engine/typescript/input/tests/unit/products/product/controller-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products/product', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.engine.lookup('controller:products/product'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts index 7dd63ec..463b4f3 100644 --- a/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts +++ b/tests/fixtures/engine/typescript/input/tests/unit/products/product/route-test.ts @@ -1,11 +1,11 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Route | products/product', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let route = this.owner.lookup('route:products/product'); + const route = this.engine.lookup('route:products/product'); assert.ok(route); }); }); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts index 50693f5..b9e921d 100644 --- a/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts +++ b/tests/fixtures/engine/typescript/input/tests/unit/products/route-test.ts @@ -1,11 +1,11 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Route | products', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let route = this.owner.lookup('route:products'); + const route = this.engine.lookup('route:products'); assert.ok(route); }); }); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/typescript/input/tests/unit/routes/product-details/route-test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | product-details', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:product-details'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/typescript/input/tests/unit/routes/products/product/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/routes/products/product/route-test.ts deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/engine/typescript/input/tests/unit/routes/products/product/route-test.ts +++ /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/tests/unit/routes/products/route-test.ts b/tests/fixtures/engine/typescript/input/tests/unit/routes/products/route-test.ts deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/engine/typescript/input/tests/unit/routes/products/route-test.ts +++ /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/typescript/output/addon/components/navigation-menu.css b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css new file mode 100644 index 0000000..7fdf679 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.css @@ -0,0 +1,21 @@ +.list { + align-items: center; + display: flex; +} + +.link { + display: inline-block; + font-size: 0.875rem; + padding: 0.875rem 1rem; + text-decoration: none; + white-space: nowrap; +} + +.link:global(.active) { + background-color: #15202d; +} + +.link:hover { + background-color: #26313d; + transition: background-color 0.17s; +} diff --git a/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs new file mode 100644 index 0000000..1b36915 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.hbs @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.ts b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.ts new file mode 100644 index 0000000..4d05f3d --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/navigation-menu.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/engine/typescript/output/addon/components/product/card.css b/tests/fixtures/engine/typescript/output/addon/components/product/card.css deleted file mode 100644 index 4c1cf76..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/card.hbs b/tests/fixtures/engine/typescript/output/addon/components/product/card.hbs deleted file mode 100644 index a05a5a1..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/details.css b/tests/fixtures/engine/typescript/output/addon/components/product/details.css deleted file mode 100644 index b8ec01e..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/details.hbs b/tests/fixtures/engine/typescript/output/addon/components/product/details.hbs deleted file mode 100644 index 4eb75f1..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/details.ts b/tests/fixtures/engine/typescript/output/addon/components/product/details.ts deleted file mode 100644 index 6587cf1..0000000 --- a/tests/fixtures/engine/typescript/output/addon/components/product/details.ts +++ /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/typescript/output/addon/components/product/image.css b/tests/fixtures/engine/typescript/output/addon/components/product/image.css deleted file mode 100644 index a54d1ff..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/image.hbs b/tests/fixtures/engine/typescript/output/addon/components/product/image.hbs deleted file mode 100644 index 8ab893f..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/components/product/image.ts b/tests/fixtures/engine/typescript/output/addon/components/product/image.ts deleted file mode 100644 index af224b3..0000000 --- a/tests/fixtures/engine/typescript/output/addon/components/product/image.ts +++ /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/typescript/output/addon/components/ui/page.css b/tests/fixtures/engine/typescript/output/addon/components/ui/page.css new file mode 100644 index 0000000..24409c1 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/ui/page.css @@ -0,0 +1,20 @@ +.container { + display: grid; + grid-template-areas: + "title" + "content"; + grid-template-columns: 1fr; + grid-template-rows: auto 1fr; + height: calc(100% - 3em); + overflow-y: auto; + padding: 1.5rem 1rem; + scrollbar-gutter: stable; +} + +.title { + grid-area: title; +} + +.content { + grid-area: content; +} diff --git a/tests/fixtures/engine/typescript/output/addon/components/ui/page.hbs b/tests/fixtures/engine/typescript/output/addon/components/ui/page.hbs new file mode 100644 index 0000000..1c5ed81 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/ui/page.hbs @@ -0,0 +1,9 @@ +
+

+ {{@title}} +

+ +
+ {{yield}} +
+
\ No newline at end of file diff --git a/tests/fixtures/engine/typescript/output/addon/components/ui/page.ts b/tests/fixtures/engine/typescript/output/addon/components/ui/page.ts new file mode 100644 index 0000000..ce86432 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/components/ui/page.ts @@ -0,0 +1,14 @@ +import templateOnlyComponent from '@ember/component/template-only'; + +interface UiPageSignature { + Args: { + title: string; + }; + Blocks: { + default: []; + }; +} + +const UiPageComponent = templateOnlyComponent(); + +export default UiPageComponent; diff --git a/tests/fixtures/engine/typescript/output/addon/controllers/products.ts b/tests/fixtures/engine/typescript/output/addon/controllers/products.ts index dc6d34e..6db2eeb 100644 --- a/tests/fixtures/engine/typescript/output/addon/controllers/products.ts +++ b/tests/fixtures/engine/typescript/output/addon/controllers/products.ts @@ -1,59 +1,13 @@ 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'; + +import type { Model } from './route'; export default class ProductsController extends Controller { - @service config; - @service experiments; - @service intl; + declare model: Model; 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; - }); + @tracked name: string | null = null; + @tracked sortBy: string | null = null; } diff --git a/tests/fixtures/engine/typescript/output/addon/controllers/products/product.ts b/tests/fixtures/engine/typescript/output/addon/controllers/products/product.ts new file mode 100644 index 0000000..0dc16dc --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/controllers/products/product.ts @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +import type { Model } from './route'; + +export default class ProductsProductController extends Controller { + declare model: Model; +} diff --git a/tests/fixtures/engine/typescript/output/addon/engine.ts b/tests/fixtures/engine/typescript/output/addon/engine.ts new file mode 100644 index 0000000..d23ffbe --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/engine.ts @@ -0,0 +1,14 @@ +import Engine from '@ember/engine'; +import loadInitializers from 'ember-load-initializers'; +import Resolver from 'ember-resolver'; + +import config from './config/environment'; + +const { modulePrefix } = config; + +export default class MyEngine extends Engine { + modulePrefix = modulePrefix; + Resolver = Resolver; +} + +loadInitializers(MyEngine, modulePrefix); diff --git a/tests/fixtures/engine/typescript/output/addon/routes.ts b/tests/fixtures/engine/typescript/output/addon/routes.ts new file mode 100644 index 0000000..7f0bcdb --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/routes.ts @@ -0,0 +1,7 @@ +import buildRoutes from 'ember-engines/routes'; + +export default buildRoutes(function () { + this.route('products', function () { + this.route('product' , { path: '/:id' }); + }); +}); diff --git a/tests/fixtures/engine/typescript/output/addon/routes/application.ts b/tests/fixtures/engine/typescript/output/addon/routes/application.ts new file mode 100644 index 0000000..72f0d5e --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/routes/application.ts @@ -0,0 +1,3 @@ +import Route from '@ember/routing/route'; + +export default class ApplicationRoute extends Route {} diff --git a/tests/fixtures/engine/typescript/output/addon/routes/product-details.ts b/tests/fixtures/engine/typescript/output/addon/routes/product-details.ts deleted file mode 100644 index d09d764..0000000 --- a/tests/fixtures/engine/typescript/output/addon/routes/product-details.ts +++ /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/typescript/output/addon/routes/products.ts b/tests/fixtures/engine/typescript/output/addon/routes/products.ts index 4a66f4c..fd4a40f 100644 --- a/tests/fixtures/engine/typescript/output/addon/routes/products.ts +++ b/tests/fixtures/engine/typescript/output/addon/routes/products.ts @@ -1,8 +1,13 @@ +import type Owner from '@ember/owner'; import Route from '@ember/routing/route'; -import { service } from '@ember/service'; +import { type Registry as Services, service } from '@ember/service'; + +import type { ModelFrom } from '../utils/routes'; +import type { Product } from '../utils/routes/products'; +import type ProductsController from './controller'; export default class ProductsRoute extends Route { - @service store; + @service declare experiments: Services['experiments']; queryParams = { name: { @@ -13,7 +18,20 @@ export default class ProductsRoute extends Route { }, }; - model(params) { - return this.store.query('product', params); + constructor(owner: Owner) { + super(owner); + + this.experiments.decideVariant('nest-product-details'); + } + + model(): Product[] { + return []; + } + + resetController(controller: ProductsController) { + controller.name = null; + controller.sortBy = null; } } + +export type Model = ModelFrom; diff --git a/tests/fixtures/engine/typescript/output/addon/routes/products/product.ts b/tests/fixtures/engine/typescript/output/addon/routes/products/product.ts index 4c21255..d5d7508 100644 --- a/tests/fixtures/engine/typescript/output/addon/routes/products/product.ts +++ b/tests/fixtures/engine/typescript/output/addon/routes/products/product.ts @@ -1,27 +1,13 @@ -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'; - } +import type { ModelFrom } from '../../utils/routes'; +import type { Product } from '../../utils/routes/products'; +import type ProductsRoute from '../route'; - beforeModel(transition) { - const { id } = transition.to.params; - - if (!this.isPartOfNestProductDetailsExperiment) { - this.router.replaceWith('product-details', id); - return; - } - } - - model(params) { +export default class ProductsProductRoute extends Route { + model(params: { id: string }): Product { const { id } = params; - const products = this.modelFor('products'); + const products = this.modelFor('products') as ModelFrom; const product = products.find((product) => product.id === id); @@ -31,8 +17,6 @@ export default class ProductsProductRoute extends Route { return product; } - - @action error(/* error, transition */) { - this.router.replaceWith('products'); - } } + +export type Model = ModelFrom; diff --git a/tests/fixtures/engine/typescript/output/addon/services/experiments.ts b/tests/fixtures/engine/typescript/output/addon/services/experiments.ts new file mode 100644 index 0000000..0dff7b6 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/services/experiments.ts @@ -0,0 +1,15 @@ +import Service from '@ember/service'; + +export default class ExperimentsService extends Service { + decideVariant(experimentName: string): void { + if (experimentName === 'nest-product-details') { + // TODO + } + } +} + +declare module '@ember/service' { + interface Registry { + experiments: ExperimentsService; + } +} diff --git a/tests/fixtures/engine/typescript/output/addon/components/product/card.d.ts b/tests/fixtures/engine/typescript/output/addon/styles/.placeholder similarity index 100% rename from tests/fixtures/engine/typescript/output/addon/components/product/card.d.ts rename to tests/fixtures/engine/typescript/output/addon/styles/.placeholder diff --git a/tests/fixtures/engine/typescript/output/addon/styles/product-details.css b/tests/fixtures/engine/typescript/output/addon/styles/product-details.css deleted file mode 100644 index ac9c78c..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/styles/products.css b/tests/fixtures/engine/typescript/output/addon/styles/products.css index ad39931..93cb5f8 100644 --- a/tests/fixtures/engine/typescript/output/addon/styles/products.css +++ b/tests/fixtures/engine/typescript/output/addon/styles/products.css @@ -1,73 +1,20 @@ -.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; + grid-template-rows: 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-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/typescript/output/addon/styles/products/product.css b/tests/fixtures/engine/typescript/output/addon/styles/products/product.css index 735cb06..afa2d07 100644 --- a/tests/fixtures/engine/typescript/output/addon/styles/products/product.css +++ b/tests/fixtures/engine/typescript/output/addon/styles/products/product.css @@ -4,7 +4,7 @@ width: 100%; } -@media screen and (min-width: 40rem) { +@media screen and (width >= 40rem) { .product-details { margin-bottom: 0; margin-left: 2rem; diff --git a/tests/fixtures/engine/typescript/output/addon/template-registry.ts b/tests/fixtures/engine/typescript/output/addon/template-registry.ts new file mode 100644 index 0000000..14570ca --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/template-registry.ts @@ -0,0 +1,9 @@ +import type NavigationMenuComponent from './components/navigation-menu/component'; +import type UiPageComponent from './components/ui/page/component'; + +export default interface MyV1AddonRegistry { + NavigationMenu: typeof NavigationMenuComponent; + 'Ui::Page': typeof UiPageComponent; + 'navigation-menu': typeof NavigationMenuComponent; + 'ui/page': typeof UiPageComponent; +} diff --git a/tests/fixtures/engine/typescript/output/addon/templates/application.hbs b/tests/fixtures/engine/typescript/output/addon/templates/application.hbs new file mode 100644 index 0000000..b18df32 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/templates/application.hbs @@ -0,0 +1,3 @@ +{{page-title "My Engine"}} + +{{outlet}} \ No newline at end of file diff --git a/tests/fixtures/engine/typescript/output/addon/templates/product-details.hbs b/tests/fixtures/engine/typescript/output/addon/templates/product-details.hbs deleted file mode 100644 index 1ce76e3..0000000 --- a/tests/fixtures/engine/typescript/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/typescript/output/addon/templates/products.hbs b/tests/fixtures/engine/typescript/output/addon/templates/products.hbs index e2aeaf7..9c2596a 100644 --- a/tests/fixtures/engine/typescript/output/addon/templates/products.hbs +++ b/tests/fixtures/engine/typescript/output/addon/templates/products.hbs @@ -1,61 +1,12 @@ -{{page-title (t "routes.products.title")}} - - -
-
-
- -
- -
- -
-
+{{page-title "Products"}} + +
- {{#each - (sort-by (or this.sortBy "") @model) - as |product| - }} - - {{else}} -

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

- {{/each}} + List of products goes here.
-
+
{{outlet}}
diff --git a/tests/fixtures/engine/typescript/output/addon/templates/products/product.hbs b/tests/fixtures/engine/typescript/output/addon/templates/products/product.hbs index 6bd6231..26c4d6f 100644 --- a/tests/fixtures/engine/typescript/output/addon/templates/products/product.hbs +++ b/tests/fixtures/engine/typescript/output/addon/templates/products/product.hbs @@ -1,5 +1,5 @@ -{{page-title @model.name}} +{{page-title this.model.name}}
- + Product details go here.
\ No newline at end of file diff --git a/tests/fixtures/engine/typescript/output/addon/utils/routes/index.ts b/tests/fixtures/engine/typescript/output/addon/utils/routes/index.ts new file mode 100644 index 0000000..41a2270 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/utils/routes/index.ts @@ -0,0 +1,14 @@ +/* + https://docs.ember-cli-typescript.com/cookbook/working-with-route-models +*/ +import type Route from '@ember/routing/route'; + +/** + Get the resolved type of an item. + - If the item is a promise, the result will be the resolved value type + - If the item is not a promise, the result will just be the type of the item + */ +type Resolved

= P extends Promise ? T : P; + +/** Get the resolved model value from a route. */ +export type ModelFrom = Resolved>; diff --git a/tests/fixtures/engine/typescript/output/addon/utils/routes/products.ts b/tests/fixtures/engine/typescript/output/addon/utils/routes/products.ts new file mode 100644 index 0000000..e7240b3 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/addon/utils/routes/products.ts @@ -0,0 +1,11 @@ +export type Product = { + categoryId: string; + description: string; + id: string; + imageUrl: string; + name: string; + price: number; + rating: number; + seller: string; + shortDescription: string; +}; diff --git a/tests/fixtures/engine/typescript/output/tests/integration/components/navigation-menu-test.ts b/tests/fixtures/engine/typescript/output/tests/integration/components/navigation-menu-test.ts new file mode 100644 index 0000000..df6b0a4 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/tests/integration/components/navigation-menu-test.ts @@ -0,0 +1,20 @@ +import { render, setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | navigation-menu', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/engine/typescript/output/tests/integration/components/product/card-test.ts b/tests/fixtures/engine/typescript/output/tests/integration/components/product/card-test.ts deleted file mode 100644 index 8f0ddaa..0000000 --- a/tests/fixtures/engine/typescript/output/tests/integration/components/product/card-test.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | products/product/card', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.product = { - description: 'Made with organic herbs', - id: '1', - name: 'Vanilla Ice Cream Cake', - price: 40, - rating: 4.5, - seller: "Amy's", - shortDescription: 'Made with organic herbs', - }; - }); - - test('The component renders when @product is undefined', async function (assert) { - await render(hbs` - - `); - - assert.ok(true); - }); - - test('The component renders a product', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasText('Vanilla Ice Cream Cake', 'We see the product name.'); - - assert - .dom('[data-test-field="Short Description"]') - .hasText( - 'Made with organic herbs', - 'We see the product short description.' - ); - - assert - .dom('[data-test-field="Price"]') - .hasText('$40', 'We see the product price.'); - - assert - .dom('[data-test-link="Learn More"]') - .hasAria( - 'label', - 'Learn more about Vanilla Ice Cream Cake', - 'We see the correct aria-label.' - ) - .hasTagName('a', 'We see the correct tag name.') - .hasText('Learn more', 'We see the learn more link.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); -}); diff --git a/tests/fixtures/engine/typescript/output/tests/integration/components/product/details-test.ts b/tests/fixtures/engine/typescript/output/tests/integration/components/product/details-test.ts deleted file mode 100644 index dcb4ad5..0000000 --- a/tests/fixtures/engine/typescript/output/tests/integration/components/product/details-test.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { click, render } from '@ember/test-helpers'; -import { a11yAudit } from 'ember-a11y-testing/test-support'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupIntl } from 'ember-intl/test-support'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; -import sinon from 'sinon'; - -module('Integration | Component | products/product/details', function (hooks) { - setupRenderingTest(hooks); - setupIntl(hooks); - - hooks.beforeEach(function () { - this.product = { - description: 'Made with organic herbs', - id: '1', - name: 'Vanilla Ice Cream Cake', - price: 40, - rating: 4.5, - seller: "Amy's", - shortDescription: 'Made with organic herbs', - }; - }); - - test('The component renders when @product is undefined', async function (assert) { - await render(hbs` - - `); - - assert.ok(true); - }); - - test('The component renders a product', async function (assert) { - await render(hbs` - - `); - - assert - .dom('[data-test-field="Name"]') - .hasText('Vanilla Ice Cream Cake', 'We see the product name.'); - - assert - .dom('[data-test-field="Description"]') - .hasText('Made with organic herbs', 'We see the product description.'); - - assert - .dom('[data-test-field="Price"]') - .hasText('$40', 'We see the product price.'); - - assert - .dom('[data-test-field="Rating"]') - .hasText('4.5 out of 5 stars', 'We see the product rating.'); - - assert - .dom('[data-test-field="Seller"]') - .hasText("Amy's", 'We see the product seller.'); - - assert - .dom('[data-test-button="Add to Cart"]') - .hasAttribute('type', 'button', 'We see the correct type.') - .hasTagName('button', 'We see the correct tag name.') - .hasText('Add to Cart', 'We see the add to cart button.'); - - await a11yAudit(); - - assert.ok(true, 'We passed the accessibility audit.'); - }); - - test('We can click on the add to cart button', async function (assert) { - const stubbedLog = sinon.stub(console, 'log'); - - await render(hbs` - - `); - - await click('[data-test-button="Add to Cart"]'); - - assert.true( - stubbedLog.calledOnceWith( - 'Vanilla Ice Cream Cake has been added to the cart.' - ), - 'We logged a message to the user.' - ); - }); -}); diff --git a/tests/fixtures/engine/typescript/output/tests/integration/components/product/image-test.ts b/tests/fixtures/engine/typescript/output/tests/integration/components/product/image-test.ts deleted file mode 100644 index a853981..0000000 --- a/tests/fixtures/engine/typescript/output/tests/integration/components/product/image-test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; -import { setupRenderingTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Integration | Component | products/product/image', function (hooks) { - setupRenderingTest(hooks); - - test('The component renders a placeholder in test environment', async function (assert) { - await render(hbs` - - `); - - assert.dom('img').doesNotExist('We should not make a network request.'); - }); -}); diff --git a/tests/fixtures/engine/typescript/output/tests/integration/components/ui/page-test.ts b/tests/fixtures/engine/typescript/output/tests/integration/components/ui/page-test.ts new file mode 100644 index 0000000..4145b79 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/tests/integration/components/ui/page-test.ts @@ -0,0 +1,19 @@ +import { render, setupRenderingTest } from 'dummy/tests/helpers'; +import { hbs } from 'ember-cli-htmlbars'; +import { module, test } from 'qunit'; + +module('Integration | Component | ui/page', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + await render(hbs` + +

+ Content goes here. +
+ + `); + + assert.ok(true); + }); +}); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/controllers/products-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/controllers/products-test.ts index 80722a4..b0c6e5e 100644 --- a/tests/fixtures/engine/typescript/output/tests/unit/controllers/products-test.ts +++ b/tests/fixtures/engine/typescript/output/tests/unit/controllers/products-test.ts @@ -1,95 +1,12 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Controller | products', function (hooks) { setupTest(hooks); - hooks.beforeEach(function () { - this.controller = this.owner.lookup('controller:products'); - }); - - module('resetQueryParameters', function (nestedHooks) { - nestedHooks.beforeEach(function () { - this.controller.name = 'fresh'; - this.controller.sortBy = 'price:asc'; - }); - - test('resets all query parameters', function (assert) { - this.controller.resetQueryParameters(); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); - }); - - module('updateQueryParameters', function () { - test('updates a query parameter', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: 'fresh', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - undefined, - 'We should not update the sortBy query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: 'price:asc', - }); - - assert.strictEqual( - this.controller.name, - 'fresh', - 'We should not update the name query parameter.' - ); - - assert.strictEqual( - this.controller.sortBy, - 'price:asc', - 'We update the sortBy query parameter.' - ); - }); - - test('casts undefined and empty string to null', async function (assert) { - await this.controller.updateQueryParameters.perform({ - key: 'name', - value: '', - }); - - assert.strictEqual( - this.controller.name, - null, - 'We update the name query parameter.' - ); - - await this.controller.updateQueryParameters.perform({ - key: 'sortBy', - value: undefined, - }); - - assert.strictEqual( - this.controller.sortBy, - null, - 'We update the sortBy query parameter.' - ); - }); + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.engine.lookup('controller:products'); + assert.ok(controller); }); }); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/controllers/products/product-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/controllers/products/product-test.ts new file mode 100644 index 0000000..1ac4216 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/tests/unit/controllers/products/product-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Controller | products/product', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const controller = this.engine.lookup('controller:products/product'); + assert.ok(controller); + }); +}); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/routes/application-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/routes/application-test.ts new file mode 100644 index 0000000..038b79d --- /dev/null +++ b/tests/fixtures/engine/typescript/output/tests/unit/routes/application-test.ts @@ -0,0 +1,11 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Route | application', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + const route = this.engine.lookup('route:application'); + assert.ok(route); + }); +}); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/routes/product-details-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/routes/product-details-test.ts deleted file mode 100644 index 084e909..0000000 --- a/tests/fixtures/engine/typescript/output/tests/unit/routes/product-details-test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { setupTest } from 'ember-qunit'; -import { module, test } from 'qunit'; - -module('Unit | Route | product-details', function (hooks) { - setupTest(hooks); - - test('it exists', function (assert) { - let route = this.owner.lookup('route:product-details'); - assert.ok(route); - }); -}); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/routes/products-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/routes/products-test.ts index 50693f5..b9e921d 100644 --- a/tests/fixtures/engine/typescript/output/tests/unit/routes/products-test.ts +++ b/tests/fixtures/engine/typescript/output/tests/unit/routes/products-test.ts @@ -1,11 +1,11 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Route | products', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let route = this.owner.lookup('route:products'); + const route = this.engine.lookup('route:products'); assert.ok(route); }); }); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/routes/products/product-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/routes/products/product-test.ts index 7dd63ec..463b4f3 100644 --- a/tests/fixtures/engine/typescript/output/tests/unit/routes/products/product-test.ts +++ b/tests/fixtures/engine/typescript/output/tests/unit/routes/products/product-test.ts @@ -1,11 +1,11 @@ -import { setupTest } from 'ember-qunit'; +import { setupTest } from 'dummy/tests/helpers'; import { module, test } from 'qunit'; module('Unit | Route | products/product', function (hooks) { setupTest(hooks); test('it exists', function (assert) { - let route = this.owner.lookup('route:products/product'); + const route = this.engine.lookup('route:products/product'); assert.ok(route); }); }); diff --git a/tests/fixtures/engine/typescript/output/tests/unit/services/experiments-test.ts b/tests/fixtures/engine/typescript/output/tests/unit/services/experiments-test.ts new file mode 100644 index 0000000..df22145 --- /dev/null +++ b/tests/fixtures/engine/typescript/output/tests/unit/services/experiments-test.ts @@ -0,0 +1,12 @@ +import { setupTest } from 'dummy/tests/helpers'; +import { module, test } from 'qunit'; + +module('Unit | Service | experiments', function (hooks) { + setupTest(hooks); + + // TODO: Replace this with your real tests. + test('it exists', function (assert) { + const service = this.engine.lookup('service:experiments'); + assert.ok(service); + }); +}); diff --git a/update-test-fixtures.sh b/update-test-fixtures.sh index f35a7c9..644b055 100755 --- a/update-test-fixtures.sh +++ b/update-test-fixtures.sh @@ -15,6 +15,14 @@ # Compile TypeScript pnpm build +# Update fixtures +rm -r "tests/fixtures/engine/typescript/output" +cp -r "tests/fixtures/engine/typescript/input" "tests/fixtures/engine/typescript/output" + +./dist/bin/ember-codemod-pod-to-octane.js \ + --root "tests/fixtures/engine/typescript/output" \ + --type v1-addon + # Update fixtures rm -r "tests/fixtures/v1-addon/typescript/output" cp -r "tests/fixtures/v1-addon/typescript/input" "tests/fixtures/v1-addon/typescript/output" @@ -55,27 +63,3 @@ cp -r "tests/fixtures/app/typescript/input" "tests/fixtures/app/typescript/outpu ./dist/bin/ember-codemod-pod-to-octane.js \ --root "tests/fixtures/app/typescript/output" \ --type app - -# Update fixtures -rm -r "tests/fixtures/engine/javascript/output" -cp -r "tests/fixtures/engine/javascript/input" "tests/fixtures/engine/javascript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/engine/javascript/output" \ - --type v1-addon - -# Update fixtures -rm -r "tests/fixtures/engine/sass/output" -cp -r "tests/fixtures/engine/sass/input" "tests/fixtures/engine/sass/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/engine/sass/output" \ - --type v1-addon - -# Update fixtures -rm -r "tests/fixtures/engine/typescript/output" -cp -r "tests/fixtures/engine/typescript/input" "tests/fixtures/engine/typescript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/engine/typescript/output" \ - --type v1-addon From 3307928fe8f1cd4174dcf19345fcfc4d89b11abb Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Fri, 11 Oct 2024 18:57:15 +0200 Subject: [PATCH 3/5] chore: Removed unnecessary test fixtures (app) --- tests/fixtures/app/javascript/index.ts | 6 - .../input/app/application/adapter.js | 3 - .../javascript/input/app/application/route.js | 10 - .../input/app/application/serializer.js | 3 - .../input/app/application/styles.css | 55 ---- .../input/app/application/template.hbs | 47 ---- .../app/components/navigation-menu/styles.css | 22 -- .../components/navigation-menu/template.hbs | 15 -- .../app/components/product/card/styles.css | 101 -------- .../app/components/product/card/template.hbs | 51 ---- .../components/product/details/component.js | 8 - .../app/components/product/details/styles.css | 45 ---- .../components/product/details/template.hbs | 72 ------ .../app/components/product/image/component.js | 6 - .../app/components/product/image/styles.css | 15 -- .../app/components/product/image/template.hbs | 12 - .../components/ui/form/checkbox/component.js | 41 --- .../components/ui/form/checkbox/styles.css | 37 --- .../components/ui/form/checkbox/template.hbs | 40 --- .../input/app/components/ui/form/component.js | 17 -- .../app/components/ui/form/field/styles.css | 83 ------ .../app/components/ui/form/field/template.hbs | 27 -- .../components/ui/form/information/styles.css | 16 -- .../ui/form/information/template.hbs | 23 -- .../app/components/ui/form/input/component.js | 42 --- .../app/components/ui/form/input/styles.css | 24 -- .../app/components/ui/form/input/template.hbs | 33 --- .../components/ui/form/number/component.js | 37 --- .../app/components/ui/form/number/styles.css | 9 - .../components/ui/form/number/template.hbs | 34 --- .../components/ui/form/select/component.js | 40 --- .../app/components/ui/form/select/styles.css | 33 --- .../components/ui/form/select/template.hbs | 79 ------ .../input/app/components/ui/form/styles.css | 19 -- .../input/app/components/ui/form/template.hbs | 70 ----- .../components/ui/form/textarea/component.js | 30 --- .../components/ui/form/textarea/styles.css | 24 -- .../components/ui/form/textarea/template.hbs | 33 --- .../input/app/components/ui/page/styles.css | 20 -- .../input/app/components/ui/page/template.hbs | 9 - .../javascript/input/app/config/service.js | 25 -- .../input/app/experiments/service.js | 82 ------ .../javascript/input/app/form/controller.js | 44 ---- .../app/javascript/input/app/form/route.js | 3 - .../app/javascript/input/app/form/styles.css | 7 - .../javascript/input/app/form/template.hbs | 76 ------ .../app/javascript/input/app/index/route.js | 3 - .../app/javascript/input/app/index/styles.css | 3 - .../javascript/input/app/index/template.hbs | 5 - .../input/app/product-details/route.js | 32 --- .../input/app/product-details/styles.css | 17 -- .../input/app/product-details/template.hbs | 15 -- .../app/javascript/input/app/product/model.js | 11 - .../input/app/products/controller.js | 59 ----- .../input/app/products/product/route.js | 38 --- .../input/app/products/product/styles.css | 13 - .../input/app/products/product/template.hbs | 5 - .../javascript/input/app/products/route.js | 19 -- .../javascript/input/app/products/styles.css | 73 ------ .../input/app/products/template.hbs | 62 ----- .../app/javascript/input/app/styles/app.css | 109 -------- .../input/app/utils/components/form/index.js | 26 -- .../app/javascript/input/app/utils/fetch.js | 11 - .../app/javascript/input/package.json | 4 - .../tests/helpers/components/form/index.js | 10 - .../javascript/input/tests/helpers/index.js | 3 - .../input/tests/helpers/services/config.js | 23 -- .../tests/helpers/services/experiments.js | 10 - .../navigation-menu/component-test.js | 45 ---- .../components/product/card/component-test.js | 71 ----- .../product/details/component-test.js | 89 ------- .../product/image/component-test.js | 18 -- .../ui/form/checkbox/component-test.js | 209 --------------- .../components/ui/form/component-test.js | 179 ------------- .../ui/form/field/component-test.js | 74 ------ .../ui/form/information/component-test.js | 63 ----- .../ui/form/input/component-test.js | 169 ------------ .../ui/form/number/component-test.js | 159 ------------ .../ui/form/select/component-test.js | 244 ------------------ .../ui/form/textarea/component-test.js | 144 ----------- .../components/ui/page/component-test.js | 29 --- .../tests/unit/application/route-test.js | 11 - .../input/tests/unit/config/service-test.js | 54 ---- .../unit/controllers/form/controller-test.js | 82 ------ .../controllers/products/controller-test.js | 95 ------- .../tests/unit/experiments/service-test.js | 204 --------------- .../input/tests/unit/form/controller-test.js | 82 ------ .../input/tests/unit/form/route-test.js | 11 - .../input/tests/unit/index/route-test.js | 11 - .../tests/unit/product-details/route-test.js | 11 - .../tests/unit/products/controller-test.js | 95 ------- .../tests/unit/products/product/route-test.js | 11 - .../input/tests/unit/products/route-test.js | 11 - .../unit/routes/application/route-test.js | 11 - .../tests/unit/routes/form/route-test.js | 11 - .../tests/unit/routes/index/route-test.js | 11 - .../unit/routes/product-details/route-test.js | 11 - .../routes/products/product/route-test.js | 11 - .../tests/unit/routes/products/route-test.js | 11 - .../output/app/adapters/application.js | 3 - .../output/app/components/navigation-menu.css | 22 -- .../output/app/components/navigation-menu.hbs | 15 -- .../output/app/components/product/card.css | 101 -------- .../output/app/components/product/card.hbs | 51 ---- .../output/app/components/product/details.css | 45 ---- .../output/app/components/product/details.hbs | 72 ------ .../output/app/components/product/details.js | 8 - .../output/app/components/product/image.css | 15 -- .../output/app/components/product/image.hbs | 12 - .../output/app/components/product/image.js | 6 - .../output/app/components/ui/form.css | 19 -- .../output/app/components/ui/form.hbs | 70 ----- .../output/app/components/ui/form.js | 17 -- .../app/components/ui/form/checkbox.css | 37 --- .../app/components/ui/form/checkbox.hbs | 40 --- .../output/app/components/ui/form/checkbox.js | 41 --- .../output/app/components/ui/form/field.css | 83 ------ .../output/app/components/ui/form/field.hbs | 27 -- .../app/components/ui/form/information.css | 16 -- .../app/components/ui/form/information.hbs | 23 -- .../output/app/components/ui/form/input.css | 24 -- .../output/app/components/ui/form/input.hbs | 33 --- .../output/app/components/ui/form/input.js | 42 --- .../output/app/components/ui/form/number.css | 9 - .../output/app/components/ui/form/number.hbs | 34 --- .../output/app/components/ui/form/number.js | 37 --- .../output/app/components/ui/form/select.css | 33 --- .../output/app/components/ui/form/select.hbs | 79 ------ .../output/app/components/ui/form/select.js | 40 --- .../app/components/ui/form/textarea.css | 24 -- .../app/components/ui/form/textarea.hbs | 33 --- .../output/app/components/ui/form/textarea.js | 30 --- .../output/app/components/ui/page.css | 20 -- .../output/app/components/ui/page.hbs | 9 - .../javascript/output/app/controllers/form.js | 44 ---- .../output/app/controllers/products.js | 59 ----- .../javascript/output/app/models/product.js | 11 - .../output/app/routes/application.js | 10 - .../app/javascript/output/app/routes/form.js | 3 - .../app/javascript/output/app/routes/index.js | 3 - .../output/app/routes/product-details.js | 32 --- .../javascript/output/app/routes/products.js | 19 -- .../output/app/routes/products/product.js | 38 --- .../output/app/serializers/application.js | 3 - .../javascript/output/app/services/config.js | 25 -- .../output/app/services/experiments.js | 82 ------ .../app/javascript/output/app/styles/app.css | 109 -------- .../output/app/styles/application.css | 55 ---- .../app/javascript/output/app/styles/form.css | 7 - .../javascript/output/app/styles/index.css | 3 - .../output/app/styles/product-details.css | 17 -- .../javascript/output/app/styles/products.css | 73 ------ .../output/app/styles/products/product.css | 13 - .../output/app/templates/application.hbs | 47 ---- .../javascript/output/app/templates/form.hbs | 76 ------ .../javascript/output/app/templates/index.hbs | 5 - .../output/app/templates/product-details.hbs | 15 -- .../output/app/templates/products.hbs | 62 ----- .../output/app/templates/products/product.hbs | 5 - .../output/app/utils/components/form/index.js | 26 -- .../app/javascript/output/app/utils/fetch.js | 11 - .../app/javascript/output/package.json | 4 - .../tests/helpers/components/form/index.js | 10 - .../javascript/output/tests/helpers/index.js | 3 - .../output/tests/helpers/services/config.js | 23 -- .../tests/helpers/services/experiments.js | 10 - .../components/navigation-menu-test.js | 45 ---- .../components/product/card-test.js | 71 ----- .../components/product/details-test.js | 89 ------- .../components/product/image-test.js | 18 -- .../integration/components/ui/form-test.js | 179 ------------- .../components/ui/form/checkbox-test.js | 209 --------------- .../components/ui/form/field-test.js | 74 ------ .../components/ui/form/information-test.js | 63 ----- .../components/ui/form/input-test.js | 169 ------------ .../components/ui/form/number-test.js | 159 ------------ .../components/ui/form/select-test.js | 244 ------------------ .../components/ui/form/textarea-test.js | 144 ----------- .../integration/components/ui/page-test.js | 29 --- .../tests/unit/controllers/form-test.js | 82 ------ .../tests/unit/controllers/products-test.js | 95 ------- .../tests/unit/routes/application-test.js | 11 - .../output/tests/unit/routes/form-test.js | 11 - .../output/tests/unit/routes/index-test.js | 11 - .../tests/unit/routes/product-details-test.js | 11 - .../output/tests/unit/routes/products-test.js | 11 - .../unit/routes/products/product-test.js | 11 - .../output/tests/unit/services/config-test.js | 54 ---- .../tests/unit/services/experiments-test.js | 204 --------------- tests/fixtures/app/sass/index.ts | 6 - .../app/sass/input/app/application/adapter.js | 3 - .../app/sass/input/app/application/route.js | 10 - .../sass/input/app/application/serializer.js | 3 - .../sass/input/app/application/styles.scss | 55 ---- .../sass/input/app/application/template.hbs | 47 ---- .../components/navigation-menu/styles.scss | 22 -- .../components/navigation-menu/template.hbs | 15 -- .../app/components/product/card/styles.scss | 101 -------- .../app/components/product/card/template.hbs | 51 ---- .../components/product/details/component.js | 8 - .../components/product/details/styles.scss | 45 ---- .../components/product/details/template.hbs | 72 ------ .../app/components/product/image/component.js | 6 - .../app/components/product/image/styles.scss | 15 -- .../app/components/product/image/template.hbs | 12 - .../components/ui/form/checkbox/component.js | 41 --- .../components/ui/form/checkbox/styles.scss | 37 --- .../components/ui/form/checkbox/template.hbs | 40 --- .../input/app/components/ui/form/component.js | 17 -- .../app/components/ui/form/field/styles.scss | 83 ------ .../app/components/ui/form/field/template.hbs | 27 -- .../ui/form/information/styles.scss | 16 -- .../ui/form/information/template.hbs | 23 -- .../app/components/ui/form/input/component.js | 42 --- .../app/components/ui/form/input/styles.scss | 24 -- .../app/components/ui/form/input/template.hbs | 33 --- .../components/ui/form/number/component.js | 37 --- .../app/components/ui/form/number/styles.scss | 9 - .../components/ui/form/number/template.hbs | 34 --- .../components/ui/form/select/component.js | 40 --- .../app/components/ui/form/select/styles.scss | 33 --- .../components/ui/form/select/template.hbs | 79 ------ .../input/app/components/ui/form/styles.scss | 19 -- .../input/app/components/ui/form/template.hbs | 70 ----- .../components/ui/form/textarea/component.js | 30 --- .../components/ui/form/textarea/styles.scss | 24 -- .../components/ui/form/textarea/template.hbs | 33 --- .../input/app/components/ui/page/styles.scss | 20 -- .../input/app/components/ui/page/template.hbs | 9 - .../app/sass/input/app/config/service.js | 25 -- .../app/sass/input/app/experiments/service.js | 82 ------ .../app/sass/input/app/form/controller.js | 44 ---- .../fixtures/app/sass/input/app/form/route.js | 3 - .../app/sass/input/app/form/styles.scss | 7 - .../app/sass/input/app/form/template.hbs | 76 ------ .../app/sass/input/app/index/route.js | 3 - .../app/sass/input/app/index/styles.scss | 3 - .../app/sass/input/app/index/template.hbs | 5 - .../sass/input/app/product-details/route.js | 32 --- .../input/app/product-details/styles.scss | 17 -- .../input/app/product-details/template.hbs | 15 -- .../app/sass/input/app/product/model.js | 11 - .../app/sass/input/app/products/controller.js | 59 ----- .../sass/input/app/products/product/route.js | 38 --- .../input/app/products/product/styles.scss | 13 - .../input/app/products/product/template.hbs | 5 - .../app/sass/input/app/products/route.js | 19 -- .../app/sass/input/app/products/styles.scss | 73 ------ .../app/sass/input/app/products/template.hbs | 62 ----- .../app/sass/input/app/styles/app.scss | 109 -------- .../input/app/utils/components/form/index.js | 26 -- .../app/sass/input/app/utils/fetch.js | 11 - tests/fixtures/app/sass/input/package.json | 4 - .../tests/helpers/components/form/index.js | 10 - .../app/sass/input/tests/helpers/index.js | 3 - .../input/tests/helpers/services/config.js | 23 -- .../tests/helpers/services/experiments.js | 10 - .../navigation-menu/component-test.js | 45 ---- .../components/product/card/component-test.js | 71 ----- .../product/details/component-test.js | 89 ------- .../product/image/component-test.js | 18 -- .../ui/form/checkbox/component-test.js | 209 --------------- .../components/ui/form/component-test.js | 179 ------------- .../ui/form/field/component-test.js | 74 ------ .../ui/form/information/component-test.js | 63 ----- .../ui/form/input/component-test.js | 169 ------------ .../ui/form/number/component-test.js | 159 ------------ .../ui/form/select/component-test.js | 244 ------------------ .../ui/form/textarea/component-test.js | 144 ----------- .../components/ui/page/component-test.js | 29 --- .../tests/unit/application/route-test.js | 11 - .../input/tests/unit/config/service-test.js | 54 ---- .../unit/controllers/form/controller-test.js | 82 ------ .../controllers/products/controller-test.js | 95 ------- .../tests/unit/experiments/service-test.js | 204 --------------- .../input/tests/unit/form/controller-test.js | 82 ------ .../sass/input/tests/unit/form/route-test.js | 11 - .../sass/input/tests/unit/index/route-test.js | 11 - .../tests/unit/product-details/route-test.js | 11 - .../tests/unit/products/controller-test.js | 95 ------- .../tests/unit/products/product/route-test.js | 11 - .../input/tests/unit/products/route-test.js | 11 - .../unit/routes/application/route-test.js | 11 - .../tests/unit/routes/form/route-test.js | 11 - .../tests/unit/routes/index/route-test.js | 11 - .../unit/routes/product-details/route-test.js | 11 - .../routes/products/product/route-test.js | 11 - .../tests/unit/routes/products/route-test.js | 11 - .../sass/output/app/adapters/application.js | 3 - .../output/app/components/navigation-menu.hbs | 15 -- .../app/components/navigation-menu.scss | 22 -- .../output/app/components/product/card.hbs | 51 ---- .../output/app/components/product/card.scss | 101 -------- .../output/app/components/product/details.hbs | 72 ------ .../output/app/components/product/details.js | 8 - .../app/components/product/details.scss | 45 ---- .../output/app/components/product/image.hbs | 12 - .../output/app/components/product/image.js | 6 - .../output/app/components/product/image.scss | 15 -- .../sass/output/app/components/ui/form.hbs | 70 ----- .../app/sass/output/app/components/ui/form.js | 17 -- .../sass/output/app/components/ui/form.scss | 19 -- .../app/components/ui/form/checkbox.hbs | 40 --- .../output/app/components/ui/form/checkbox.js | 41 --- .../app/components/ui/form/checkbox.scss | 37 --- .../output/app/components/ui/form/field.hbs | 27 -- .../output/app/components/ui/form/field.scss | 83 ------ .../app/components/ui/form/information.hbs | 23 -- .../app/components/ui/form/information.scss | 16 -- .../output/app/components/ui/form/input.hbs | 33 --- .../output/app/components/ui/form/input.js | 42 --- .../output/app/components/ui/form/input.scss | 24 -- .../output/app/components/ui/form/number.hbs | 34 --- .../output/app/components/ui/form/number.js | 37 --- .../output/app/components/ui/form/number.scss | 9 - .../output/app/components/ui/form/select.hbs | 79 ------ .../output/app/components/ui/form/select.js | 40 --- .../output/app/components/ui/form/select.scss | 33 --- .../app/components/ui/form/textarea.hbs | 33 --- .../output/app/components/ui/form/textarea.js | 30 --- .../app/components/ui/form/textarea.scss | 24 -- .../sass/output/app/components/ui/page.hbs | 9 - .../sass/output/app/components/ui/page.scss | 20 -- .../app/sass/output/app/controllers/form.js | 44 ---- .../sass/output/app/controllers/products.js | 59 ----- .../app/sass/output/app/models/product.js | 11 - .../app/sass/output/app/routes/application.js | 10 - .../app/sass/output/app/routes/form.js | 3 - .../app/sass/output/app/routes/index.js | 3 - .../sass/output/app/routes/product-details.js | 32 --- .../app/sass/output/app/routes/products.js | 19 -- .../output/app/routes/products/product.js | 38 --- .../output/app/serializers/application.js | 3 - .../app/sass/output/app/services/config.js | 25 -- .../sass/output/app/services/experiments.js | 82 ------ .../app/sass/output/app/styles/app.scss | 109 -------- .../sass/output/app/styles/application.scss | 55 ---- .../app/sass/output/app/styles/form.scss | 7 - .../app/sass/output/app/styles/index.scss | 3 - .../output/app/styles/product-details.scss | 17 -- .../app/sass/output/app/styles/products.scss | 73 ------ .../output/app/styles/products/product.scss | 13 - .../sass/output/app/templates/application.hbs | 47 ---- .../app/sass/output/app/templates/form.hbs | 76 ------ .../app/sass/output/app/templates/index.hbs | 5 - .../output/app/templates/product-details.hbs | 15 -- .../sass/output/app/templates/products.hbs | 62 ----- .../output/app/templates/products/product.hbs | 5 - .../output/app/utils/components/form/index.js | 26 -- .../app/sass/output/app/utils/fetch.js | 11 - tests/fixtures/app/sass/output/package.json | 4 - .../tests/helpers/components/form/index.js | 10 - .../app/sass/output/tests/helpers/index.js | 3 - .../output/tests/helpers/services/config.js | 23 -- .../tests/helpers/services/experiments.js | 10 - .../components/navigation-menu-test.js | 45 ---- .../components/product/card-test.js | 71 ----- .../components/product/details-test.js | 89 ------- .../components/product/image-test.js | 18 -- .../integration/components/ui/form-test.js | 179 ------------- .../components/ui/form/checkbox-test.js | 209 --------------- .../components/ui/form/field-test.js | 74 ------ .../components/ui/form/information-test.js | 63 ----- .../components/ui/form/input-test.js | 169 ------------ .../components/ui/form/number-test.js | 159 ------------ .../components/ui/form/select-test.js | 244 ------------------ .../components/ui/form/textarea-test.js | 144 ----------- .../integration/components/ui/page-test.js | 29 --- .../tests/unit/controllers/form-test.js | 82 ------ .../tests/unit/controllers/products-test.js | 95 ------- .../tests/unit/routes/application-test.js | 11 - .../output/tests/unit/routes/form-test.js | 11 - .../output/tests/unit/routes/index-test.js | 11 - .../tests/unit/routes/product-details-test.js | 11 - .../output/tests/unit/routes/products-test.js | 11 - .../unit/routes/products/product-test.js | 11 - .../output/tests/unit/services/config-test.js | 54 ---- .../tests/unit/services/experiments-test.js | 204 --------------- update-test-fixtures.sh | 46 ++-- 379 files changed, 15 insertions(+), 16797 deletions(-) delete mode 100644 tests/fixtures/app/javascript/index.ts delete mode 100644 tests/fixtures/app/javascript/input/app/application/adapter.js delete mode 100644 tests/fixtures/app/javascript/input/app/application/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/application/serializer.js delete mode 100644 tests/fixtures/app/javascript/input/app/application/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/application/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/card/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/card/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/details/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/details/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/details/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/image/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/image/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/product/image/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/checkbox/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/field/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/field/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/information/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/information/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/input/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/input/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/input/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/number/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/number/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/number/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/select/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/select/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/select/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/textarea/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/form/textarea/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/page/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/components/ui/page/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/config/service.js delete mode 100644 tests/fixtures/app/javascript/input/app/experiments/service.js delete mode 100644 tests/fixtures/app/javascript/input/app/form/controller.js delete mode 100644 tests/fixtures/app/javascript/input/app/form/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/form/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/form/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/index/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/index/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/index/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/product-details/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/product-details/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/product-details/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/product/model.js delete mode 100644 tests/fixtures/app/javascript/input/app/products/controller.js delete mode 100644 tests/fixtures/app/javascript/input/app/products/product/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/products/product/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/products/product/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/products/route.js delete mode 100644 tests/fixtures/app/javascript/input/app/products/styles.css delete mode 100644 tests/fixtures/app/javascript/input/app/products/template.hbs delete mode 100644 tests/fixtures/app/javascript/input/app/styles/app.css delete mode 100644 tests/fixtures/app/javascript/input/app/utils/components/form/index.js delete mode 100644 tests/fixtures/app/javascript/input/app/utils/fetch.js delete mode 100644 tests/fixtures/app/javascript/input/package.json delete mode 100644 tests/fixtures/app/javascript/input/tests/helpers/components/form/index.js delete mode 100644 tests/fixtures/app/javascript/input/tests/helpers/index.js delete mode 100644 tests/fixtures/app/javascript/input/tests/helpers/services/config.js delete mode 100644 tests/fixtures/app/javascript/input/tests/helpers/services/experiments.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/navigation-menu/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/product/card/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/product/details/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/product/image/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/checkbox/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/field/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/information/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/input/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/number/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/select/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/form/textarea/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/integration/components/ui/page/component-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/application/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/config/service-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/controllers/form/controller-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/controllers/products/controller-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/experiments/service-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/form/controller-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/form/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/index/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/product-details/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/products/controller-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/products/product/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/products/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/application/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/form/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/index/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/product-details/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/products/product/route-test.js delete mode 100644 tests/fixtures/app/javascript/input/tests/unit/routes/products/route-test.js delete mode 100644 tests/fixtures/app/javascript/output/app/adapters/application.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/navigation-menu.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/card.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/card.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/details.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/details.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/details.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/image.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/image.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/product/image.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/field.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/field.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/information.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/information.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/input.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/input.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/input.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/number.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/number.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/number.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/select.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/select.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/select.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/textarea.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/textarea.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/form/textarea.js delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/page.css delete mode 100644 tests/fixtures/app/javascript/output/app/components/ui/page.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/controllers/form.js delete mode 100644 tests/fixtures/app/javascript/output/app/controllers/products.js delete mode 100644 tests/fixtures/app/javascript/output/app/models/product.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/application.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/form.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/index.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/product-details.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/products.js delete mode 100644 tests/fixtures/app/javascript/output/app/routes/products/product.js delete mode 100644 tests/fixtures/app/javascript/output/app/serializers/application.js delete mode 100644 tests/fixtures/app/javascript/output/app/services/config.js delete mode 100644 tests/fixtures/app/javascript/output/app/services/experiments.js delete mode 100644 tests/fixtures/app/javascript/output/app/styles/app.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/application.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/form.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/index.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/product-details.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/products.css delete mode 100644 tests/fixtures/app/javascript/output/app/styles/products/product.css delete mode 100644 tests/fixtures/app/javascript/output/app/templates/application.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/templates/form.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/templates/index.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/templates/product-details.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/templates/products.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/templates/products/product.hbs delete mode 100644 tests/fixtures/app/javascript/output/app/utils/components/form/index.js delete mode 100644 tests/fixtures/app/javascript/output/app/utils/fetch.js delete mode 100644 tests/fixtures/app/javascript/output/package.json delete mode 100644 tests/fixtures/app/javascript/output/tests/helpers/components/form/index.js delete mode 100644 tests/fixtures/app/javascript/output/tests/helpers/index.js delete mode 100644 tests/fixtures/app/javascript/output/tests/helpers/services/config.js delete mode 100644 tests/fixtures/app/javascript/output/tests/helpers/services/experiments.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/navigation-menu-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/product/card-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/product/details-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/product/image-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/checkbox-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/field-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/information-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/input-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/number-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/select-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/form/textarea-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/integration/components/ui/page-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/controllers/form-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/controllers/products-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/application-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/form-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/index-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/product-details-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/products-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/routes/products/product-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/services/config-test.js delete mode 100644 tests/fixtures/app/javascript/output/tests/unit/services/experiments-test.js delete mode 100644 tests/fixtures/app/sass/index.ts delete mode 100644 tests/fixtures/app/sass/input/app/application/adapter.js delete mode 100644 tests/fixtures/app/sass/input/app/application/route.js delete mode 100644 tests/fixtures/app/sass/input/app/application/serializer.js delete mode 100644 tests/fixtures/app/sass/input/app/application/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/application/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/navigation-menu/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/navigation-menu/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/product/card/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/product/card/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/product/details/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/product/details/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/product/details/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/product/image/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/product/image/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/product/image/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/checkbox/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/checkbox/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/checkbox/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/field/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/field/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/information/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/information/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/input/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/input/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/input/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/number/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/number/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/number/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/select/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/select/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/select/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/textarea/component.js delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/textarea/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/form/textarea/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/page/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/components/ui/page/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/config/service.js delete mode 100644 tests/fixtures/app/sass/input/app/experiments/service.js delete mode 100644 tests/fixtures/app/sass/input/app/form/controller.js delete mode 100644 tests/fixtures/app/sass/input/app/form/route.js delete mode 100644 tests/fixtures/app/sass/input/app/form/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/form/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/index/route.js delete mode 100644 tests/fixtures/app/sass/input/app/index/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/index/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/product-details/route.js delete mode 100644 tests/fixtures/app/sass/input/app/product-details/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/product-details/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/product/model.js delete mode 100644 tests/fixtures/app/sass/input/app/products/controller.js delete mode 100644 tests/fixtures/app/sass/input/app/products/product/route.js delete mode 100644 tests/fixtures/app/sass/input/app/products/product/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/products/product/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/products/route.js delete mode 100644 tests/fixtures/app/sass/input/app/products/styles.scss delete mode 100644 tests/fixtures/app/sass/input/app/products/template.hbs delete mode 100644 tests/fixtures/app/sass/input/app/styles/app.scss delete mode 100644 tests/fixtures/app/sass/input/app/utils/components/form/index.js delete mode 100644 tests/fixtures/app/sass/input/app/utils/fetch.js delete mode 100644 tests/fixtures/app/sass/input/package.json delete mode 100644 tests/fixtures/app/sass/input/tests/helpers/components/form/index.js delete mode 100644 tests/fixtures/app/sass/input/tests/helpers/index.js delete mode 100644 tests/fixtures/app/sass/input/tests/helpers/services/config.js delete mode 100644 tests/fixtures/app/sass/input/tests/helpers/services/experiments.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/navigation-menu/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/product/card/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/product/details/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/product/image/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/checkbox/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/field/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/information/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/input/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/number/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/select/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/form/textarea/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/integration/components/ui/page/component-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/application/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/config/service-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/controllers/form/controller-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/controllers/products/controller-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/experiments/service-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/form/controller-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/form/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/index/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/product-details/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/products/controller-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/products/product/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/products/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/application/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/form/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/index/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/product-details/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/products/product/route-test.js delete mode 100644 tests/fixtures/app/sass/input/tests/unit/routes/products/route-test.js delete mode 100644 tests/fixtures/app/sass/output/app/adapters/application.js delete mode 100644 tests/fixtures/app/sass/output/app/components/navigation-menu.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/navigation-menu.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/product/card.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/product/card.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/product/details.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/product/details.js delete mode 100644 tests/fixtures/app/sass/output/app/components/product/details.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/product/image.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/product/image.js delete mode 100644 tests/fixtures/app/sass/output/app/components/product/image.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/checkbox.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/checkbox.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/checkbox.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/field.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/field.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/information.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/information.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/input.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/input.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/input.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/number.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/number.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/number.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/select.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/select.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/select.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/textarea.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/textarea.js delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/form/textarea.scss delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/page.hbs delete mode 100644 tests/fixtures/app/sass/output/app/components/ui/page.scss delete mode 100644 tests/fixtures/app/sass/output/app/controllers/form.js delete mode 100644 tests/fixtures/app/sass/output/app/controllers/products.js delete mode 100644 tests/fixtures/app/sass/output/app/models/product.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/application.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/form.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/index.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/product-details.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/products.js delete mode 100644 tests/fixtures/app/sass/output/app/routes/products/product.js delete mode 100644 tests/fixtures/app/sass/output/app/serializers/application.js delete mode 100644 tests/fixtures/app/sass/output/app/services/config.js delete mode 100644 tests/fixtures/app/sass/output/app/services/experiments.js delete mode 100644 tests/fixtures/app/sass/output/app/styles/app.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/application.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/form.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/index.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/product-details.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/products.scss delete mode 100644 tests/fixtures/app/sass/output/app/styles/products/product.scss delete mode 100644 tests/fixtures/app/sass/output/app/templates/application.hbs delete mode 100644 tests/fixtures/app/sass/output/app/templates/form.hbs delete mode 100644 tests/fixtures/app/sass/output/app/templates/index.hbs delete mode 100644 tests/fixtures/app/sass/output/app/templates/product-details.hbs delete mode 100644 tests/fixtures/app/sass/output/app/templates/products.hbs delete mode 100644 tests/fixtures/app/sass/output/app/templates/products/product.hbs delete mode 100644 tests/fixtures/app/sass/output/app/utils/components/form/index.js delete mode 100644 tests/fixtures/app/sass/output/app/utils/fetch.js delete mode 100644 tests/fixtures/app/sass/output/package.json delete mode 100644 tests/fixtures/app/sass/output/tests/helpers/components/form/index.js delete mode 100644 tests/fixtures/app/sass/output/tests/helpers/index.js delete mode 100644 tests/fixtures/app/sass/output/tests/helpers/services/config.js delete mode 100644 tests/fixtures/app/sass/output/tests/helpers/services/experiments.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/navigation-menu-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/product/card-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/product/details-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/product/image-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/checkbox-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/field-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/information-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/input-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/number-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/select-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/form/textarea-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/integration/components/ui/page-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/controllers/form-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/controllers/products-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/application-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/form-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/index-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/product-details-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/products-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/routes/products/product-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/services/config-test.js delete mode 100644 tests/fixtures/app/sass/output/tests/unit/services/experiments-test.js 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}} -
-
- -
- - {{t "routes.application.copyright" htmlSafe=true}} - -
-
\ No newline at end of file diff --git a/tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css b/tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css deleted file mode 100644 index 9bee6e9..0000000 --- a/tests/fixtures/app/javascript/input/app/components/navigation-menu/styles.css +++ /dev/null @@ -1,22 +0,0 @@ -/* stylelint-disable selector-pseudo-class-no-unknown */ -.list { - align-items: center; - display: flex; -} - -.link { - display: inline-block; - font-size: 0.875rem; - padding: 0.875rem 1rem; - text-decoration: none; - white-space: nowrap; -} - -.link:global(.active) { - background-color: #15202d; -} - -.link:hover { - background-color: #26313d; - transition: background-color 0.17s; -} diff --git a/tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs b/tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs deleted file mode 100644 index 061bf4c..0000000 --- a/tests/fixtures/app/javascript/input/app/components/navigation-menu/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ - \ 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/application/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/application/route-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/javascript/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/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/products/product/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/products/product/route-test.js deleted file mode 100644 index 7dd63ec..0000000 --- a/tests/fixtures/app/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/app/javascript/input/tests/unit/products/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/products/route-test.js deleted file mode 100644 index 50693f5..0000000 --- a/tests/fixtures/app/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/app/javascript/input/tests/unit/routes/application/route-test.js b/tests/fixtures/app/javascript/input/tests/unit/routes/application/route-test.js deleted file mode 100644 index d7720ea..0000000 --- a/tests/fixtures/app/javascript/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/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/navigation-menu.css b/tests/fixtures/app/javascript/output/app/components/navigation-menu.css deleted file mode 100644 index 9bee6e9..0000000 --- a/tests/fixtures/app/javascript/output/app/components/navigation-menu.css +++ /dev/null @@ -1,22 +0,0 @@ -/* stylelint-disable selector-pseudo-class-no-unknown */ -.list { - align-items: center; - display: flex; -} - -.link { - display: inline-block; - font-size: 0.875rem; - padding: 0.875rem 1rem; - text-decoration: none; - white-space: nowrap; -} - -.link:global(.active) { - background-color: #15202d; -} - -.link:hover { - background-color: #26313d; - transition: background-color 0.17s; -} diff --git a/tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs b/tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs deleted file mode 100644 index 061bf4c..0000000 --- a/tests/fixtures/app/javascript/output/app/components/navigation-menu.hbs +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file 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.css b/tests/fixtures/app/javascript/output/app/components/ui/page.css deleted file mode 100644 index ee54620..0000000 --- a/tests/fixtures/app/javascript/output/app/components/ui/page.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/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/navigation-menu/styles.scss b/tests/fixtures/app/sass/input/app/components/navigation-menu/styles.scss deleted file mode 100644 index 9bee6e9..0000000 --- a/tests/fixtures/app/sass/input/app/components/navigation-menu/styles.scss +++ /dev/null @@ -1,22 +0,0 @@ -/* stylelint-disable selector-pseudo-class-no-unknown */ -.list { - align-items: center; - display: flex; -} - -.link { - display: inline-block; - font-size: 0.875rem; - padding: 0.875rem 1rem; - text-decoration: none; - white-space: nowrap; -} - -.link:global(.active) { - background-color: #15202d; -} - -.link:hover { - background-color: #26313d; - transition: background-color 0.17s; -} diff --git a/tests/fixtures/app/sass/input/app/components/navigation-menu/template.hbs b/tests/fixtures/app/sass/input/app/components/navigation-menu/template.hbs deleted file mode 100644 index 061bf4c..0000000 --- a/tests/fixtures/app/sass/input/app/components/navigation-menu/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ - \ 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/navigation-menu.hbs b/tests/fixtures/app/sass/output/app/components/navigation-menu.hbs deleted file mode 100644 index 061bf4c..0000000 --- a/tests/fixtures/app/sass/output/app/components/navigation-menu.hbs +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/tests/fixtures/app/sass/output/app/components/navigation-menu.scss b/tests/fixtures/app/sass/output/app/components/navigation-menu.scss deleted file mode 100644 index 9bee6e9..0000000 --- a/tests/fixtures/app/sass/output/app/components/navigation-menu.scss +++ /dev/null @@ -1,22 +0,0 @@ -/* stylelint-disable selector-pseudo-class-no-unknown */ -.list { - align-items: center; - display: flex; -} - -.link { - display: inline-block; - font-size: 0.875rem; - padding: 0.875rem 1rem; - text-decoration: none; - white-space: nowrap; -} - -.link:global(.active) { - background-color: #15202d; -} - -.link:hover { - background-color: #26313d; - transition: background-color 0.17s; -} 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/update-test-fixtures.sh b/update-test-fixtures.sh index 644b055..946192a 100755 --- a/update-test-fixtures.sh +++ b/update-test-fixtures.sh @@ -15,30 +15,6 @@ # Compile TypeScript pnpm build -# Update fixtures -rm -r "tests/fixtures/engine/typescript/output" -cp -r "tests/fixtures/engine/typescript/input" "tests/fixtures/engine/typescript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/engine/typescript/output" \ - --type v1-addon - -# Update fixtures -rm -r "tests/fixtures/v1-addon/typescript/output" -cp -r "tests/fixtures/v1-addon/typescript/input" "tests/fixtures/v1-addon/typescript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/v1-addon/typescript/output" \ - --type v1-addon - -# Update fixtures -rm -r "tests/fixtures/app/javascript/output" -cp -r "tests/fixtures/app/javascript/input" "tests/fixtures/app/javascript/output" - -./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/app/javascript/output" \ - --type app - # Update fixtures rm -r "tests/fixtures/app/pod-path/output" cp -r "tests/fixtures/app/pod-path/input" "tests/fixtures/app/pod-path/output" @@ -49,17 +25,25 @@ cp -r "tests/fixtures/app/pod-path/input" "tests/fixtures/app/pod-path/output" --type app # Update fixtures -rm -r "tests/fixtures/app/sass/output" -cp -r "tests/fixtures/app/sass/input" "tests/fixtures/app/sass/output" +rm -r "tests/fixtures/app/typescript/output" +cp -r "tests/fixtures/app/typescript/input" "tests/fixtures/app/typescript/output" ./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/app/sass/output" \ + --root "tests/fixtures/app/typescript/output" \ --type app # Update fixtures -rm -r "tests/fixtures/app/typescript/output" -cp -r "tests/fixtures/app/typescript/input" "tests/fixtures/app/typescript/output" +rm -r "tests/fixtures/engine/typescript/output" +cp -r "tests/fixtures/engine/typescript/input" "tests/fixtures/engine/typescript/output" ./dist/bin/ember-codemod-pod-to-octane.js \ - --root "tests/fixtures/app/typescript/output" \ - --type app + --root "tests/fixtures/engine/typescript/output" \ + --type v1-addon + +# Update fixtures +rm -r "tests/fixtures/v1-addon/typescript/output" +cp -r "tests/fixtures/v1-addon/typescript/input" "tests/fixtures/v1-addon/typescript/output" + +./dist/bin/ember-codemod-pod-to-octane.js \ + --root "tests/fixtures/v1-addon/typescript/output" \ + --type v1-addon From a29686c5d3dbcfaa59f715ce770c5d5f6b18907b Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Fri, 11 Oct 2024 19:03:37 +0200 Subject: [PATCH 4/5] chore: Fixed failing tests --- .../shared-test-setups/app/javascript.ts | 17 - tests/helpers/shared-test-setups/app/sass.ts | 17 - .../shared-test-setups/engine/javascript.ts | 17 - .../helpers/shared-test-setups/engine/sass.ts | 17 - .../shared-test-setups/v1-addon/javascript.ts | 17 - .../shared-test-setups/v1-addon/sass.ts | 17 - tests/migration/app/index/javascript.test.ts | 21 -- tests/migration/app/index/sass.test.ts | 21 -- .../create-file-path-maps/javascript.test.ts | 293 ------------------ .../steps/create-file-path-maps/sass.test.ts | 293 ------------------ .../steps/create-options/javascript.test.ts | 14 - .../app/steps/create-options/sass.test.ts | 14 - .../migration/engine/index/javascript.test.ts | 21 -- tests/migration/engine/index/sass.test.ts | 21 -- .../v1-addon/index/javascript.test.ts | 21 -- tests/migration/v1-addon/index/sass.test.ts | 21 -- .../create-file-path-maps/javascript.test.ts | 200 ------------ .../steps/create-file-path-maps/sass.test.ts | 200 ------------ .../create-file-path-maps/typescript.test.ts | 197 +++--------- .../steps/create-options/javascript.test.ts | 14 - .../steps/create-options/sass.test.ts | 14 - ...{javascript.test.ts => typescript.test.ts} | 4 +- 22 files changed, 51 insertions(+), 1420 deletions(-) delete mode 100644 tests/helpers/shared-test-setups/app/javascript.ts delete mode 100644 tests/helpers/shared-test-setups/app/sass.ts delete mode 100644 tests/helpers/shared-test-setups/engine/javascript.ts delete mode 100644 tests/helpers/shared-test-setups/engine/sass.ts delete mode 100644 tests/helpers/shared-test-setups/v1-addon/javascript.ts delete mode 100644 tests/helpers/shared-test-setups/v1-addon/sass.ts delete mode 100644 tests/migration/app/index/javascript.test.ts delete mode 100644 tests/migration/app/index/sass.test.ts delete mode 100644 tests/migration/app/steps/create-file-path-maps/javascript.test.ts delete mode 100644 tests/migration/app/steps/create-file-path-maps/sass.test.ts delete mode 100644 tests/migration/app/steps/create-options/javascript.test.ts delete mode 100644 tests/migration/app/steps/create-options/sass.test.ts delete mode 100644 tests/migration/engine/index/javascript.test.ts delete mode 100644 tests/migration/engine/index/sass.test.ts delete mode 100644 tests/migration/v1-addon/index/javascript.test.ts delete mode 100644 tests/migration/v1-addon/index/sass.test.ts delete mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/javascript.test.ts delete mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/sass.test.ts delete mode 100644 tests/migration/v1-addon/steps/create-options/javascript.test.ts delete mode 100644 tests/migration/v1-addon/steps/create-options/sass.test.ts rename tests/migration/v1-addon/steps/update-paths-in-app-folder/{javascript.test.ts => typescript.test.ts} (92%) diff --git a/tests/helpers/shared-test-setups/app/javascript.ts b/tests/helpers/shared-test-setups/app/javascript.ts deleted file mode 100644 index f462657..0000000 --- a/tests/helpers/shared-test-setups/app/javascript.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/app/javascript', - projectType: 'app', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/app/javascript', - projectType: 'app', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/helpers/shared-test-setups/app/sass.ts b/tests/helpers/shared-test-setups/app/sass.ts deleted file mode 100644 index 2bd32f5..0000000 --- a/tests/helpers/shared-test-setups/app/sass.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/app/sass', - projectType: 'app', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/app/sass', - projectType: 'app', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/helpers/shared-test-setups/engine/javascript.ts b/tests/helpers/shared-test-setups/engine/javascript.ts deleted file mode 100644 index 2b68244..0000000 --- a/tests/helpers/shared-test-setups/engine/javascript.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/engine/javascript', - projectType: 'v1-addon', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/engine/javascript', - projectType: 'v1-addon', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/helpers/shared-test-setups/engine/sass.ts b/tests/helpers/shared-test-setups/engine/sass.ts deleted file mode 100644 index 848fda4..0000000 --- a/tests/helpers/shared-test-setups/engine/sass.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/engine/sass', - projectType: 'v1-addon', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/engine/sass', - projectType: 'v1-addon', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/helpers/shared-test-setups/v1-addon/javascript.ts b/tests/helpers/shared-test-setups/v1-addon/javascript.ts deleted file mode 100644 index 8550ae1..0000000 --- a/tests/helpers/shared-test-setups/v1-addon/javascript.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/v1-addon/javascript', - projectType: 'v1-addon', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/v1-addon/javascript', - projectType: 'v1-addon', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/helpers/shared-test-setups/v1-addon/sass.ts b/tests/helpers/shared-test-setups/v1-addon/sass.ts deleted file mode 100644 index a13c52f..0000000 --- a/tests/helpers/shared-test-setups/v1-addon/sass.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { CodemodOptions, Options } from '../../../../src/types/index.js'; - -const codemodOptions: CodemodOptions = { - podPath: '', - projectRoot: 'tmp/v1-addon/sass', - projectType: 'v1-addon', - testRun: false, -}; - -const options: Options = { - podPath: '', - projectRoot: 'tmp/v1-addon/sass', - projectType: 'v1-addon', - testRun: false, -}; - -export { codemodOptions, options }; diff --git a/tests/migration/app/index/javascript.test.ts b/tests/migration/app/index/javascript.test.ts deleted file mode 100644 index 8f6a50c..0000000 --- a/tests/migration/app/index/javascript.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateApp } from '../../../../src/migration/app/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/app/javascript/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/app/javascript.js'; - -test('migration | app | index > javascript', function () { - loadFixture(inputProject, codemodOptions); - - migrateApp(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateApp(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/app/index/sass.test.ts b/tests/migration/app/index/sass.test.ts deleted file mode 100644 index 1896344..0000000 --- a/tests/migration/app/index/sass.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateApp } from '../../../../src/migration/app/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/app/sass/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/app/sass.js'; - -test('migration | app | index > sass', function () { - loadFixture(inputProject, codemodOptions); - - migrateApp(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateApp(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/app/steps/create-file-path-maps/javascript.test.ts b/tests/migration/app/steps/create-file-path-maps/javascript.test.ts deleted file mode 100644 index 9a19cb3..0000000 --- a/tests/migration/app/steps/create-file-path-maps/javascript.test.ts +++ /dev/null @@ -1,293 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createFilePathMaps } from '../../../../../src/migration/app/steps/index.js'; -import { inputProject } from '../../../../fixtures/app/javascript/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/app/javascript.js'; - -test('migration | app | steps | create-file-path-maps > javascript', function () { - loadFixture(inputProject, codemodOptions); - - const filePathMaps = createFilePathMaps(options); - - assert.deepStrictEqual( - filePathMaps.app, - new Map([ - ['app/application/adapter.js', 'app/adapters/application.js'], - ['app/application/route.js', 'app/routes/application.js'], - ['app/application/serializer.js', 'app/serializers/application.js'], - ['app/application/styles.css', 'app/styles/application.css'], - ['app/application/template.hbs', 'app/templates/application.hbs'], - [ - 'app/components/navigation-menu/styles.css', - 'app/components/navigation-menu.css', - ], - [ - 'app/components/navigation-menu/template.hbs', - 'app/components/navigation-menu.hbs', - ], - [ - 'app/components/product/card/styles.css', - 'app/components/product/card.css', - ], - [ - 'app/components/product/card/template.hbs', - 'app/components/product/card.hbs', - ], - [ - 'app/components/product/details/component.js', - 'app/components/product/details.js', - ], - [ - 'app/components/product/details/styles.css', - 'app/components/product/details.css', - ], - [ - 'app/components/product/details/template.hbs', - 'app/components/product/details.hbs', - ], - [ - 'app/components/product/image/component.js', - 'app/components/product/image.js', - ], - [ - 'app/components/product/image/styles.css', - 'app/components/product/image.css', - ], - [ - 'app/components/product/image/template.hbs', - 'app/components/product/image.hbs', - ], - [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], - [ - 'app/components/ui/form/checkbox/styles.css', - 'app/components/ui/form/checkbox.css', - ], - [ - 'app/components/ui/form/checkbox/template.hbs', - 'app/components/ui/form/checkbox.hbs', - ], - ['app/components/ui/form/component.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/field/styles.css', - 'app/components/ui/form/field.css', - ], - [ - 'app/components/ui/form/field/template.hbs', - 'app/components/ui/form/field.hbs', - ], - [ - 'app/components/ui/form/information/styles.css', - 'app/components/ui/form/information.css', - ], - [ - 'app/components/ui/form/information/template.hbs', - 'app/components/ui/form/information.hbs', - ], - [ - 'app/components/ui/form/input/component.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/input/styles.css', - 'app/components/ui/form/input.css', - ], - [ - 'app/components/ui/form/input/template.hbs', - 'app/components/ui/form/input.hbs', - ], - [ - 'app/components/ui/form/number/component.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/number/styles.css', - 'app/components/ui/form/number.css', - ], - [ - 'app/components/ui/form/number/template.hbs', - 'app/components/ui/form/number.hbs', - ], - [ - 'app/components/ui/form/select/component.js', - 'app/components/ui/form/select.js', - ], - [ - 'app/components/ui/form/select/styles.css', - 'app/components/ui/form/select.css', - ], - [ - 'app/components/ui/form/select/template.hbs', - 'app/components/ui/form/select.hbs', - ], - ['app/components/ui/form/styles.css', 'app/components/ui/form.css'], - ['app/components/ui/form/template.hbs', 'app/components/ui/form.hbs'], - [ - 'app/components/ui/form/textarea/component.js', - 'app/components/ui/form/textarea.js', - ], - [ - 'app/components/ui/form/textarea/styles.css', - 'app/components/ui/form/textarea.css', - ], - [ - 'app/components/ui/form/textarea/template.hbs', - 'app/components/ui/form/textarea.hbs', - ], - ['app/components/ui/page/styles.css', 'app/components/ui/page.css'], - ['app/components/ui/page/template.hbs', 'app/components/ui/page.hbs'], - ['app/config/service.js', 'app/services/config.js'], - ['app/experiments/service.js', 'app/services/experiments.js'], - ['app/form/controller.js', 'app/controllers/form.js'], - ['app/form/route.js', 'app/routes/form.js'], - ['app/form/styles.css', 'app/styles/form.css'], - ['app/form/template.hbs', 'app/templates/form.hbs'], - ['app/index/route.js', 'app/routes/index.js'], - ['app/index/styles.css', 'app/styles/index.css'], - ['app/index/template.hbs', 'app/templates/index.hbs'], - ['app/product-details/route.js', 'app/routes/product-details.js'], - ['app/product-details/styles.css', 'app/styles/product-details.css'], - ['app/product-details/template.hbs', 'app/templates/product-details.hbs'], - ['app/product/model.js', 'app/models/product.js'], - ['app/products/controller.js', 'app/controllers/products.js'], - ['app/products/product/route.js', 'app/routes/products/product.js'], - ['app/products/product/styles.css', 'app/styles/products/product.css'], - [ - 'app/products/product/template.hbs', - 'app/templates/products/product.hbs', - ], - ['app/products/route.js', 'app/routes/products.js'], - ['app/products/styles.css', 'app/styles/products.css'], - ['app/products/template.hbs', 'app/templates/products.hbs'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.tests, - new Map([ - [ - 'tests/integration/components/navigation-menu/component-test.js', - 'tests/integration/components/navigation-menu-test.js', - ], - [ - 'tests/integration/components/product/card/component-test.js', - 'tests/integration/components/product/card-test.js', - ], - [ - 'tests/integration/components/product/details/component-test.js', - 'tests/integration/components/product/details-test.js', - ], - [ - 'tests/integration/components/product/image/component-test.js', - 'tests/integration/components/product/image-test.js', - ], - [ - 'tests/integration/components/ui/form/checkbox/component-test.js', - 'tests/integration/components/ui/form/checkbox-test.js', - ], - [ - 'tests/integration/components/ui/form/component-test.js', - 'tests/integration/components/ui/form-test.js', - ], - [ - 'tests/integration/components/ui/form/field/component-test.js', - 'tests/integration/components/ui/form/field-test.js', - ], - [ - 'tests/integration/components/ui/form/information/component-test.js', - 'tests/integration/components/ui/form/information-test.js', - ], - [ - 'tests/integration/components/ui/form/input/component-test.js', - 'tests/integration/components/ui/form/input-test.js', - ], - [ - 'tests/integration/components/ui/form/number/component-test.js', - 'tests/integration/components/ui/form/number-test.js', - ], - [ - 'tests/integration/components/ui/form/select/component-test.js', - 'tests/integration/components/ui/form/select-test.js', - ], - [ - 'tests/integration/components/ui/form/textarea/component-test.js', - 'tests/integration/components/ui/form/textarea-test.js', - ], - [ - 'tests/integration/components/ui/page/component-test.js', - 'tests/integration/components/ui/page-test.js', - ], - [ - 'tests/unit/application/route-test.js', - 'tests/unit/routes/application-test.js', - ], - [ - 'tests/unit/config/service-test.js', - 'tests/unit/services/config-test.js', - ], - [ - 'tests/unit/controllers/form/controller-test.js', - 'tests/unit/controllers/form-test.js', - ], - [ - 'tests/unit/controllers/products/controller-test.js', - 'tests/unit/controllers/products-test.js', - ], - [ - 'tests/unit/experiments/service-test.js', - 'tests/unit/services/experiments-test.js', - ], - [ - 'tests/unit/form/controller-test.js', - 'tests/unit/controllers/form-test.js', - ], - ['tests/unit/form/route-test.js', 'tests/unit/routes/form-test.js'], - ['tests/unit/index/route-test.js', 'tests/unit/routes/index-test.js'], - [ - 'tests/unit/product-details/route-test.js', - 'tests/unit/routes/product-details-test.js', - ], - [ - 'tests/unit/products/product/route-test.js', - 'tests/unit/routes/products/product-test.js', - ], - [ - 'tests/unit/products/route-test.js', - 'tests/unit/routes/products-test.js', - ], - [ - 'tests/unit/routes/application/route-test.js', - 'tests/unit/routes/application-test.js', - ], - [ - 'tests/unit/routes/form/route-test.js', - 'tests/unit/routes/form-test.js', - ], - [ - 'tests/unit/routes/index/route-test.js', - 'tests/unit/routes/index-test.js', - ], - [ - 'tests/unit/routes/product-details/route-test.js', - 'tests/unit/routes/product-details-test.js', - ], - [ - 'tests/unit/products/controller-test.js', - 'tests/unit/controllers/products-test.js', - ], - [ - 'tests/unit/routes/products/product/route-test.js', - 'tests/unit/routes/products/product-test.js', - ], - [ - 'tests/unit/routes/products/route-test.js', - 'tests/unit/routes/products-test.js', - ], - ]), - ); -}); diff --git a/tests/migration/app/steps/create-file-path-maps/sass.test.ts b/tests/migration/app/steps/create-file-path-maps/sass.test.ts deleted file mode 100644 index 6e72e8b..0000000 --- a/tests/migration/app/steps/create-file-path-maps/sass.test.ts +++ /dev/null @@ -1,293 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createFilePathMaps } from '../../../../../src/migration/app/steps/index.js'; -import { inputProject } from '../../../../fixtures/app/sass/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/app/sass.js'; - -test('migration | app | steps | create-file-path-maps > sass', function () { - loadFixture(inputProject, codemodOptions); - - const filePathMaps = createFilePathMaps(options); - - assert.deepStrictEqual( - filePathMaps.app, - new Map([ - ['app/application/adapter.js', 'app/adapters/application.js'], - ['app/application/route.js', 'app/routes/application.js'], - ['app/application/serializer.js', 'app/serializers/application.js'], - ['app/application/styles.scss', 'app/styles/application.scss'], - ['app/application/template.hbs', 'app/templates/application.hbs'], - [ - 'app/components/navigation-menu/styles.scss', - 'app/components/navigation-menu.scss', - ], - [ - 'app/components/navigation-menu/template.hbs', - 'app/components/navigation-menu.hbs', - ], - [ - 'app/components/product/card/styles.scss', - 'app/components/product/card.scss', - ], - [ - 'app/components/product/card/template.hbs', - 'app/components/product/card.hbs', - ], - [ - 'app/components/product/details/component.js', - 'app/components/product/details.js', - ], - [ - 'app/components/product/details/styles.scss', - 'app/components/product/details.scss', - ], - [ - 'app/components/product/details/template.hbs', - 'app/components/product/details.hbs', - ], - [ - 'app/components/product/image/component.js', - 'app/components/product/image.js', - ], - [ - 'app/components/product/image/styles.scss', - 'app/components/product/image.scss', - ], - [ - 'app/components/product/image/template.hbs', - 'app/components/product/image.hbs', - ], - [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], - [ - 'app/components/ui/form/checkbox/styles.scss', - 'app/components/ui/form/checkbox.scss', - ], - [ - 'app/components/ui/form/checkbox/template.hbs', - 'app/components/ui/form/checkbox.hbs', - ], - ['app/components/ui/form/component.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/field/styles.scss', - 'app/components/ui/form/field.scss', - ], - [ - 'app/components/ui/form/field/template.hbs', - 'app/components/ui/form/field.hbs', - ], - [ - 'app/components/ui/form/information/styles.scss', - 'app/components/ui/form/information.scss', - ], - [ - 'app/components/ui/form/information/template.hbs', - 'app/components/ui/form/information.hbs', - ], - [ - 'app/components/ui/form/input/component.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/input/styles.scss', - 'app/components/ui/form/input.scss', - ], - [ - 'app/components/ui/form/input/template.hbs', - 'app/components/ui/form/input.hbs', - ], - [ - 'app/components/ui/form/number/component.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/number/styles.scss', - 'app/components/ui/form/number.scss', - ], - [ - 'app/components/ui/form/number/template.hbs', - 'app/components/ui/form/number.hbs', - ], - [ - 'app/components/ui/form/select/component.js', - 'app/components/ui/form/select.js', - ], - [ - 'app/components/ui/form/select/styles.scss', - 'app/components/ui/form/select.scss', - ], - [ - 'app/components/ui/form/select/template.hbs', - 'app/components/ui/form/select.hbs', - ], - ['app/components/ui/form/styles.scss', 'app/components/ui/form.scss'], - ['app/components/ui/form/template.hbs', 'app/components/ui/form.hbs'], - [ - 'app/components/ui/form/textarea/component.js', - 'app/components/ui/form/textarea.js', - ], - [ - 'app/components/ui/form/textarea/styles.scss', - 'app/components/ui/form/textarea.scss', - ], - [ - 'app/components/ui/form/textarea/template.hbs', - 'app/components/ui/form/textarea.hbs', - ], - ['app/components/ui/page/styles.scss', 'app/components/ui/page.scss'], - ['app/components/ui/page/template.hbs', 'app/components/ui/page.hbs'], - ['app/config/service.js', 'app/services/config.js'], - ['app/experiments/service.js', 'app/services/experiments.js'], - ['app/form/controller.js', 'app/controllers/form.js'], - ['app/form/route.js', 'app/routes/form.js'], - ['app/form/styles.scss', 'app/styles/form.scss'], - ['app/form/template.hbs', 'app/templates/form.hbs'], - ['app/index/route.js', 'app/routes/index.js'], - ['app/index/styles.scss', 'app/styles/index.scss'], - ['app/index/template.hbs', 'app/templates/index.hbs'], - ['app/product-details/route.js', 'app/routes/product-details.js'], - ['app/product-details/styles.scss', 'app/styles/product-details.scss'], - ['app/product-details/template.hbs', 'app/templates/product-details.hbs'], - ['app/product/model.js', 'app/models/product.js'], - ['app/products/controller.js', 'app/controllers/products.js'], - ['app/products/product/route.js', 'app/routes/products/product.js'], - ['app/products/product/styles.scss', 'app/styles/products/product.scss'], - [ - 'app/products/product/template.hbs', - 'app/templates/products/product.hbs', - ], - ['app/products/route.js', 'app/routes/products.js'], - ['app/products/styles.scss', 'app/styles/products.scss'], - ['app/products/template.hbs', 'app/templates/products.hbs'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.tests, - new Map([ - [ - 'tests/integration/components/navigation-menu/component-test.js', - 'tests/integration/components/navigation-menu-test.js', - ], - [ - 'tests/integration/components/product/card/component-test.js', - 'tests/integration/components/product/card-test.js', - ], - [ - 'tests/integration/components/product/details/component-test.js', - 'tests/integration/components/product/details-test.js', - ], - [ - 'tests/integration/components/product/image/component-test.js', - 'tests/integration/components/product/image-test.js', - ], - [ - 'tests/integration/components/ui/form/checkbox/component-test.js', - 'tests/integration/components/ui/form/checkbox-test.js', - ], - [ - 'tests/integration/components/ui/form/component-test.js', - 'tests/integration/components/ui/form-test.js', - ], - [ - 'tests/integration/components/ui/form/field/component-test.js', - 'tests/integration/components/ui/form/field-test.js', - ], - [ - 'tests/integration/components/ui/form/information/component-test.js', - 'tests/integration/components/ui/form/information-test.js', - ], - [ - 'tests/integration/components/ui/form/input/component-test.js', - 'tests/integration/components/ui/form/input-test.js', - ], - [ - 'tests/integration/components/ui/form/number/component-test.js', - 'tests/integration/components/ui/form/number-test.js', - ], - [ - 'tests/integration/components/ui/form/select/component-test.js', - 'tests/integration/components/ui/form/select-test.js', - ], - [ - 'tests/integration/components/ui/form/textarea/component-test.js', - 'tests/integration/components/ui/form/textarea-test.js', - ], - [ - 'tests/integration/components/ui/page/component-test.js', - 'tests/integration/components/ui/page-test.js', - ], - [ - 'tests/unit/application/route-test.js', - 'tests/unit/routes/application-test.js', - ], - [ - 'tests/unit/config/service-test.js', - 'tests/unit/services/config-test.js', - ], - [ - 'tests/unit/controllers/form/controller-test.js', - 'tests/unit/controllers/form-test.js', - ], - [ - 'tests/unit/controllers/products/controller-test.js', - 'tests/unit/controllers/products-test.js', - ], - [ - 'tests/unit/experiments/service-test.js', - 'tests/unit/services/experiments-test.js', - ], - [ - 'tests/unit/form/controller-test.js', - 'tests/unit/controllers/form-test.js', - ], - ['tests/unit/form/route-test.js', 'tests/unit/routes/form-test.js'], - ['tests/unit/index/route-test.js', 'tests/unit/routes/index-test.js'], - [ - 'tests/unit/product-details/route-test.js', - 'tests/unit/routes/product-details-test.js', - ], - [ - 'tests/unit/products/product/route-test.js', - 'tests/unit/routes/products/product-test.js', - ], - [ - 'tests/unit/products/route-test.js', - 'tests/unit/routes/products-test.js', - ], - [ - 'tests/unit/routes/application/route-test.js', - 'tests/unit/routes/application-test.js', - ], - [ - 'tests/unit/routes/form/route-test.js', - 'tests/unit/routes/form-test.js', - ], - [ - 'tests/unit/routes/index/route-test.js', - 'tests/unit/routes/index-test.js', - ], - [ - 'tests/unit/routes/product-details/route-test.js', - 'tests/unit/routes/product-details-test.js', - ], - [ - 'tests/unit/products/controller-test.js', - 'tests/unit/controllers/products-test.js', - ], - [ - 'tests/unit/routes/products/product/route-test.js', - 'tests/unit/routes/products/product-test.js', - ], - [ - 'tests/unit/routes/products/route-test.js', - 'tests/unit/routes/products-test.js', - ], - ]), - ); -}); diff --git a/tests/migration/app/steps/create-options/javascript.test.ts b/tests/migration/app/steps/create-options/javascript.test.ts deleted file mode 100644 index 9136085..0000000 --- a/tests/migration/app/steps/create-options/javascript.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createOptions } from '../../../../../src/migration/app/steps/index.js'; -import { inputProject } from '../../../../fixtures/app/javascript/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/app/javascript.js'; - -test('migration | app | steps | create-options > javascript', function () { - loadFixture(inputProject, codemodOptions); - - assert.deepStrictEqual(createOptions(codemodOptions), options); -}); diff --git a/tests/migration/app/steps/create-options/sass.test.ts b/tests/migration/app/steps/create-options/sass.test.ts deleted file mode 100644 index 6b97041..0000000 --- a/tests/migration/app/steps/create-options/sass.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createOptions } from '../../../../../src/migration/app/steps/index.js'; -import { inputProject } from '../../../../fixtures/app/sass/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/app/sass.js'; - -test('migration | app | steps | create-options > sass', function () { - loadFixture(inputProject, codemodOptions); - - assert.deepStrictEqual(createOptions(codemodOptions), options); -}); diff --git a/tests/migration/engine/index/javascript.test.ts b/tests/migration/engine/index/javascript.test.ts deleted file mode 100644 index 0c3e3be..0000000 --- a/tests/migration/engine/index/javascript.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateV1Addon } from '../../../../src/migration/v1-addon/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/engine/javascript/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/engine/javascript.js'; - -test('migration | engine | index > javascript', function () { - loadFixture(inputProject, codemodOptions); - - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/engine/index/sass.test.ts b/tests/migration/engine/index/sass.test.ts deleted file mode 100644 index 9147240..0000000 --- a/tests/migration/engine/index/sass.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateV1Addon } from '../../../../src/migration/v1-addon/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/engine/sass/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/engine/sass.js'; - -test('migration | engine | index > sass', function () { - loadFixture(inputProject, codemodOptions); - - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/v1-addon/index/javascript.test.ts b/tests/migration/v1-addon/index/javascript.test.ts deleted file mode 100644 index ad4ddec..0000000 --- a/tests/migration/v1-addon/index/javascript.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateV1Addon } from '../../../../src/migration/v1-addon/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/v1-addon/javascript/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/v1-addon/javascript.js'; - -test('migration | v1-addon | index > javascript', function () { - loadFixture(inputProject, codemodOptions); - - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/v1-addon/index/sass.test.ts b/tests/migration/v1-addon/index/sass.test.ts deleted file mode 100644 index 1f473e5..0000000 --- a/tests/migration/v1-addon/index/sass.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; - -import { migrateV1Addon } from '../../../../src/migration/v1-addon/index.js'; -import { - inputProject, - outputProject, -} from '../../../fixtures/v1-addon/sass/index.js'; -import { codemodOptions } from '../../../helpers/shared-test-setups/v1-addon/sass.js'; - -test('migration | v1-addon | index > sass', function () { - loadFixture(inputProject, codemodOptions); - - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); - - // Check idempotence - migrateV1Addon(codemodOptions); - - assertFixture(outputProject, codemodOptions); -}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/javascript.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/javascript.test.ts deleted file mode 100644 index d18ffb1..0000000 --- a/tests/migration/v1-addon/steps/create-file-path-maps/javascript.test.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; -import { inputProject } from '../../../../fixtures/v1-addon/javascript/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/v1-addon/javascript.js'; - -test('migration | v1-addon | steps | create-file-path-maps > javascript', function () { - loadFixture(inputProject, codemodOptions); - - const filePathMaps = createFilePathMaps(options); - - assert.deepStrictEqual( - filePathMaps.addon, - new Map([ - [ - 'addon/components/ui/form/checkbox/component.js', - 'addon/components/ui/form/checkbox.js', - ], - [ - 'addon/components/ui/form/checkbox/styles.css', - 'addon/components/ui/form/checkbox.css', - ], - [ - 'addon/components/ui/form/checkbox/template.hbs', - 'addon/components/ui/form/checkbox.hbs', - ], - ['addon/components/ui/form/component.js', 'addon/components/ui/form.js'], - [ - 'addon/components/ui/form/field/styles.css', - 'addon/components/ui/form/field.css', - ], - [ - 'addon/components/ui/form/field/template.hbs', - 'addon/components/ui/form/field.hbs', - ], - [ - 'addon/components/ui/form/information/styles.css', - 'addon/components/ui/form/information.css', - ], - [ - 'addon/components/ui/form/information/template.hbs', - 'addon/components/ui/form/information.hbs', - ], - [ - 'addon/components/ui/form/input/component.js', - 'addon/components/ui/form/input.js', - ], - [ - 'addon/components/ui/form/input/styles.css', - 'addon/components/ui/form/input.css', - ], - [ - 'addon/components/ui/form/input/template.hbs', - 'addon/components/ui/form/input.hbs', - ], - [ - 'addon/components/ui/form/number/component.js', - 'addon/components/ui/form/number.js', - ], - [ - 'addon/components/ui/form/number/styles.css', - 'addon/components/ui/form/number.css', - ], - [ - 'addon/components/ui/form/number/template.hbs', - 'addon/components/ui/form/number.hbs', - ], - [ - 'addon/components/ui/form/select/component.js', - 'addon/components/ui/form/select.js', - ], - [ - 'addon/components/ui/form/select/styles.css', - 'addon/components/ui/form/select.css', - ], - [ - 'addon/components/ui/form/select/template.hbs', - 'addon/components/ui/form/select.hbs', - ], - ['addon/components/ui/form/styles.css', 'addon/components/ui/form.css'], - ['addon/components/ui/form/template.hbs', 'addon/components/ui/form.hbs'], - [ - 'addon/components/ui/form/textarea/component.js', - 'addon/components/ui/form/textarea.js', - ], - [ - 'addon/components/ui/form/textarea/styles.css', - 'addon/components/ui/form/textarea.css', - ], - [ - 'addon/components/ui/form/textarea/template.hbs', - 'addon/components/ui/form/textarea.hbs', - ], - ['addon/components/ui/page/styles.css', 'addon/components/ui/page.css'], - ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.app, - new Map([ - [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], - [ - 'app/components/ui/form/checkbox/template.js', - 'app/components/ui/form/checkbox.js', - ], - ['app/components/ui/form/component.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/field/template.js', - 'app/components/ui/form/field.js', - ], - [ - 'app/components/ui/form/information/template.js', - 'app/components/ui/form/information.js', - ], - [ - 'app/components/ui/form/input/component.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/input/template.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/number/component.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/number/template.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/select/component.js', - 'app/components/ui/form/select.js', - ], - [ - 'app/components/ui/form/select/template.js', - 'app/components/ui/form/select.js', - ], - ['app/components/ui/form/template.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/textarea/component.js', - 'app/components/ui/form/textarea.js', - ], - [ - 'app/components/ui/form/textarea/template.js', - 'app/components/ui/form/textarea.js', - ], - ['app/components/ui/page/template.js', 'app/components/ui/page.js'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.tests, - new Map([ - [ - 'tests/integration/components/ui/form/checkbox/component-test.js', - 'tests/integration/components/ui/form/checkbox-test.js', - ], - [ - 'tests/integration/components/ui/form/component-test.js', - 'tests/integration/components/ui/form-test.js', - ], - [ - 'tests/integration/components/ui/form/field/component-test.js', - 'tests/integration/components/ui/form/field-test.js', - ], - [ - 'tests/integration/components/ui/form/information/component-test.js', - 'tests/integration/components/ui/form/information-test.js', - ], - [ - 'tests/integration/components/ui/form/input/component-test.js', - 'tests/integration/components/ui/form/input-test.js', - ], - [ - 'tests/integration/components/ui/form/number/component-test.js', - 'tests/integration/components/ui/form/number-test.js', - ], - [ - 'tests/integration/components/ui/form/select/component-test.js', - 'tests/integration/components/ui/form/select-test.js', - ], - [ - 'tests/integration/components/ui/form/textarea/component-test.js', - 'tests/integration/components/ui/form/textarea-test.js', - ], - [ - 'tests/integration/components/ui/page/component-test.js', - 'tests/integration/components/ui/page-test.js', - ], - ]), - ); -}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/sass.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/sass.test.ts deleted file mode 100644 index f7d111a..0000000 --- a/tests/migration/v1-addon/steps/create-file-path-maps/sass.test.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; -import { inputProject } from '../../../../fixtures/v1-addon/sass/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/v1-addon/sass.js'; - -test('migration | v1-addon | steps | create-file-path-maps > sass', function () { - loadFixture(inputProject, codemodOptions); - - const filePathMaps = createFilePathMaps(options); - - assert.deepStrictEqual( - filePathMaps.addon, - new Map([ - [ - 'addon/components/ui/form/checkbox/component.js', - 'addon/components/ui/form/checkbox.js', - ], - [ - 'addon/components/ui/form/checkbox/styles.scss', - 'addon/components/ui/form/checkbox.scss', - ], - [ - 'addon/components/ui/form/checkbox/template.hbs', - 'addon/components/ui/form/checkbox.hbs', - ], - ['addon/components/ui/form/component.js', 'addon/components/ui/form.js'], - [ - 'addon/components/ui/form/field/styles.scss', - 'addon/components/ui/form/field.scss', - ], - [ - 'addon/components/ui/form/field/template.hbs', - 'addon/components/ui/form/field.hbs', - ], - [ - 'addon/components/ui/form/information/styles.scss', - 'addon/components/ui/form/information.scss', - ], - [ - 'addon/components/ui/form/information/template.hbs', - 'addon/components/ui/form/information.hbs', - ], - [ - 'addon/components/ui/form/input/component.js', - 'addon/components/ui/form/input.js', - ], - [ - 'addon/components/ui/form/input/styles.scss', - 'addon/components/ui/form/input.scss', - ], - [ - 'addon/components/ui/form/input/template.hbs', - 'addon/components/ui/form/input.hbs', - ], - [ - 'addon/components/ui/form/number/component.js', - 'addon/components/ui/form/number.js', - ], - [ - 'addon/components/ui/form/number/styles.scss', - 'addon/components/ui/form/number.scss', - ], - [ - 'addon/components/ui/form/number/template.hbs', - 'addon/components/ui/form/number.hbs', - ], - [ - 'addon/components/ui/form/select/component.js', - 'addon/components/ui/form/select.js', - ], - [ - 'addon/components/ui/form/select/styles.scss', - 'addon/components/ui/form/select.scss', - ], - [ - 'addon/components/ui/form/select/template.hbs', - 'addon/components/ui/form/select.hbs', - ], - ['addon/components/ui/form/styles.scss', 'addon/components/ui/form.scss'], - ['addon/components/ui/form/template.hbs', 'addon/components/ui/form.hbs'], - [ - 'addon/components/ui/form/textarea/component.js', - 'addon/components/ui/form/textarea.js', - ], - [ - 'addon/components/ui/form/textarea/styles.scss', - 'addon/components/ui/form/textarea.scss', - ], - [ - 'addon/components/ui/form/textarea/template.hbs', - 'addon/components/ui/form/textarea.hbs', - ], - ['addon/components/ui/page/styles.scss', 'addon/components/ui/page.scss'], - ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.app, - new Map([ - [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], - [ - 'app/components/ui/form/checkbox/template.js', - 'app/components/ui/form/checkbox.js', - ], - ['app/components/ui/form/component.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/field/template.js', - 'app/components/ui/form/field.js', - ], - [ - 'app/components/ui/form/information/template.js', - 'app/components/ui/form/information.js', - ], - [ - 'app/components/ui/form/input/component.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/input/template.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/number/component.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/number/template.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/select/component.js', - 'app/components/ui/form/select.js', - ], - [ - 'app/components/ui/form/select/template.js', - 'app/components/ui/form/select.js', - ], - ['app/components/ui/form/template.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/textarea/component.js', - 'app/components/ui/form/textarea.js', - ], - [ - 'app/components/ui/form/textarea/template.js', - 'app/components/ui/form/textarea.js', - ], - ['app/components/ui/page/template.js', 'app/components/ui/page.js'], - ]), - ); - - assert.deepStrictEqual( - filePathMaps.tests, - new Map([ - [ - 'tests/integration/components/ui/form/checkbox/component-test.js', - 'tests/integration/components/ui/form/checkbox-test.js', - ], - [ - 'tests/integration/components/ui/form/component-test.js', - 'tests/integration/components/ui/form-test.js', - ], - [ - 'tests/integration/components/ui/form/field/component-test.js', - 'tests/integration/components/ui/form/field-test.js', - ], - [ - 'tests/integration/components/ui/form/information/component-test.js', - 'tests/integration/components/ui/form/information-test.js', - ], - [ - 'tests/integration/components/ui/form/input/component-test.js', - 'tests/integration/components/ui/form/input-test.js', - ], - [ - 'tests/integration/components/ui/form/number/component-test.js', - 'tests/integration/components/ui/form/number-test.js', - ], - [ - 'tests/integration/components/ui/form/select/component-test.js', - 'tests/integration/components/ui/form/select-test.js', - ], - [ - 'tests/integration/components/ui/form/textarea/component-test.js', - 'tests/integration/components/ui/form/textarea-test.js', - ], - [ - 'tests/integration/components/ui/page/component-test.js', - 'tests/integration/components/ui/page-test.js', - ], - ]), - ); -}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts index 55eac85..65c6bcd 100644 --- a/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts +++ b/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts @@ -16,98 +16,38 @@ test('migration | v1-addon | steps | create-file-path-maps > typescript', functi filePathMaps.addon, new Map([ [ - 'addon/components/ui/form/checkbox/component.ts', - 'addon/components/ui/form/checkbox.ts', + 'addon/components/navigation-menu/component.ts', + 'addon/components/navigation-menu.ts', ], [ - 'addon/components/ui/form/checkbox/styles.css', - 'addon/components/ui/form/checkbox.css', + 'addon/components/navigation-menu/styles.css', + 'addon/components/navigation-menu.css', ], [ - 'addon/components/ui/form/checkbox/template.hbs', - 'addon/components/ui/form/checkbox.hbs', - ], - ['addon/components/ui/form/component.ts', 'addon/components/ui/form.ts'], - [ - 'addon/components/ui/form/field/component.d.ts', - 'addon/components/ui/form/field.d.ts', - ], - [ - 'addon/components/ui/form/field/styles.css', - 'addon/components/ui/form/field.css', - ], - [ - 'addon/components/ui/form/field/template.hbs', - 'addon/components/ui/form/field.hbs', - ], - [ - 'addon/components/ui/form/information/component.d.ts', - 'addon/components/ui/form/information.d.ts', - ], - [ - 'addon/components/ui/form/information/styles.css', - 'addon/components/ui/form/information.css', - ], - [ - 'addon/components/ui/form/information/template.hbs', - 'addon/components/ui/form/information.hbs', - ], - [ - 'addon/components/ui/form/input/component.ts', - 'addon/components/ui/form/input.ts', - ], - [ - 'addon/components/ui/form/input/styles.css', - 'addon/components/ui/form/input.css', - ], - [ - 'addon/components/ui/form/input/template.hbs', - 'addon/components/ui/form/input.hbs', - ], - [ - 'addon/components/ui/form/number/component.ts', - 'addon/components/ui/form/number.ts', - ], - [ - 'addon/components/ui/form/number/styles.css', - 'addon/components/ui/form/number.css', - ], - [ - 'addon/components/ui/form/number/template.hbs', - 'addon/components/ui/form/number.hbs', - ], - [ - 'addon/components/ui/form/select/component.ts', - 'addon/components/ui/form/select.ts', - ], - [ - 'addon/components/ui/form/select/styles.css', - 'addon/components/ui/form/select.css', - ], - [ - 'addon/components/ui/form/select/template.hbs', - 'addon/components/ui/form/select.hbs', - ], - ['addon/components/ui/form/styles.css', 'addon/components/ui/form.css'], - ['addon/components/ui/form/template.hbs', 'addon/components/ui/form.hbs'], - [ - 'addon/components/ui/form/textarea/component.ts', - 'addon/components/ui/form/textarea.ts', + 'addon/components/navigation-menu/template.hbs', + 'addon/components/navigation-menu.hbs', ], + ['addon/components/ui/page/component.ts', 'addon/components/ui/page.ts'], + ['addon/components/ui/page/styles.css', 'addon/components/ui/page.css'], + ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], + ['addon/experiments/service.ts', 'addon/services/experiments.ts'], + ['addon/products/controller.ts', 'addon/controllers/products.ts'], [ - 'addon/components/ui/form/textarea/styles.css', - 'addon/components/ui/form/textarea.css', + 'addon/products/product/controller.ts', + 'addon/controllers/products/product.ts', ], + ['addon/products/product/route.ts', 'addon/routes/products/product.ts'], [ - 'addon/components/ui/form/textarea/template.hbs', - 'addon/components/ui/form/textarea.hbs', + 'addon/products/product/styles.css', + 'addon/styles/products/product.css', ], [ - 'addon/components/ui/page/component.d.ts', - 'addon/components/ui/page.d.ts', + 'addon/products/product/template.hbs', + 'addon/templates/products/product.hbs', ], - ['addon/components/ui/page/styles.css', 'addon/components/ui/page.css'], - ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], + ['addon/products/route.ts', 'addon/routes/products.ts'], + ['addon/products/styles.css', 'addon/styles/products.css'], + ['addon/products/template.hbs', 'addon/templates/products.hbs'], ]), ); @@ -115,56 +55,25 @@ test('migration | v1-addon | steps | create-file-path-maps > typescript', functi filePathMaps.app, new Map([ [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], - [ - 'app/components/ui/form/checkbox/template.js', - 'app/components/ui/form/checkbox.js', - ], - ['app/components/ui/form/component.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/field/template.js', - 'app/components/ui/form/field.js', - ], - [ - 'app/components/ui/form/information/template.js', - 'app/components/ui/form/information.js', - ], - [ - 'app/components/ui/form/input/component.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/input/template.js', - 'app/components/ui/form/input.js', - ], - [ - 'app/components/ui/form/number/component.js', - 'app/components/ui/form/number.js', + 'app/components/navigation-menu/component.js', + 'app/components/navigation-menu.js', ], [ - 'app/components/ui/form/number/template.js', - 'app/components/ui/form/number.js', - ], - [ - 'app/components/ui/form/select/component.js', - 'app/components/ui/form/select.js', - ], - [ - 'app/components/ui/form/select/template.js', - 'app/components/ui/form/select.js', - ], - ['app/components/ui/form/template.js', 'app/components/ui/form.js'], - [ - 'app/components/ui/form/textarea/component.js', - 'app/components/ui/form/textarea.js', + 'app/components/navigation-menu/template.js', + 'app/components/navigation-menu.js', ], + ['app/components/ui/page/component.js', 'app/components/ui/page.js'], + ['app/components/ui/page/template.js', 'app/components/ui/page.js'], + ['app/experiments/service.js', 'app/services/experiments.js'], + ['app/products/controller.js', 'app/controllers/products.js'], [ - 'app/components/ui/form/textarea/template.js', - 'app/components/ui/form/textarea.js', + 'app/products/product/controller.js', + 'app/controllers/products/product.js', ], - ['app/components/ui/page/template.js', 'app/components/ui/page.js'], + ['app/products/product/route.js', 'app/routes/products/product.js'], + ['app/products/product/template.js', 'app/templates/products/product.js'], + ['app/products/route.js', 'app/routes/products.js'], + ['app/products/template.js', 'app/templates/products.js'], ]), ); @@ -172,40 +81,32 @@ test('migration | v1-addon | steps | create-file-path-maps > typescript', functi filePathMaps.tests, new Map([ [ - 'tests/integration/components/ui/form/checkbox/component-test.ts', - 'tests/integration/components/ui/form/checkbox-test.ts', + 'tests/integration/components/navigation-menu/component-test.ts', + 'tests/integration/components/navigation-menu-test.ts', ], [ - 'tests/integration/components/ui/form/component-test.ts', - 'tests/integration/components/ui/form-test.ts', - ], - [ - 'tests/integration/components/ui/form/field/component-test.ts', - 'tests/integration/components/ui/form/field-test.ts', - ], - [ - 'tests/integration/components/ui/form/information/component-test.ts', - 'tests/integration/components/ui/form/information-test.ts', + 'tests/integration/components/ui/page/component-test.ts', + 'tests/integration/components/ui/page-test.ts', ], [ - 'tests/integration/components/ui/form/input/component-test.ts', - 'tests/integration/components/ui/form/input-test.ts', + 'tests/unit/experiments/service-test.ts', + 'tests/unit/services/experiments-test.ts', ], [ - 'tests/integration/components/ui/form/number/component-test.ts', - 'tests/integration/components/ui/form/number-test.ts', + 'tests/unit/products/controller-test.ts', + 'tests/unit/controllers/products-test.ts', ], [ - 'tests/integration/components/ui/form/select/component-test.ts', - 'tests/integration/components/ui/form/select-test.ts', + 'tests/unit/products/product/controller-test.ts', + 'tests/unit/controllers/products/product-test.ts', ], [ - 'tests/integration/components/ui/form/textarea/component-test.ts', - 'tests/integration/components/ui/form/textarea-test.ts', + 'tests/unit/products/product/route-test.ts', + 'tests/unit/routes/products/product-test.ts', ], [ - 'tests/integration/components/ui/page/component-test.ts', - 'tests/integration/components/ui/page-test.ts', + 'tests/unit/products/route-test.ts', + 'tests/unit/routes/products-test.ts', ], ]), ); diff --git a/tests/migration/v1-addon/steps/create-options/javascript.test.ts b/tests/migration/v1-addon/steps/create-options/javascript.test.ts deleted file mode 100644 index f723091..0000000 --- a/tests/migration/v1-addon/steps/create-options/javascript.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createOptions } from '../../../../../src/migration/v1-addon/steps/index.js'; -import { inputProject } from '../../../../fixtures/v1-addon/javascript/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/v1-addon/javascript.js'; - -test('migration | v1-addon | steps | create-options > javascript', function () { - loadFixture(inputProject, codemodOptions); - - assert.deepStrictEqual(createOptions(codemodOptions), options); -}); diff --git a/tests/migration/v1-addon/steps/create-options/sass.test.ts b/tests/migration/v1-addon/steps/create-options/sass.test.ts deleted file mode 100644 index 7ed2d48..0000000 --- a/tests/migration/v1-addon/steps/create-options/sass.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { assert, loadFixture, test } from '@codemod-utils/tests'; - -import { createOptions } from '../../../../../src/migration/v1-addon/steps/index.js'; -import { inputProject } from '../../../../fixtures/v1-addon/sass/index.js'; -import { - codemodOptions, - options, -} from '../../../../helpers/shared-test-setups/v1-addon/sass.js'; - -test('migration | v1-addon | steps | create-options > sass', function () { - loadFixture(inputProject, codemodOptions); - - assert.deepStrictEqual(createOptions(codemodOptions), options); -}); diff --git a/tests/migration/v1-addon/steps/update-paths-in-app-folder/javascript.test.ts b/tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts similarity index 92% rename from tests/migration/v1-addon/steps/update-paths-in-app-folder/javascript.test.ts rename to tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts index 1203e07..5d4b28b 100644 --- a/tests/migration/v1-addon/steps/update-paths-in-app-folder/javascript.test.ts +++ b/tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts @@ -5,9 +5,9 @@ import { updatePathsInAppFolder } from '../../../../../src/migration/v1-addon/st import { codemodOptions, options, -} from '../../../../helpers/shared-test-setups/v1-addon/javascript.js'; +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; -test('migration | v1-addon | steps | update-paths-in-app-folder > javascript', function () { +test('migration | v1-addon | steps | update-paths-in-app-folder > typescript', function () { const inputProject = { app: { components: { From b9792b3241a6a89e77d7e073663bc19aa4b6c988 Mon Sep 17 00:00:00 2001 From: ijlee2 Date: Fri, 11 Oct 2024 19:09:09 +0200 Subject: [PATCH 5/5] refactor: Increased test coverage --- .../components-file-extensions.test.ts | 86 ++++++++++++++ .../create-file-path-maps/components.test.ts | 111 ++++++++++++++++++ .../edge-case-folders-are-empty.test.ts | 21 ++++ .../routes-file-extensions.test.ts | 82 +++++++++++++ .../{typescript.test.ts => routes.test.ts} | 102 ++++++++-------- .../services-file-extensions.test.ts | 47 ++++++++ .../create-file-path-maps/services.test.ts | 55 +++++++++ .../components.test.ts | 65 ++++++++++ .../update-paths-in-app-folder/routes.test.ts | 79 +++++++++++++ .../{typescript.test.ts => services.test.ts} | 29 ++--- 10 files changed, 602 insertions(+), 75 deletions(-) create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/components-file-extensions.test.ts create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/components.test.ts create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/edge-case-folders-are-empty.test.ts create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/routes-file-extensions.test.ts rename tests/migration/v1-addon/steps/create-file-path-maps/{typescript.test.ts => routes.test.ts} (52%) create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/services-file-extensions.test.ts create mode 100644 tests/migration/v1-addon/steps/create-file-path-maps/services.test.ts create mode 100644 tests/migration/v1-addon/steps/update-paths-in-app-folder/components.test.ts create mode 100644 tests/migration/v1-addon/steps/update-paths-in-app-folder/routes.test.ts rename tests/migration/v1-addon/steps/update-paths-in-app-folder/{typescript.test.ts => services.test.ts} (55%) diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/components-file-extensions.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/components-file-extensions.test.ts new file mode 100644 index 0000000..2f15460 --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/components-file-extensions.test.ts @@ -0,0 +1,86 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > components (file extensions)', function () { + const inputProject = { + addon: { + components: { + 'navigation-menu': { + 'component.js': '', + 'styles.scss': '', + 'template.hbs': '', + }, + ui: { + page: { + 'component.d.ts': '', + 'styles.scss': '', + 'template.hbs': '', + }, + }, + }, + }, + tests: { + integration: { + components: { + 'navigation-menu': { + 'component-test.js': '', + }, + ui: { + page: { + 'component-test.js': '', + }, + }, + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual( + filePathMaps.addon, + new Map([ + [ + 'addon/components/navigation-menu/component.js', + 'addon/components/navigation-menu.js', + ], + [ + 'addon/components/navigation-menu/styles.scss', + 'addon/components/navigation-menu.scss', + ], + [ + 'addon/components/navigation-menu/template.hbs', + 'addon/components/navigation-menu.hbs', + ], + [ + 'addon/components/ui/page/component.d.ts', + 'addon/components/ui/page.d.ts', + ], + ['addon/components/ui/page/styles.scss', 'addon/components/ui/page.scss'], + ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], + ]), + ); + + assert.deepStrictEqual(filePathMaps.app, new Map()); + + assert.deepStrictEqual( + filePathMaps.tests, + new Map([ + [ + 'tests/integration/components/navigation-menu/component-test.js', + 'tests/integration/components/navigation-menu-test.js', + ], + [ + 'tests/integration/components/ui/page/component-test.js', + 'tests/integration/components/ui/page-test.js', + ], + ]), + ); +}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/components.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/components.test.ts new file mode 100644 index 0000000..b7953cb --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/components.test.ts @@ -0,0 +1,111 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > components', function () { + const inputProject = { + addon: { + components: { + 'navigation-menu': { + 'component.ts': '', + 'styles.css': '', + 'template.hbs': '', + }, + ui: { + page: { + 'component.ts': '', + 'styles.css': '', + 'template.hbs': '', + }, + }, + }, + }, + app: { + components: { + 'navigation-menu': { + 'component.js': '', + 'template.js': '', + }, + ui: { + page: { + 'component.js': '', + 'template.js': '', + }, + }, + }, + }, + tests: { + integration: { + components: { + 'navigation-menu': { + 'component-test.ts': '', + }, + ui: { + page: { + 'component-test.ts': '', + }, + }, + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual( + filePathMaps.addon, + new Map([ + [ + 'addon/components/navigation-menu/component.ts', + 'addon/components/navigation-menu.ts', + ], + [ + 'addon/components/navigation-menu/styles.css', + 'addon/components/navigation-menu.css', + ], + [ + 'addon/components/navigation-menu/template.hbs', + 'addon/components/navigation-menu.hbs', + ], + ['addon/components/ui/page/component.ts', 'addon/components/ui/page.ts'], + ['addon/components/ui/page/styles.css', 'addon/components/ui/page.css'], + ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], + ]), + ); + + assert.deepStrictEqual( + filePathMaps.app, + new Map([ + [ + 'app/components/navigation-menu/component.js', + 'app/components/navigation-menu.js', + ], + [ + 'app/components/navigation-menu/template.js', + 'app/components/navigation-menu.js', + ], + ['app/components/ui/page/component.js', 'app/components/ui/page.js'], + ['app/components/ui/page/template.js', 'app/components/ui/page.js'], + ]), + ); + + assert.deepStrictEqual( + filePathMaps.tests, + new Map([ + [ + 'tests/integration/components/navigation-menu/component-test.ts', + 'tests/integration/components/navigation-menu-test.ts', + ], + [ + 'tests/integration/components/ui/page/component-test.ts', + 'tests/integration/components/ui/page-test.ts', + ], + ]), + ); +}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/edge-case-folders-are-empty.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/edge-case-folders-are-empty.test.ts new file mode 100644 index 0000000..49983e2 --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/edge-case-folders-are-empty.test.ts @@ -0,0 +1,21 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > edge case (folders are empty)', function () { + const inputProject = {}; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual(filePathMaps.addon, new Map()); + + assert.deepStrictEqual(filePathMaps.app, new Map()); + + assert.deepStrictEqual(filePathMaps.tests, new Map()); +}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/routes-file-extensions.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/routes-file-extensions.test.ts new file mode 100644 index 0000000..1cce713 --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/routes-file-extensions.test.ts @@ -0,0 +1,82 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > routes (file extensions)', function () { + const inputProject = { + addon: { + products: { + product: { + 'controller.js': '', + 'route.js': '', + 'template.hbs': '', + }, + 'controller.js': '', + 'route.js': '', + 'template.hbs': '', + }, + }, + tests: { + unit: { + products: { + product: { + 'controller-test.js': '', + 'route-test.js': '', + }, + 'controller-test.js': '', + 'route-test.js': '', + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual( + filePathMaps.addon, + new Map([ + ['addon/products/controller.js', 'addon/controllers/products.js'], + ['addon/products/route.js', 'addon/routes/products.js'], + ['addon/products/template.hbs', 'addon/templates/products.hbs'], + [ + 'addon/products/product/controller.js', + 'addon/controllers/products/product.js', + ], + ['addon/products/product/route.js', 'addon/routes/products/product.js'], + [ + 'addon/products/product/template.hbs', + 'addon/templates/products/product.hbs', + ], + ]), + ); + + assert.deepStrictEqual(filePathMaps.app, new Map()); + + assert.deepStrictEqual( + filePathMaps.tests, + new Map([ + [ + 'tests/unit/products/controller-test.js', + 'tests/unit/controllers/products-test.js', + ], + [ + 'tests/unit/products/route-test.js', + 'tests/unit/routes/products-test.js', + ], + [ + 'tests/unit/products/product/controller-test.js', + 'tests/unit/controllers/products/product-test.js', + ], + [ + 'tests/unit/products/product/route-test.js', + 'tests/unit/routes/products/product-test.js', + ], + ]), + ); +}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/routes.test.ts similarity index 52% rename from tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts rename to tests/migration/v1-addon/steps/create-file-path-maps/routes.test.ts index 65c6bcd..b365e34 100644 --- a/tests/migration/v1-addon/steps/create-file-path-maps/typescript.test.ts +++ b/tests/migration/v1-addon/steps/create-file-path-maps/routes.test.ts @@ -1,13 +1,51 @@ import { assert, loadFixture, test } from '@codemod-utils/tests'; import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; -import { inputProject } from '../../../../fixtures/v1-addon/typescript/index.js'; import { codemodOptions, options, } from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; -test('migration | v1-addon | steps | create-file-path-maps > typescript', function () { +test('migration | v1-addon | steps | create-file-path-maps > routes', function () { + const inputProject = { + addon: { + products: { + product: { + 'controller.ts': '', + 'route.ts': '', + 'template.hbs': '', + }, + 'controller.ts': '', + 'route.ts': '', + 'template.hbs': '', + }, + }, + app: { + products: { + product: { + 'controller.js': '', + 'route.js': '', + 'template.js': '', + }, + 'controller.js': '', + 'route.js': '', + 'template.js': '', + }, + }, + tests: { + unit: { + products: { + product: { + 'controller-test.ts': '', + 'route-test.ts': '', + }, + 'controller-test.ts': '', + 'route-test.ts': '', + }, + }, + }, + }; + loadFixture(inputProject, codemodOptions); const filePathMaps = createFilePathMaps(options); @@ -15,87 +53,47 @@ test('migration | v1-addon | steps | create-file-path-maps > typescript', functi assert.deepStrictEqual( filePathMaps.addon, new Map([ - [ - 'addon/components/navigation-menu/component.ts', - 'addon/components/navigation-menu.ts', - ], - [ - 'addon/components/navigation-menu/styles.css', - 'addon/components/navigation-menu.css', - ], - [ - 'addon/components/navigation-menu/template.hbs', - 'addon/components/navigation-menu.hbs', - ], - ['addon/components/ui/page/component.ts', 'addon/components/ui/page.ts'], - ['addon/components/ui/page/styles.css', 'addon/components/ui/page.css'], - ['addon/components/ui/page/template.hbs', 'addon/components/ui/page.hbs'], - ['addon/experiments/service.ts', 'addon/services/experiments.ts'], ['addon/products/controller.ts', 'addon/controllers/products.ts'], + ['addon/products/route.ts', 'addon/routes/products.ts'], + ['addon/products/template.hbs', 'addon/templates/products.hbs'], [ 'addon/products/product/controller.ts', 'addon/controllers/products/product.ts', ], ['addon/products/product/route.ts', 'addon/routes/products/product.ts'], - [ - 'addon/products/product/styles.css', - 'addon/styles/products/product.css', - ], [ 'addon/products/product/template.hbs', 'addon/templates/products/product.hbs', ], - ['addon/products/route.ts', 'addon/routes/products.ts'], - ['addon/products/styles.css', 'addon/styles/products.css'], - ['addon/products/template.hbs', 'addon/templates/products.hbs'], ]), ); assert.deepStrictEqual( filePathMaps.app, new Map([ - [ - 'app/components/navigation-menu/component.js', - 'app/components/navigation-menu.js', - ], - [ - 'app/components/navigation-menu/template.js', - 'app/components/navigation-menu.js', - ], - ['app/components/ui/page/component.js', 'app/components/ui/page.js'], - ['app/components/ui/page/template.js', 'app/components/ui/page.js'], - ['app/experiments/service.js', 'app/services/experiments.js'], ['app/products/controller.js', 'app/controllers/products.js'], + ['app/products/route.js', 'app/routes/products.js'], + ['app/products/template.js', 'app/templates/products.js'], [ 'app/products/product/controller.js', 'app/controllers/products/product.js', ], ['app/products/product/route.js', 'app/routes/products/product.js'], ['app/products/product/template.js', 'app/templates/products/product.js'], - ['app/products/route.js', 'app/routes/products.js'], - ['app/products/template.js', 'app/templates/products.js'], ]), ); assert.deepStrictEqual( filePathMaps.tests, new Map([ - [ - 'tests/integration/components/navigation-menu/component-test.ts', - 'tests/integration/components/navigation-menu-test.ts', - ], - [ - 'tests/integration/components/ui/page/component-test.ts', - 'tests/integration/components/ui/page-test.ts', - ], - [ - 'tests/unit/experiments/service-test.ts', - 'tests/unit/services/experiments-test.ts', - ], [ 'tests/unit/products/controller-test.ts', 'tests/unit/controllers/products-test.ts', ], + [ + 'tests/unit/products/route-test.ts', + 'tests/unit/routes/products-test.ts', + ], [ 'tests/unit/products/product/controller-test.ts', 'tests/unit/controllers/products/product-test.ts', @@ -104,10 +102,6 @@ test('migration | v1-addon | steps | create-file-path-maps > typescript', functi 'tests/unit/products/product/route-test.ts', 'tests/unit/routes/products/product-test.ts', ], - [ - 'tests/unit/products/route-test.ts', - 'tests/unit/routes/products-test.ts', - ], ]), ); }); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/services-file-extensions.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/services-file-extensions.test.ts new file mode 100644 index 0000000..cabc97b --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/services-file-extensions.test.ts @@ -0,0 +1,47 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > services (file extensions)', function () { + const inputProject = { + addon: { + experiments: { + 'service.js': '', + }, + }, + tests: { + unit: { + experiments: { + 'service-test.js': '', + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual( + filePathMaps.addon, + new Map([ + ['addon/experiments/service.js', 'addon/services/experiments.js'], + ]), + ); + + assert.deepStrictEqual(filePathMaps.app, new Map()); + + assert.deepStrictEqual( + filePathMaps.tests, + new Map([ + [ + 'tests/unit/experiments/service-test.js', + 'tests/unit/services/experiments-test.js', + ], + ]), + ); +}); diff --git a/tests/migration/v1-addon/steps/create-file-path-maps/services.test.ts b/tests/migration/v1-addon/steps/create-file-path-maps/services.test.ts new file mode 100644 index 0000000..90c7095 --- /dev/null +++ b/tests/migration/v1-addon/steps/create-file-path-maps/services.test.ts @@ -0,0 +1,55 @@ +import { assert, loadFixture, test } from '@codemod-utils/tests'; + +import { createFilePathMaps } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | create-file-path-maps > services', function () { + const inputProject = { + addon: { + experiments: { + 'service.ts': '', + }, + }, + app: { + experiments: { + 'service.js': '', + }, + }, + tests: { + unit: { + experiments: { + 'service-test.ts': '', + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMaps = createFilePathMaps(options); + + assert.deepStrictEqual( + filePathMaps.addon, + new Map([ + ['addon/experiments/service.ts', 'addon/services/experiments.ts'], + ]), + ); + + assert.deepStrictEqual( + filePathMaps.app, + new Map([['app/experiments/service.js', 'app/services/experiments.js']]), + ); + + assert.deepStrictEqual( + filePathMaps.tests, + new Map([ + [ + 'tests/unit/experiments/service-test.ts', + 'tests/unit/services/experiments-test.ts', + ], + ]), + ); +}); diff --git a/tests/migration/v1-addon/steps/update-paths-in-app-folder/components.test.ts b/tests/migration/v1-addon/steps/update-paths-in-app-folder/components.test.ts new file mode 100644 index 0000000..3792409 --- /dev/null +++ b/tests/migration/v1-addon/steps/update-paths-in-app-folder/components.test.ts @@ -0,0 +1,65 @@ +import { moveFiles } from '@codemod-utils/files'; +import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; + +import { updatePathsInAppFolder } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | update-paths-in-app-folder > components', function () { + const inputProject = { + app: { + components: { + 'navigation-menu': { + 'component.js': + "export { default } from 'my-v1-addon/components/navigation-menu/component';\n", + 'template.js': + "export { default } from 'my-v1-addon/components/navigation-menu/template';\n", + }, + ui: { + page: { + 'component.js': + "export { default } from 'my-v1-addon/components/ui/page/component';\n", + 'template.js': + "export { default } from 'my-v1-addon/components/ui/page/template';\n", + }, + }, + }, + }, + }; + + const outputProject = { + app: { + components: { + 'navigation-menu.js': + "export { default } from 'my-v1-addon/components/navigation-menu';\n", + ui: { + 'page.js': + "export { default } from 'my-v1-addon/components/ui/page';\n", + }, + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMap = new Map([ + [ + 'app/components/navigation-menu/component.js', + 'app/components/navigation-menu.js', + ], + [ + 'app/components/navigation-menu/template.js', + 'app/components/navigation-menu.js', + ], + ['app/components/ui/page/component.js', 'app/components/ui/page.js'], + ['app/components/ui/page/template.js', 'app/components/ui/page.js'], + ]); + + moveFiles(filePathMap, options); + + updatePathsInAppFolder(filePathMap, options); + + assertFixture(outputProject, codemodOptions); +}); diff --git a/tests/migration/v1-addon/steps/update-paths-in-app-folder/routes.test.ts b/tests/migration/v1-addon/steps/update-paths-in-app-folder/routes.test.ts new file mode 100644 index 0000000..0034a49 --- /dev/null +++ b/tests/migration/v1-addon/steps/update-paths-in-app-folder/routes.test.ts @@ -0,0 +1,79 @@ +import { moveFiles } from '@codemod-utils/files'; +import { assertFixture, loadFixture, test } from '@codemod-utils/tests'; + +import { updatePathsInAppFolder } from '../../../../../src/migration/v1-addon/steps/index.js'; +import { + codemodOptions, + options, +} from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; + +test('migration | v1-addon | steps | update-paths-in-app-folder > routes', function () { + const inputProject = { + app: { + products: { + product: { + 'controller.js': + "export { default } from 'my-v1-addon/products/product/controller';\n", + 'route.js': + "export { default } from 'my-v1-addon/products/product/route';\n", + 'template.js': + "export { default } from 'my-v1-addon/products/product/template';\n", + }, + 'controller.js': + "export { default } from 'my-v1-addon/products/controller';\n", + 'route.js': "export { default } from 'my-v1-addon/products/route';\n", + 'template.js': + "export { default } from 'my-v1-addon/products/template';\n", + }, + }, + }; + + const outputProject = { + app: { + controllers: { + products: { + 'product.js': + "export { default } from 'my-v1-addon/controllers/products/product';\n", + }, + 'products.js': + "export { default } from 'my-v1-addon/controllers/products';\n", + }, + routes: { + products: { + 'product.js': + "export { default } from 'my-v1-addon/routes/products/product';\n", + }, + 'products.js': + "export { default } from 'my-v1-addon/routes/products';\n", + }, + templates: { + products: { + 'product.js': + "export { default } from 'my-v1-addon/templates/products/product';\n", + }, + 'products.js': + "export { default } from 'my-v1-addon/templates/products';\n", + }, + }, + }; + + loadFixture(inputProject, codemodOptions); + + const filePathMap = new Map([ + ['app/products/controller.js', 'app/controllers/products.js'], + ['app/products/route.js', 'app/routes/products.js'], + ['app/products/template.js', 'app/templates/products.js'], + [ + 'app/products/product/controller.js', + 'app/controllers/products/product.js', + ], + ['app/products/product/route.js', 'app/routes/products/product.js'], + ['app/products/product/template.js', 'app/templates/products/product.js'], + ]); + + moveFiles(filePathMap, options); + + updatePathsInAppFolder(filePathMap, options); + + assertFixture(outputProject, codemodOptions); +}); diff --git a/tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts b/tests/migration/v1-addon/steps/update-paths-in-app-folder/services.test.ts similarity index 55% rename from tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts rename to tests/migration/v1-addon/steps/update-paths-in-app-folder/services.test.ts index 5d4b28b..b27b9a6 100644 --- a/tests/migration/v1-addon/steps/update-paths-in-app-folder/typescript.test.ts +++ b/tests/migration/v1-addon/steps/update-paths-in-app-folder/services.test.ts @@ -7,31 +7,21 @@ import { options, } from '../../../../helpers/shared-test-setups/v1-addon/typescript.js'; -test('migration | v1-addon | steps | update-paths-in-app-folder > typescript', function () { +test('migration | v1-addon | steps | update-paths-in-app-folder > services', function () { const inputProject = { app: { - components: { - ui: { - form: { - checkbox: { - 'component.js': - "export { default } from 'addon-javascript/components/ui/form/checkbox/component';\n", - }, - }, - }, + experiments: { + 'service.js': + "export { default } from 'my-v1-addon/experiments/service';\n", }, }, }; const outputProject = { app: { - components: { - ui: { - form: { - 'checkbox.js': - "export { default } from 'addon-javascript/components/ui/form/checkbox';\n", - }, - }, + services: { + 'experiments.js': + "export { default } from 'my-v1-addon/services/experiments';\n", }, }, }; @@ -39,10 +29,7 @@ test('migration | v1-addon | steps | update-paths-in-app-folder > typescript', f loadFixture(inputProject, codemodOptions); const filePathMap = new Map([ - [ - 'app/components/ui/form/checkbox/component.js', - 'app/components/ui/form/checkbox.js', - ], + ['app/experiments/service.js', 'app/services/experiments.js'], ]); moveFiles(filePathMap, options);