Skip to content

Commit 9205dc6

Browse files
committed
chore: Clean up style hash in widget-contract-split-panel.test.tsx
1 parent 7a798ee commit 9205dc6

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

src/app-layout/__tests__/__snapshots__/widget-contract-split-panel.test.tsx.snap

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ Map {
147147
"focus": [Function],
148148
},
149149
},
150-
"onMount": [Function],
151150
"slider": {
152151
"current": null,
153152
},
@@ -330,9 +329,9 @@ Map {
330329
"wrapperElAttributes": {
331330
"className": "awsui_root awsui_root awsui_has-adaptive-widths-default",
332331
"style": {
333-
"--awsui-max-content-width-xgujsu": "",
334-
"--awsui-navigation-width-xgujsu": "280px",
335-
"--awsui-tools-width-xgujsu": "290px",
332+
"--awsui-max-content-width": "",
333+
"--awsui-navigation-width": "280px",
334+
"--awsui-tools-width": "290px",
336335
"minBlockSize": "calc(100vh - 0px)",
337336
},
338337
},
@@ -448,7 +447,6 @@ Map {
448447
"focus": [Function],
449448
},
450449
},
451-
"onMount": [Function],
452450
"slider": {
453451
"current": null,
454452
},
@@ -631,9 +629,9 @@ Map {
631629
"wrapperElAttributes": {
632630
"className": "awsui_root awsui_root awsui_has-adaptive-widths-default",
633631
"style": {
634-
"--awsui-max-content-width-xgujsu": "",
635-
"--awsui-navigation-width-xgujsu": "280px",
636-
"--awsui-tools-width-xgujsu": "290px",
632+
"--awsui-max-content-width": "",
633+
"--awsui-navigation-width": "280px",
634+
"--awsui-tools-width": "290px",
637635
"minBlockSize": "calc(100vh - 0px)",
638636
},
639637
},
@@ -749,7 +747,6 @@ Map {
749747
"focus": [Function],
750748
},
751749
},
752-
"onMount": [Function],
753750
"slider": {
754751
"current": null,
755752
},
@@ -932,9 +929,9 @@ Map {
932929
"wrapperElAttributes": {
933930
"className": "awsui_root awsui_root awsui_has-adaptive-widths-default",
934931
"style": {
935-
"--awsui-max-content-width-xgujsu": "",
936-
"--awsui-navigation-width-xgujsu": "280px",
937-
"--awsui-tools-width-xgujsu": "290px",
932+
"--awsui-max-content-width": "",
933+
"--awsui-navigation-width": "280px",
934+
"--awsui-tools-width": "290px",
938935
"minBlockSize": "calc(100vh - 0px)",
939936
},
940937
},
@@ -1050,7 +1047,6 @@ Map {
10501047
"focus": [Function],
10511048
},
10521049
},
1053-
"onMount": [Function],
10541050
"slider": {
10551051
"current": null,
10561052
},
@@ -1233,9 +1229,9 @@ Map {
12331229
"wrapperElAttributes": {
12341230
"className": "awsui_root awsui_root awsui_has-adaptive-widths-default",
12351231
"style": {
1236-
"--awsui-max-content-width-xgujsu": "",
1237-
"--awsui-navigation-width-xgujsu": "280px",
1238-
"--awsui-tools-width-xgujsu": "290px",
1232+
"--awsui-max-content-width": "",
1233+
"--awsui-navigation-width": "280px",
1234+
"--awsui-tools-width": "290px",
12391235
"minBlockSize": "calc(100vh - 0px)",
12401236
},
12411237
},

src/app-layout/__tests__/widget-contract-split-panel.test.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ function skipHashInClassnames(classNames: string): string {
2222
.join(' ');
2323
}
2424

25+
// --awsui-max-content-width-kcc2gu becomes --awsui-max-content-width
26+
function skipHashInGLobalStyle(style: string): string {
27+
if (!style.startsWith('--awsui')) {
28+
return style;
29+
}
30+
31+
const parts = style.split('-');
32+
parts.pop();
33+
return parts.join('-');
34+
}
35+
2536
function sanitizeProps(props: any): any {
2637
if (!isObject(props)) {
2738
return props;
@@ -37,6 +48,12 @@ function sanitizeProps(props: any): any {
3748
return {
3849
...props,
3950
className: skipHashInClassnames(props.className),
51+
...(props.style && {
52+
style: Object.keys(props.style).reduce(
53+
(acc, key) => ({ ...acc, [skipHashInGLobalStyle(key)]: props.style[key] }),
54+
{}
55+
),
56+
}),
4057
};
4158
}
4259
return Object.fromEntries(

0 commit comments

Comments
 (0)