FIX: Defer scripts on theme-tests route (#17171)

Small follow-up to #17063. That PR broke the theme tests route locally.

This PR fixes that.
This commit is contained in:
Joe 2022-06-21 12:44:31 +08:00 committed by GitHub
parent dba60ffa5f
commit 03ffb0bf27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,9 @@
document.write(
"<style>#ember-testing-container { position: fixed; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; transform: translateZ(0)} #ember-testing { width: 200%; height: 200%; transform: scale(0.5); transform-origin: top left; }</style>"
document.body.insertAdjacentHTML(
"afterbegin",
`
<style>#ember-testing-container { position: fixed; background: white; bottom: 0; right: 0; width: 640px; height: 384px; overflow: auto; z-index: 9999; border: 1px solid #ccc; transform: translateZ(0)} #ember-testing { width: 200%; height: 200%; transform: scale(0.5); transform-origin: top left; }</style>
`
);
require('discourse/tests/test-boot-ember-cli');

View File

@ -10,6 +10,6 @@ module QunitHelper
"#{Discourse.base_path}" \
"/theme-javascripts/tests/#{theme.id}-#{digest}.js" \
"?__ws=#{Discourse.current_hostname}"
"<script src='#{src}'></script>".html_safe
"<script defer src='#{src}'></script>".html_safe
end
end

View File

@ -30,7 +30,7 @@
</style>
<%- end %>
<%- if params['testem'] %>
<script src="/assets/testem.js"></script>
<script defer src="/assets/testem.js"></script>
<%- end %>
</head>
<body>