From 28918e9945e63afc6e05cc8d0668016a7750aa0d Mon Sep 17 00:00:00 2001 From: ignace Date: Sat, 9 Dec 2023 15:39:46 +0100 Subject: [PATCH 01/11] deps: install qunit-theme-ember --- addon/package.json | 3 ++- pnpm-lock.yaml | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addon/package.json b/addon/package.json index fedb21be..67b109ac 100644 --- a/addon/package.json +++ b/addon/package.json @@ -43,7 +43,8 @@ "dependencies": { "@embroider/addon-shim": "^1.8.6", "@embroider/macros": "^1.13.1", - "ember-cli-test-loader": "^3.1.0" + "ember-cli-test-loader": "^3.1.0", + "qunit-theme-ember": "^0.2.0" }, "devDependencies": { "@babel/core": "^7.23.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9fd1fed7..0f793530 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,6 +19,9 @@ importers: ember-cli-test-loader: specifier: ^3.1.0 version: 3.1.0 + qunit-theme-ember: + specifier: ^0.2.0 + version: 0.2.0 devDependencies: '@babel/core': specifier: ^7.23.2 @@ -11398,6 +11401,10 @@ packages: - supports-color dev: true + /qunit-theme-ember@0.2.0: + resolution: {integrity: sha512-o2j4MoGspsGBnPmWk87/vPHmIsvKNzwCtymbc8bpRxCBVgF1JW5ry2uIFi4XYDY8k6RcL9ashCDHiSjzbn8oqw==} + dev: false + /qunit@2.20.0: resolution: {integrity: sha512-N8Fp1J55waE+QG1KwX2LOyqulZUToRrrPBqDOfYfuAMkEglFL15uwvmH1P4Tq/omQ/mGbBI8PEB3PhIfvUb+jg==} engines: {node: '>=10'} From f4a840dd80625d2970eea983384910913d38f75d Mon Sep 17 00:00:00 2001 From: ignace Date: Sat, 9 Dec 2023 15:40:04 +0100 Subject: [PATCH 02/11] feat: import qunit-theme-ember css --- addon/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addon/src/index.js b/addon/src/index.js index afe79323..09695fc0 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -1,5 +1,6 @@ /* globals Testem */ import 'qunit/qunit/qunit.css'; +import 'qunit-theme-ember/qunit.css'; import { macroCondition, getOwnConfig, importSync } from '@embroider/macros'; From 851304f2e2b2b52dfbb7667a2de140ec00570c31 Mon Sep 17 00:00:00 2001 From: ignace Date: Sat, 9 Dec 2023 16:06:04 +0100 Subject: [PATCH 03/11] fix: import qunit-theme after container styles --- addon/src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/src/index.js b/addon/src/index.js index 09695fc0..c7eea453 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -1,6 +1,5 @@ /* globals Testem */ import 'qunit/qunit/qunit.css'; -import 'qunit-theme-ember/qunit.css'; import { macroCondition, getOwnConfig, importSync } from '@embroider/macros'; @@ -8,6 +7,8 @@ if (macroCondition(!getOwnConfig()?.disableContainerStyles)) { importSync('./test-container-styles.css'); } +import 'qunit-theme-ember/qunit.css'; + export { default as QUnitAdapter, nonTestDoneCallback } from './adapter'; export { loadTests } from './test-loader'; From c193c1e858b2cb9a952c724afa90018d7896e977 Mon Sep 17 00:00:00 2001 From: ignace Date: Sat, 9 Dec 2023 16:07:51 +0100 Subject: [PATCH 04/11] fix: use importSync to ensure order of css --- addon/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/src/index.js b/addon/src/index.js index c7eea453..045c482c 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -7,7 +7,7 @@ if (macroCondition(!getOwnConfig()?.disableContainerStyles)) { importSync('./test-container-styles.css'); } -import 'qunit-theme-ember/qunit.css'; +importSync('qunit-theme-ember/qunit.css'); export { default as QUnitAdapter, nonTestDoneCallback } from './adapter'; export { loadTests } from './test-loader'; From de970cf8f4154c3e55f967e212c15f1181e999f1 Mon Sep 17 00:00:00 2001 From: ignace Date: Sun, 10 Dec 2023 10:52:40 +0100 Subject: [PATCH 05/11] feat: add theme config option --- addon/src/index.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/addon/src/index.js b/addon/src/index.js index 045c482c..8c3660b5 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -1,13 +1,30 @@ /* globals Testem */ -import 'qunit/qunit/qunit.css'; - import { macroCondition, getOwnConfig, importSync } from '@embroider/macros'; +/** + * Load qunit-theme-ember by default, if no custom theme is specified. + */ +if ( + macroCondition( + getOwnConfig()?.theme === undefined || + getOwnConfig()?.theme === 'qunit-default' || + getOwnConfig()?.theme === 'ember' + ) +) { + importSync('qunit/qunit/qunit.css'); +} + if (macroCondition(!getOwnConfig()?.disableContainerStyles)) { importSync('./test-container-styles.css'); } -importSync('qunit-theme-ember/qunit.css'); +if ( + macroCondition( + getOwnConfig()?.theme === undefined || getOwnConfig()?.theme === 'ember' + ) +) { + importSync('qunit-theme-ember/qunit.css'); +} export { default as QUnitAdapter, nonTestDoneCallback } from './adapter'; export { loadTests } from './test-loader'; From e4de39c6ab3a0f9f8b6382e0b5d87531ed2eacb1 Mon Sep 17 00:00:00 2001 From: ignace Date: Sun, 10 Dec 2023 10:56:25 +0100 Subject: [PATCH 06/11] docs: document theme option --- addon/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addon/README.md b/addon/README.md index a561172d..b99d0cf6 100644 --- a/addon/README.md +++ b/addon/README.md @@ -189,6 +189,13 @@ module.exports = function (defaults) { * removes the CSS for the test-container (where the app and components are rendered to) */ disableContainerStyles: true, + /** + * default: 'ember' + * options: 'ember' | 'qunit-default' + * + * Sets the theme for the Web UI of the test runner. Use a different value to disable loading any theme, allowing you to provide your own external one. + */ + theme: 'ember', }, }, }, From 028bee62da289bd957ea1a15f7da9f664dfe4ad2 Mon Sep 17 00:00:00 2001 From: ignace Date: Sun, 10 Dec 2023 11:05:46 +0100 Subject: [PATCH 07/11] test: add coverage for theme build option --- test-buildtime-options-app/ember-cli-build.js | 1 + .../tests/unit/theme-test.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test-buildtime-options-app/tests/unit/theme-test.js diff --git a/test-buildtime-options-app/ember-cli-build.js b/test-buildtime-options-app/ember-cli-build.js index f5ba7f7a..b7eba20c 100644 --- a/test-buildtime-options-app/ember-cli-build.js +++ b/test-buildtime-options-app/ember-cli-build.js @@ -11,6 +11,7 @@ module.exports = function (defaults) { setConfig: { 'ember-qunit': { disableContainerStyles: true, + theme: 'qunit-default', }, }, }, diff --git a/test-buildtime-options-app/tests/unit/theme-test.js b/test-buildtime-options-app/tests/unit/theme-test.js new file mode 100644 index 00000000..a6b8daa3 --- /dev/null +++ b/test-buildtime-options-app/tests/unit/theme-test.js @@ -0,0 +1,17 @@ +import { module, test } from 'qunit'; +import { assert as debugAssert } from '@ember/debug'; + +module('theme', function () { + function style(element) { + return window.getComputedStyle(element); + } + + test('the qunit-default themes are present when used', async function (assert) { + let qunitHeader = document.getElementById('qunit-header'); + + debugAssert(`#qunit-header must exist`, qunitHeader); + + // Defaults + assert.strictEqual(style(qunitHeader).backgroundColor, 'rgb(13, 51, 73)'); + }); +}); From 6f5255ca63aab88c83ee3fcb3f8aae6d429fcd9c Mon Sep 17 00:00:00 2001 From: Ignace Maes Date: Thu, 9 May 2024 17:16:00 +0200 Subject: [PATCH 08/11] refactor: keep qunit-default as the default --- addon/README.md | 6 +++--- addon/src/index.js | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addon/README.md b/addon/README.md index b99d0cf6..fa2b5ffa 100644 --- a/addon/README.md +++ b/addon/README.md @@ -190,12 +190,12 @@ module.exports = function (defaults) { */ disableContainerStyles: true, /** - * default: 'ember' - * options: 'ember' | 'qunit-default' + * default: 'qunit-default' + * options: 'qunit-default' | 'ember' * * Sets the theme for the Web UI of the test runner. Use a different value to disable loading any theme, allowing you to provide your own external one. */ - theme: 'ember', + theme: 'qunit-default', }, }, }, diff --git a/addon/src/index.js b/addon/src/index.js index 8c3660b5..11b020c1 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -18,11 +18,7 @@ if (macroCondition(!getOwnConfig()?.disableContainerStyles)) { importSync('./test-container-styles.css'); } -if ( - macroCondition( - getOwnConfig()?.theme === undefined || getOwnConfig()?.theme === 'ember' - ) -) { +if (macroCondition(getOwnConfig()?.theme === 'ember')) { importSync('qunit-theme-ember/qunit.css'); } From 816dbae9d83e53df0fe425b4b0716d62d1ffc41f Mon Sep 17 00:00:00 2001 From: Ignace Maes Date: Thu, 9 May 2024 17:27:40 +0200 Subject: [PATCH 09/11] deps: bump qunit-theme-ember --- addon/package.json | 2 +- pnpm-lock.yaml | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addon/package.json b/addon/package.json index 67b109ac..eafbb24a 100644 --- a/addon/package.json +++ b/addon/package.json @@ -44,7 +44,7 @@ "@embroider/addon-shim": "^1.8.6", "@embroider/macros": "^1.13.1", "ember-cli-test-loader": "^3.1.0", - "qunit-theme-ember": "^0.2.0" + "qunit-theme-ember": "^1.0.0" }, "devDependencies": { "@babel/core": "^7.23.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f793530..2a1419bf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,8 +20,8 @@ importers: specifier: ^3.1.0 version: 3.1.0 qunit-theme-ember: - specifier: ^0.2.0 - version: 0.2.0 + specifier: ^1.0.0 + version: 1.0.0 devDependencies: '@babel/core': specifier: ^7.23.2 @@ -11401,8 +11401,8 @@ packages: - supports-color dev: true - /qunit-theme-ember@0.2.0: - resolution: {integrity: sha512-o2j4MoGspsGBnPmWk87/vPHmIsvKNzwCtymbc8bpRxCBVgF1JW5ry2uIFi4XYDY8k6RcL9ashCDHiSjzbn8oqw==} + /qunit-theme-ember@1.0.0: + resolution: {integrity: sha512-vdMVVo6ecdCkWttMTKeyq1ZTLGHcA6zdze2zhguNuc3ritlJMhOXY5RDseqazOwqZVfCg3rtlmL3fMUyIzUyFQ==} dev: false /qunit@2.20.0: @@ -13913,6 +13913,7 @@ packages: ember-cli-test-loader: 3.1.0 ember-source: 5.0.0(@babel/core@7.23.2)(@glimmer/component@1.1.2)(webpack@5.86.0) qunit: 2.20.0 + qunit-theme-ember: 1.0.0 transitivePeerDependencies: - '@glint/template' - supports-color From 305fd6490e2c75322991fb7f831f3002d7175ba7 Mon Sep 17 00:00:00 2001 From: Ignace Maes Date: Thu, 9 May 2024 17:31:48 +0200 Subject: [PATCH 10/11] chore: update comment --- addon/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/src/index.js b/addon/src/index.js index 11b020c1..728604ba 100644 --- a/addon/src/index.js +++ b/addon/src/index.js @@ -2,7 +2,7 @@ import { macroCondition, getOwnConfig, importSync } from '@embroider/macros'; /** - * Load qunit-theme-ember by default, if no custom theme is specified. + * Load qunit-default theme by default, if no custom theme is specified. */ if ( macroCondition( From dafee6bdb9a93ab6a83de7421adad6669df31d95 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:18:37 -0400 Subject: [PATCH 11/11] Release 8.1.0 --- addon/CHANGELOG.md | 9 +++++++++ addon/package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addon/CHANGELOG.md b/addon/CHANGELOG.md index 93b53935..5e964772 100644 --- a/addon/CHANGELOG.md +++ b/addon/CHANGELOG.md @@ -4,6 +4,15 @@ + +## v8.1.0 (2024-06-11) + +#### :rocket: Enhancement +* [#1166](https://github.com/emberjs/ember-qunit/pull/1166) feat: introduce `theme` config and add `qunit-theme-ember` as option ([@IgnaceMaes](https://github.com/IgnaceMaes)) + +#### Committers: 1 +- Ignace Maes ([@IgnaceMaes](https://github.com/IgnaceMaes)) + ## v8.0.2 (2023-11-02) #### :bug: Bug Fix diff --git a/addon/package.json b/addon/package.json index eafbb24a..cd46a561 100644 --- a/addon/package.json +++ b/addon/package.json @@ -1,6 +1,6 @@ { "name": "ember-qunit", - "version": "8.0.2", + "version": "8.1.0", "description": "QUnit helpers for testing Ember.js applications", "keywords": [ "ember-addon"