Skip to content

Commit 3e3e3ef

Browse files
committed
test(css): add flex utils for existing classes
1 parent b34d74e commit 3e3e3ef

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
9292
"start": "npm run build.css && stencil build --dev --watch --serve",
9393
"test": "npm run test.css && npm run test.spec && npm run test.e2e",
94-
"test.css": "node src/css/test/display.test.mjs",
94+
"test.css": "sh -c 'for f in src/css/test/*.mjs; do node \"$f\"; done'",
9595
"test.spec": "stencil test --spec --max-workers=2",
9696
"test.e2e": "npx playwright test",
9797
"test.e2e.update-snapshots": "npm run test.e2e -- --update-snapshots='changed'",

core/src/css/test/flex-utils.test.mjs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import assert from 'assert';
2+
import fs from 'fs';
3+
import path from 'path';
4+
5+
const css = fs.readFileSync(
6+
path.resolve(path.dirname(new URL(import.meta.url).pathname), '../../../css/flex-utils.css'),
7+
'utf8'
8+
);
9+
10+
// Align Self
11+
// ------------------------------------------------------------
12+
13+
const ALIGN_SELF_VALUES = [
14+
'start',
15+
'end',
16+
'center',
17+
'stretch',
18+
'baseline',
19+
'auto'
20+
];
21+
22+
for (const value of ALIGN_SELF_VALUES) {
23+
assert(
24+
css.includes(`.ion-align-self-${value}`),
25+
`CSS should include .ion-align-self-${value} class`
26+
);
27+
}
28+
29+
// Flex Wrap
30+
// ------------------------------------------------------------
31+
32+
const FLEX_WRAP_VALUES = [
33+
'wrap',
34+
'nowrap',
35+
'wrap-reverse'
36+
];
37+
38+
for (const value of FLEX_WRAP_VALUES) {
39+
assert(
40+
css.includes(`.ion-${value}`),
41+
`CSS should include .ion-${value} class`
42+
);
43+
}
44+
45+
// Justify Content
46+
// ------------------------------------------------------------
47+
48+
const JUSTIFY_CONTENT_VALUES = [
49+
'start',
50+
'center',
51+
'end',
52+
'around',
53+
'between',
54+
'evenly'
55+
];
56+
57+
for (const value of JUSTIFY_CONTENT_VALUES) {
58+
assert(
59+
css.includes(`.ion-justify-content-${value}`),
60+
`CSS should include .ion-justify-content-${value} class`
61+
);
62+
}
63+
64+
// Align Items
65+
// ------------------------------------------------------------
66+
67+
const ALIGN_ITEMS_VALUES = [
68+
'start',
69+
'center',
70+
'end',
71+
'stretch',
72+
'baseline'
73+
];
74+
75+
for (const value of ALIGN_ITEMS_VALUES) {
76+
assert(
77+
css.includes(`.ion-align-items-${value}`),
78+
`CSS should include .ion-align-items-${value} class`
79+
);
80+
}
81+
82+
console.log("All flex-utils.css tests pass.");

0 commit comments

Comments
 (0)