Skip to content

Commit 00c04e8

Browse files
fix(css-helper): add test for getStyle with missing wildcard and fix formatting
1 parent f120b36 commit 00c04e8

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

packages/tests/__fixtures__/curriculum-helper-css.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ a {
3737
}
3838
}`;
3939

40+
export const cssWithoutWildcard: string = `
41+
.box {
42+
width: 100px;
43+
height: 100px;
44+
}
45+
`;
46+
4047
export const cssString = `:root {
4148
--building-color1: #aa80ff;
4249
--building-color2: #66cc99;
@@ -47,7 +54,7 @@ export const cssString = `:root {
4754
--window-color3: #d98cb3;
4855
--window-color4: #8cb3d9;
4956
}
50-
57+
5158
* {
5259
box-sizing: border-box;
5360
}

packages/tests/css-helper.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
// @vitest-environment jsdom
2-
import { cssString } from "./__fixtures__/curriculum-helper-css";
2+
import {
3+
cssString,
4+
cssWithoutWildcard,
5+
} from "./__fixtures__/curriculum-helper-css";
36
import { CSSHelp } from "./../helpers/lib/index";
47

8+
describe("getStyle with no wildcard in css", () => {
9+
it("should return null when wildcard selector is not present in css", () => {
10+
const style = document.createElement("style");
11+
style.textContent = String(cssWithoutWildcard);
12+
document.head.appendChild(style);
13+
14+
const helper = new CSSHelp(document);
15+
16+
expect(helper.getStyle("*")).toBeNull();
17+
});
18+
});
19+
520
describe("css-help", () => {
621
const doc = document;
722
let t: CSSHelp;

0 commit comments

Comments
 (0)