1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
/* eslint-env browser */
import {
compile,
getCompiler,
getEntryByInjectType,
getErrors,
getWarnings,
runInJsDom,
} from "./helpers/index";
describe('"injectType" option', () => {
const injectTypes = [
"styleTag",
"singletonStyleTag",
"autoStyleTag",
"lazyStyleTag",
"lazyAutoStyleTag",
"lazySingletonStyleTag",
"linkTag",
];
injectTypes.forEach((injectType) => {
it(`should work when the "injectType" option is "${injectType}"`, async () => {
expect.assertions(3);
const entry = getEntryByInjectType("simple.js", injectType);
const compiler = getCompiler(entry, { injectType });
const stats = await compile(compiler);
runInJsDom("main.bundle.js", compiler, stats, (dom) => {
expect(dom.serialize()).toMatchSnapshot("DOM");
});
expect(getWarnings(stats)).toMatchSnapshot("warnings");
expect(getErrors(stats)).toMatchSnapshot("errors");
});
});
});
|