webpack/test/configCases/css/basic/index.js

15 lines
499 B
JavaScript
Raw Normal View History

2021-12-01 16:50:13 +08:00
import * as style from "./style.css";
it("should compile and load style on demand", done => {
expect(style).toEqual({});
2021-12-01 16:50:13 +08:00
import("./style2.css").then(x => {
expect(x).toEqual({});
2021-12-01 16:50:13 +08:00
const style = getComputedStyle(document.body);
expect(style.getPropertyValue("background")).toBe(" red");
2021-12-01 20:27:00 +08:00
expect(style.getPropertyValue("margin")).toBe(" 10px");
2021-12-01 16:50:13 +08:00
expect(style.getPropertyValue("color")).toBe(" green");
2021-12-01 20:27:00 +08:00
expect(style.getPropertyValue("padding")).toBe(" 20px 10px");
2021-12-01 16:50:13 +08:00
done();
}, done);
});