Skip to content

Commit

Permalink
Merge branch 'main' into rm-pause-workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli authored Sep 14, 2024
2 parents 09254e8 + dafee6b commit 406fb96
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 4 deletions.
9 changes: 9 additions & 0 deletions addon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions addon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: '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: 'qunit-default',
},
},
},
Expand Down
5 changes: 3 additions & 2 deletions addon/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
Expand Down
19 changes: 17 additions & 2 deletions addon/src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
/* globals Testem */
import 'qunit/qunit/qunit.css';

import { macroCondition, getOwnConfig, importSync } from '@embroider/macros';

/**
* Load qunit-default theme 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');
}

if (macroCondition(getOwnConfig()?.theme === 'ember')) {
importSync('qunit-theme-ember/qunit.css');
}

export { default as QUnitAdapter, nonTestDoneCallback } from './adapter';
export { loadTests } from './test-loader';

Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test-buildtime-options-app/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = function (defaults) {
setConfig: {
'ember-qunit': {
disableContainerStyles: true,
theme: 'qunit-default',
},
},
},
Expand Down
17 changes: 17 additions & 0 deletions test-buildtime-options-app/tests/unit/theme-test.js
Original file line number Diff line number Diff line change
@@ -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)');
});
});

0 comments on commit 406fb96

Please sign in to comment.