2018-10-01 10:06:01 +08:00
|
|
|
import loadScript from "discourse/lib/load-script";
|
|
|
|
|
|
|
|
QUnit.module("lib:load-script");
|
|
|
|
|
2019-06-27 16:57:40 +08:00
|
|
|
QUnit.skip(
|
2018-10-01 10:06:01 +08:00
|
|
|
"load with a script tag, and callbacks are only executed after script is loaded",
|
|
|
|
async assert => {
|
2019-06-27 16:19:55 +08:00
|
|
|
assert.ok(
|
|
|
|
typeof window.ace === "undefined",
|
|
|
|
"ensures ace is not previously loaded"
|
|
|
|
);
|
|
|
|
|
2018-10-01 10:06:01 +08:00
|
|
|
const src = "/javascripts/ace/ace.js";
|
|
|
|
|
2020-03-03 04:20:19 +08:00
|
|
|
await loadScript(src);
|
|
|
|
assert.ok(
|
|
|
|
typeof window.ace !== "undefined",
|
|
|
|
"callbacks should only be executed after the script has fully loaded"
|
|
|
|
);
|
2018-10-01 10:06:01 +08:00
|
|
|
}
|
|
|
|
);
|