2023-05-02 19:36:46 +08:00
|
|
|
import * as style from "./style.css";
|
|
|
|
|
|
|
|
|
|
it("should compile and load style on demand", done => {
|
2025-04-06 20:53:42 +08:00
|
|
|
expect(style).toEqual({});
|
2023-05-02 19:36:46 +08:00
|
|
|
import("./style2.css").then(x => {
|
2025-04-06 20:53:42 +08:00
|
|
|
expect(x).toEqual({});
|
2023-05-02 19:36:46 +08:00
|
|
|
const style = getComputedStyle(document.body);
|
|
|
|
|
expect(style.getPropertyValue("background")).toBe(" red");
|
|
|
|
|
expect(style.getPropertyValue("margin")).toBe(" 10px");
|
|
|
|
|
expect(style.getPropertyValue("color")).toBe(" green");
|
|
|
|
|
expect(style.getPropertyValue("padding")).toBe(" 20px 10px");
|
|
|
|
|
done();
|
|
|
|
|
}, done);
|
|
|
|
|
});
|