Skip to content

Commit 406fb96

Browse files
Merge branch 'main' into rm-pause-workaround
2 parents 09254e8 + dafee6b commit 406fb96

File tree

7 files changed

+62
-4
lines changed

7 files changed

+62
-4
lines changed

addon/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55

66

7+
8+
## v8.1.0 (2024-06-11)
9+
10+
#### :rocket: Enhancement
11+
* [#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))
12+
13+
#### Committers: 1
14+
- Ignace Maes ([@IgnaceMaes](https://github.com/IgnaceMaes))
15+
716
## v8.0.2 (2023-11-02)
817

918
#### :bug: Bug Fix

addon/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ module.exports = function (defaults) {
189189
* removes the CSS for the test-container (where the app and components are rendered to)
190190
*/
191191
disableContainerStyles: true,
192+
/**
193+
* default: 'qunit-default'
194+
* options: 'qunit-default' | 'ember'
195+
*
196+
* 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.
197+
*/
198+
theme: 'qunit-default',
192199
},
193200
},
194201
},

addon/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-qunit",
3-
"version": "8.0.2",
3+
"version": "8.1.0",
44
"description": "QUnit helpers for testing Ember.js applications",
55
"keywords": [
66
"ember-addon"
@@ -43,7 +43,8 @@
4343
"dependencies": {
4444
"@embroider/addon-shim": "^1.8.6",
4545
"@embroider/macros": "^1.13.1",
46-
"ember-cli-test-loader": "^3.1.0"
46+
"ember-cli-test-loader": "^3.1.0",
47+
"qunit-theme-ember": "^1.0.0"
4748
},
4849
"devDependencies": {
4950
"@babel/core": "^7.23.2",

addon/src/index.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
/* globals Testem */
2-
import 'qunit/qunit/qunit.css';
3-
42
import { macroCondition, getOwnConfig, importSync } from '@embroider/macros';
53

4+
/**
5+
* Load qunit-default theme by default, if no custom theme is specified.
6+
*/
7+
if (
8+
macroCondition(
9+
getOwnConfig()?.theme === undefined ||
10+
getOwnConfig()?.theme === 'qunit-default' ||
11+
getOwnConfig()?.theme === 'ember'
12+
)
13+
) {
14+
importSync('qunit/qunit/qunit.css');
15+
}
16+
617
if (macroCondition(!getOwnConfig()?.disableContainerStyles)) {
718
importSync('./test-container-styles.css');
819
}
920

21+
if (macroCondition(getOwnConfig()?.theme === 'ember')) {
22+
importSync('qunit-theme-ember/qunit.css');
23+
}
24+
1025
export { default as QUnitAdapter, nonTestDoneCallback } from './adapter';
1126
export { loadTests } from './test-loader';
1227

pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-buildtime-options-app/ember-cli-build.js

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = function (defaults) {
1111
setConfig: {
1212
'ember-qunit': {
1313
disableContainerStyles: true,
14+
theme: 'qunit-default',
1415
},
1516
},
1617
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { module, test } from 'qunit';
2+
import { assert as debugAssert } from '@ember/debug';
3+
4+
module('theme', function () {
5+
function style(element) {
6+
return window.getComputedStyle(element);
7+
}
8+
9+
test('the qunit-default themes are present when used', async function (assert) {
10+
let qunitHeader = document.getElementById('qunit-header');
11+
12+
debugAssert(`#qunit-header must exist`, qunitHeader);
13+
14+
// Defaults
15+
assert.strictEqual(style(qunitHeader).backgroundColor, 'rgb(13, 51, 73)');
16+
});
17+
});

0 commit comments

Comments
 (0)