FIX: When using Ember CLI, plugin admin code was not being loaded in tests (#16239)

This commit is contained in:
Robin Ward 2022-03-21 15:46:41 -04:00 committed by GitHub
parent 581d435d09
commit d025405130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,4 @@
<%
require_asset("main_include_admin.js")
DiscoursePluginRegistry.admin_javascripts.each { |js| require_asset(js) }
DiscoursePluginRegistry.each_globbed_asset(admin: true) do |f|

View File

@ -0,0 +1,2 @@
//= require main_include_admin
//= require admin-plugins

View File

@ -301,7 +301,10 @@ module.exports = {
contentFor: function (type, config) {
if (shouldLoadPluginTestJs() && type === "test-plugin-js") {
return `<script src="${config.rootURL}assets/discourse/tests/active-plugins.js"></script>`;
return `
<script src="${config.rootURL}assets/discourse/tests/active-plugins.js"></script>
<script src="${config.rootURL}assets/admin-plugins.js"></script>
`;
} else if (shouldLoadPluginTestJs() && type === "test-plugin-tests-js") {
return `<script id="plugin-test-script" src="${config.rootURL}assets/discourse/tests/plugin-tests.js"></script>`;
}

View File

@ -59,6 +59,9 @@ if (shouldLoadPluginTestJs()) {
"/assets/discourse/tests/active-plugins.js": {
target,
},
"/assets/admin-plugins.js": {
target,
},
"/assets/discourse/tests/plugin-tests.js": {
target,
},

View File

@ -50,8 +50,8 @@
<script src="{{rootURL}}assets/test-support.js"></script>
<script src="{{rootURL}}assets/discourse.js"></script>
<script src="{{rootURL}}assets/discourse-markdown.js"></script>
{{content-for "test-plugin-js"}}
<script src="{{rootURL}}assets/admin.js"></script>
{{content-for "test-plugin-js"}}
<script src="{{rootURL}}assets/test-helpers.js"></script>
<script src="{{rootURL}}assets/core-tests.js"></script>
{{content-for "test-plugin-tests-js"}}

View File

@ -11,6 +11,7 @@
<%= preload_script @app_bundle %>
<%= preload_script "admin" %>
<%= preload_script "discourse/tests/active-plugins" %>
<%= preload_script "admin-plugins" %>
<%= support_bundles %>
<%= theme_translations_lookup %>
<%= theme_js_lookup %>

View File

@ -177,6 +177,7 @@ module Discourse
onpopstate-handler.js
embed-application.js
discourse/tests/active-plugins.js
admin-plugins.js
discourse/tests/test_starter.js
}