mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -06:00
DEV: Load svg icons in dev-environment qunit tests (#24542)
Making the icons available generally in tests is tricky because they're generated dynamically by the rails server. However, if we restrict it to dev-mode (`/tests` in a browser) then it's possible to load them from the running rails server. This is purely a visual thing to make debugging easier - it should not affect test behavior.
This commit is contained in:
parent
46782a9f1c
commit
0253cba9be
@ -42,6 +42,8 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<discourse-assets-icons></discourse-assets-icons>
|
||||
|
||||
{{content-for "body"}} {{content-for "test-body"}}
|
||||
|
||||
<script src="/testem.js" integrity="" data-embroider-ignore></script>
|
||||
|
@ -46,6 +46,7 @@ import { setDefaultOwner } from "discourse-common/lib/get-owner";
|
||||
import { setupS3CDN, setupURL } from "discourse-common/lib/get-url";
|
||||
import { buildResolver } from "discourse-common/resolver";
|
||||
import Application from "../app";
|
||||
import { loadSprites } from "../lib/svg-sprite-loader";
|
||||
|
||||
const Plugin = $.fn.modal;
|
||||
const Modal = Plugin.Constructor;
|
||||
@ -394,6 +395,14 @@ export default function setupTests(config) {
|
||||
setupToolbar();
|
||||
reportMemoryUsageAfterTests();
|
||||
patchFailedAssertion();
|
||||
if (!window.Testem) {
|
||||
// Running in a dev server - svg sprites are available
|
||||
// Using a fake 40-char version hash will redirect to the current one
|
||||
loadSprites(
|
||||
"/svg-sprite/localhost/svg--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js",
|
||||
"fontawesome"
|
||||
);
|
||||
}
|
||||
|
||||
if (!hasPluginJs && !hasThemeJs) {
|
||||
configureRaiseOnDeprecation();
|
||||
|
Loading…
Reference in New Issue
Block a user