@workday/canvas-kit-docs 12.4.12 → 12.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mdx/TESTING.mdx +25 -0
- package/package.json +6 -6
package/dist/mdx/TESTING.mdx
CHANGED
|
@@ -160,6 +160,31 @@ This will ensure snapshot tests have stable ids for each snapshot. It is still p
|
|
|
160
160
|
changing if you add an additional component that uses id generation - subsequent ids will be
|
|
161
161
|
different, but this will prevent snapshot tests that don't have any changes from showing diffs.
|
|
162
162
|
|
|
163
|
+
The Canvas Kit Styling package uses CSS Variables and multiple class names with unique hashes.
|
|
164
|
+
The following snapshot serializers handle styling. Setting unique seeds will not effect static style
|
|
165
|
+
hashes because the styles are created before any test code is run. These serializers ignore the
|
|
166
|
+
hashes instead.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
// Handle `css-{hash}` class names
|
|
170
|
+
const emotionClassnameRegex = /(css-[a-zA-Z0-9]{1,7})/g;
|
|
171
|
+
expect.addSnapshotSerializer({
|
|
172
|
+
test: (val) => typeof val === "string" && emotionClassnameRegex.test(val),
|
|
173
|
+
print: (val) => {
|
|
174
|
+
return `"${val.replaceAll(emotionClassnameRegex, "css-xxxxx")}"`;
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Handle `--myVariableName-{hash}` CSS variables used by Stencils
|
|
179
|
+
const cssVariableRegex = /(--([a-zA-Z-]+)-[a-zA-Z0-9]{1,7})/g;
|
|
180
|
+
expect.addSnapshotSerializer({
|
|
181
|
+
test: (val) => typeof val === "string" && cssVariableRegex.test(val),
|
|
182
|
+
print: (val) => {
|
|
183
|
+
return `"${val.replaceAll(cssVariableRegex, "--$2-xxxxx")}"`;
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
163
188
|
## Functional tests
|
|
164
189
|
|
|
165
190
|
Canvas Kit uses [Cypress](https://cypress.io) for browser-based behavior testing (additional info:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "12.4.
|
|
3
|
+
"version": "12.4.13",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^12.4.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^12.4.
|
|
49
|
-
"@workday/canvas-kit-react": "^12.4.
|
|
50
|
-
"@workday/canvas-kit-styling": "^12.4.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^12.4.13",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^12.4.13",
|
|
49
|
+
"@workday/canvas-kit-react": "^12.4.13",
|
|
50
|
+
"@workday/canvas-kit-styling": "^12.4.13",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
52
|
"@workday/canvas-tokens-web": "^2.1.1",
|
|
53
53
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"mkdirp": "^1.0.3",
|
|
61
61
|
"typescript": "5.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "99d1efa4856ed23c7d238b277996adb35d914a70"
|
|
64
64
|
}
|