diff --git a/app/assets/javascripts/discourse/ember-cli-build.js b/app/assets/javascripts/discourse/ember-cli-build.js index dea7c1accef..52f8a05a018 100644 --- a/app/assets/javascripts/discourse/ember-cli-build.js +++ b/app/assets/javascripts/discourse/ember-cli-build.js @@ -138,7 +138,11 @@ module.exports = function (defaults) { return mergeTrees([ tests, testHelpers, - discourseScss(`${discourseRoot}/app/assets/stylesheets`, "testem.scss"), + discourseScss(`${discourseRoot}/app/assets/stylesheets`, "qunit.scss"), + discourseScss( + `${discourseRoot}/app/assets/stylesheets`, + "qunit-custom.scss" + ), ]); } else { return mergeTrees([tests, testHelpers]); diff --git a/app/assets/javascripts/discourse/lib/discourse-scss.js b/app/assets/javascripts/discourse/lib/discourse-scss.js index 41167ed7344..f22a54882a4 100644 --- a/app/assets/javascripts/discourse/lib/discourse-scss.js +++ b/app/assets/javascripts/discourse/lib/discourse-scss.js @@ -3,7 +3,7 @@ const sass = require("sass"); const fs = require("fs"); const concat = require("broccoli-concat"); -let built = false; +let builtSet = new Set(); class DiscourseScss extends Plugin { constructor(inputNodes, inputFile, options) { @@ -16,14 +16,14 @@ class DiscourseScss extends Plugin { } build() { + let file = this.inputPaths[0] + "/" + this.inputFile; + // We could get fancy eventually and do this based on whether the css changes // but this is just used for tests right now. - if (built) { + if (builtSet.has(file)) { return; } - let file = this.inputPaths[0] + "/" + this.inputFile; - let deprecationCount = 0; let result = sass.renderSync({ file, @@ -51,7 +51,8 @@ class DiscourseScss extends Plugin { `${this.outputPath}/` + this.inputFile.replace(".scss", ".css"), result.css ); - built = true; + + builtSet.add(file); } } diff --git a/app/assets/javascripts/discourse/public/assets/scripts/discourse-test-listen-boot.js b/app/assets/javascripts/discourse/public/assets/scripts/discourse-test-listen-boot.js index bc903572c7b..65f629d8a02 100644 --- a/app/assets/javascripts/discourse/public/assets/scripts/discourse-test-listen-boot.js +++ b/app/assets/javascripts/discourse/public/assets/scripts/discourse-test-listen-boot.js @@ -1,30 +1 @@ -document.body.insertAdjacentHTML( - "afterbegin", - ` - - ` -); - require("discourse/tests/test-boot-ember-cli"); diff --git a/app/assets/javascripts/discourse/tests/index.html b/app/assets/javascripts/discourse/tests/index.html index d1276bb7c8f..4b5676eca48 100644 --- a/app/assets/javascripts/discourse/tests/index.html +++ b/app/assets/javascripts/discourse/tests/index.html @@ -8,12 +8,14 @@ + {{content-for "head"}} {{content-for "test-head"}} - + + {{content-for "head-footer"}} {{content-for "test-head-footer"}} @@ -24,9 +26,6 @@ -o-transition: none !important; transition: none !important; } - #ember-testing { - background-color: white; - } #qunit-fixture { position: absolute; top: -10000px; diff --git a/app/assets/stylesheets/qunit-custom.scss b/app/assets/stylesheets/qunit-custom.scss new file mode 100644 index 00000000000..caf66a12abe --- /dev/null +++ b/app/assets/stylesheets/qunit-custom.scss @@ -0,0 +1,139 @@ +#ember-testing-container { + position: fixed; + background: #fff; + bottom: 0; + right: 0; + width: 640px; + height: 384px; + overflow: auto; + z-index: 9999; + border: 1px solid #ccc; + transform: translateZ(0); + box-sizing: border-box; + max-height: 100vh; +} + +#ember-testing { + background-color: #fff; +} + +.discourse-root { + background: var(--secondary); +} + +#ember-testing { + width: 200%; + height: 200%; + transform: scale(0.5); + transform-origin: top left; +} + +@media (prefers-color-scheme: dark) { + html { + background-color: #222; + } + + #qunit-banner.qunit-pass { + background-color: #92b01e; + } + + #qunit-banner.qunit-fail { + background-color: #7e2121; + } + + #qunit-testrunner-toolbar { + background: #1b1b1b; + color: #90ac2d; + } + + #qunit-testrunner-toolbar button { + background-color: #222; + border-color: #444; + color: #f8f8f8; + } + + #qunit-filter-input, + #qunit-urlconfig-qunit_single_plugin { + background-color: var(--primary); + border: 1px solid var(--secondary-medium); + color: var(--secondary); + } + + #qunit-filteredTest { + background-color: #90ac2d; + color: #366097; + } + + #qunit-testresult { + background-color: #366097; + border-color: #000; + color: #e2f0f7; + } + + #qunit-testresult a { + color: #7eb0f2; + } + + #qunit-tests b.counts { + color: #ddd; + } + + #qunit-tests b.failed { + color: #ff7777; + } + + #qunit-tests b.passed { + color: #90ac2d; + } + + #qunit-tests .pass { + background-color: #0c3f59; + border-color: #000; + color: #edeff5; + } + + #qunit-tests .pass .test-name { + color: #7eb0f2; + } + + #qunit-tests .fail { + background-color: #7e2121; + color: #ddd; + } + + ol.qunit-assert-list > li > table > tbody, + tr.test-expected, + tr.test-actual, + tr.test-source { + border-color: #333; + } + + #qunit-tests li { + border-color: #333; + } + + #qunit-tests li li.pass { + background-color: #222; + border-color: #92b01e; + color: #90ac2d; + } + + #qunit-tests li li.fail { + background-color: #222; + border-color: #7e2121; + color: #ff7777; + } + + .qunit-assert-list { + background-color: #222; + } + + #ember-testing-container { + background-color: #000; + border-color: #444; + } + + #ember-testing { + background: #000; + } +} diff --git a/app/assets/stylesheets/qunit.scss b/app/assets/stylesheets/qunit.scss new file mode 100644 index 00000000000..9f036b8922b --- /dev/null +++ b/app/assets/stylesheets/qunit.scss @@ -0,0 +1,12 @@ +// Styles for Ember CLI test environment + +:root { + --font-family: "Arial"; +} + +@import "common/foundation/colors"; +@import "common/foundation/variables"; +@import "common/foundation/mixins"; +@import "desktop"; +@import "color_definitions"; +@import "admin"; diff --git a/app/assets/stylesheets/testem.scss b/app/assets/stylesheets/testem.scss deleted file mode 100644 index a1e4c5dad37..00000000000 --- a/app/assets/stylesheets/testem.scss +++ /dev/null @@ -1,27 +0,0 @@ -// styles for Ember CLI testem environment - -:root { - --font-family: "Arial"; -} - -$primary: #222222 !default; -$secondary: #ffffff !default; -$tertiary: #0088cc !default; -$quaternary: #e45735 !default; -$header_background: #ffffff !default; -$header_primary: #333333 !default; -$highlight: #ffff4d !default; -$danger: #e45735 !default; -$success: #009900 !default; -$love: #fa6c8d !default; - -@import "common/foundation/variables"; -@import "common/foundation/mixins"; -@import "desktop"; -@import "color_definitions"; -@import "admin"; - -#ember-testing-container { - box-sizing: border-box; - max-height: 100vh; -} diff --git a/app/views/qunit/theme.html.erb b/app/views/qunit/theme.html.erb index 84397a564aa..99560c118c4 100644 --- a/app/views/qunit/theme.html.erb +++ b/app/views/qunit/theme.html.erb @@ -3,6 +3,8 @@ Theme QUnit Test Runner <%= discourse_color_scheme_stylesheets %> + + <%- if !@suggested_themes %> <%= preload_script "locales/#{I18n.locale}" %> <%= preload_script "vendor" %> @@ -24,10 +26,12 @@ - <%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %> + + <%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %> + <%= discourse_stylesheet_link_tag("qunit-custom", theme_id: nil) %> <%- else %>