@transferwise/components 46.115.1 → 46.116.1
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/build/alert/Alert.js +2 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +2 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +1 -0
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -0
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/main.css +428 -44
- package/build/mocks.js +7 -0
- package/build/mocks.js.map +1 -1
- package/build/mocks.mjs +7 -1
- package/build/mocks.mjs.map +1 -1
- package/build/sentimentSurface/SentimentSurface.js +43 -0
- package/build/sentimentSurface/SentimentSurface.js.map +1 -0
- package/build/sentimentSurface/SentimentSurface.mjs +39 -0
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -0
- package/build/sentimentSurface/classMap.js +17 -0
- package/build/sentimentSurface/classMap.js.map +1 -0
- package/build/sentimentSurface/classMap.mjs +14 -0
- package/build/sentimentSurface/classMap.mjs.map +1 -0
- package/build/statusIcon/StatusIcon.js +10 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +10 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/inputs/Input.css +2 -4
- package/build/styles/inputs/TextArea.css +2 -4
- package/build/styles/main.css +428 -44
- package/build/styles/popover/Popover.css +2 -4
- package/build/styles/sentimentSurface/SentimentSurface.css +420 -0
- package/build/styles/statusIcon/StatusIcon.css +4 -36
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts +2 -1
- package/build/types/criticalBanner/CriticalCommsBanner.d.ts.map +1 -1
- package/build/types/mocks.d.ts +1 -0
- package/build/types/mocks.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts +30 -0
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -0
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts +80 -0
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -0
- package/build/types/sentimentSurface/classMap.d.ts +4 -0
- package/build/types/sentimentSurface/classMap.d.ts.map +1 -0
- package/build/types/sentimentSurface/index.d.ts +3 -0
- package/build/types/sentimentSurface/index.d.ts.map +1 -0
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/test-utils/window-mock.d.ts +1 -0
- package/build/types/test-utils/window-mock.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/alert/Alert.tsx +3 -1
- package/src/criticalBanner/CriticalCommsBanner.tsx +3 -2
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.spec.tsx +229 -0
- package/src/expressiveMoneyInput/amountInput/AmountInput.spec.tsx +282 -0
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.spec.tsx +160 -0
- package/src/inputs/Input.css +2 -4
- package/src/inputs/SelectInput.spec.tsx +7 -1
- package/src/inputs/TextArea.css +2 -4
- package/src/main.css +428 -44
- package/src/main.less +2 -0
- package/src/mocks.ts +7 -0
- package/src/moneyInput/MoneyInput.spec.tsx +9 -1
- package/src/popover/Popover.css +2 -4
- package/src/provider/theme/ThemeProvider.story.tsx +78 -11
- package/src/sentimentSurface/SentimentSurface.css +420 -0
- package/src/sentimentSurface/SentimentSurface.docs.mdx +549 -0
- package/src/sentimentSurface/SentimentSurface.less +293 -0
- package/src/sentimentSurface/SentimentSurface.spec.tsx +140 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +303 -0
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +72 -0
- package/src/sentimentSurface/SentimentSurface.tsx +72 -0
- package/src/sentimentSurface/SentimentSurface.types.ts +104 -0
- package/src/sentimentSurface/classMap.ts +15 -0
- package/src/sentimentSurface/index.ts +8 -0
- package/src/statusIcon/StatusIcon.css +4 -36
- package/src/statusIcon/StatusIcon.less +3 -41
- package/src/statusIcon/StatusIcon.tsx +14 -1
- package/src/test-utils/jest.setup.ts +0 -5
- package/src/test-utils/window-mock.ts +5 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
.wds-sentiment-surface {
|
|
2
|
+
&-negative {
|
|
3
|
+
.np-theme-personal &,
|
|
4
|
+
.np-theme-personal--bright-green & {
|
|
5
|
+
&-base {
|
|
6
|
+
.sentiment-surface-tokens(
|
|
7
|
+
#CB272F, #B8232B, #A72027,
|
|
8
|
+
#CB272F, #B8232B, #A72027,
|
|
9
|
+
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
10
|
+
#F5D3D4, #F0BDBE, #ECACAD,
|
|
11
|
+
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
12
|
+
#FBEAEA, #F9E1E1, #F8D8D8
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
&-elevated {
|
|
16
|
+
.sentiment-surface-tokens(
|
|
17
|
+
#FFFFFF, #F5CCCC, #F1B7B7,
|
|
18
|
+
#FBEAEA, #F5CCCC, #F1B7B7,
|
|
19
|
+
#CB272F, #B8232B, #A72027,
|
|
20
|
+
#9B141B, #831116, #6D0E13,
|
|
21
|
+
#CB272F, #B8232B, #A72027,
|
|
22
|
+
#90000D, #B8232B, #A72027
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.np-theme-personal--dark &,
|
|
28
|
+
.np-theme-personal--forest-green & {
|
|
29
|
+
&-base {
|
|
30
|
+
.sentiment-surface-tokens(
|
|
31
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
32
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
33
|
+
#410B0D, #641115, #761418,
|
|
34
|
+
#601013, #7A1519, #90181D,
|
|
35
|
+
#410B0D, #641115, #761418,
|
|
36
|
+
#410B0D, #641115, #761418
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
&-elevated {
|
|
40
|
+
.sentiment-surface-tokens(
|
|
41
|
+
#410B0D, #641115, #761418,
|
|
42
|
+
#410B0D, #641115, #761418,
|
|
43
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
44
|
+
#D9898D, #D68084, #D06C71,
|
|
45
|
+
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
46
|
+
#FFA8AD, #FFBDC0, #FFD1D3
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&-warning {
|
|
53
|
+
.np-theme-personal &,
|
|
54
|
+
.np-theme-personal--bright-green & {
|
|
55
|
+
&-base {
|
|
56
|
+
.sentiment-surface-tokens(
|
|
57
|
+
#4A3B1C, #302612, #2C2311, // content-primary (default, hover, active)
|
|
58
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-primary
|
|
59
|
+
#FFF7D7, #FFF0B2, #FFE98F, // interactive-secondary
|
|
60
|
+
#FFEC9E, #FFE187, #FFD55F, // interactive-secondary-neutral
|
|
61
|
+
#4A3B1C, #302612, #2C2311, // interactive-control
|
|
62
|
+
#FFF7D7, #FFF0B2, #FFE98F // background-surface
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
&-elevated {
|
|
66
|
+
.sentiment-surface-tokens(
|
|
67
|
+
#4A3B1C, #302612, #2C2311, // content-primary
|
|
68
|
+
#4A3B1C, #302612, #2C2311, // interactive-primary
|
|
69
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-secondary
|
|
70
|
+
#FFEC9E, #FFEDB8, #FFF2CC, // interactive-secondary-neutral
|
|
71
|
+
#FFD11A, #FFBF0F, #FFBB00, // interactive-control
|
|
72
|
+
#FFD11A, #FFBF0F, #FFBB00 // background-surface
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.np-theme-personal--dark &,
|
|
78
|
+
.np-theme-personal--forest-green & {
|
|
79
|
+
&-base {
|
|
80
|
+
.sentiment-surface-tokens(
|
|
81
|
+
#FADC65, #F9D648, #F8CD20, // content-primary
|
|
82
|
+
#FADC65, #F9D648, #F8CD20, // interactive-primary
|
|
83
|
+
#3A3523, #504930, #665D3D, // interactive-secondary
|
|
84
|
+
#4D462A, #5D532F, #685D33, // interactive-secondary-neutral
|
|
85
|
+
#3A3523, #504930, #665D3D, // interactive-control
|
|
86
|
+
#3A3523, #504930, #665D3D // background-surface
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
&-elevated {
|
|
90
|
+
.sentiment-surface-tokens(
|
|
91
|
+
#3A3523, #504930, #665D3D, // content-primary
|
|
92
|
+
#3A3523, #504930, #665D3D, // interactive-primary
|
|
93
|
+
#FADC65, #F9D648, #F8CD20, // interactive-secondary
|
|
94
|
+
#E3C85D, #DFC044, #D9B526, // interactive-secondary-neutral
|
|
95
|
+
#FADC65, #F9D648, #F8CD20, // interactive-control
|
|
96
|
+
#FADC65, #F9D648, #F8CD20 // background-surface
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
&-success {
|
|
102
|
+
.np-theme-personal &,
|
|
103
|
+
.np-theme-personal--bright-green & {
|
|
104
|
+
&-base {
|
|
105
|
+
.sentiment-surface-tokens(
|
|
106
|
+
#054D28, #043A1E, #022614, // content-primary (default, hover, active)
|
|
107
|
+
#054D28, #043A1E, #022614, // interactive-primary
|
|
108
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-secondary
|
|
109
|
+
#BCD9B8, #AACFA5, #94C38E, // interactive-secondary-neutral
|
|
110
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-control
|
|
111
|
+
#E2F6D5, #D3F2C0, #C5EDAB // background-surface
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
&-elevated {
|
|
115
|
+
.sentiment-surface-tokens(
|
|
116
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // content-primary
|
|
117
|
+
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-primary
|
|
118
|
+
#054D28, #043A1E, #022614, // interactive-secondary
|
|
119
|
+
#256A43, #2A794C, #329057, // interactive-secondary-neutral
|
|
120
|
+
#054D28, #043A1E, #022614, // interactive-control
|
|
121
|
+
#054D28, #043A1E, #022614 // background-surface
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.np-theme-personal--dark &,
|
|
127
|
+
.np-theme-personal--forest-green & {
|
|
128
|
+
&-base {
|
|
129
|
+
.sentiment-surface-tokens(
|
|
130
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // content-primary
|
|
131
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-primary
|
|
132
|
+
#252C20, #323B2B, #3E4A36, // interactive-secondary
|
|
133
|
+
#37422F, #46533B, #546548, // interactive-secondary-neutral
|
|
134
|
+
#252C20, #323B2B, #3E4A36, // interactive-control
|
|
135
|
+
#252C20, #323B2B, #3E4A36 // background-surface
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
&-elevated {
|
|
139
|
+
.sentiment-surface-tokens(
|
|
140
|
+
#252C20, #323B2B, #3E4A36, // content-primary
|
|
141
|
+
#252C20, #323B2B, #3E4A36, // interactive-primary
|
|
142
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-secondary
|
|
143
|
+
#A8CF91, #94C478, #83BB63, // interactive-secondary-neutral
|
|
144
|
+
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-control
|
|
145
|
+
#BAE5A0, #C8EAB3, #D6F0C7 // background-surface
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
&-neutral {
|
|
151
|
+
.np-theme-personal &,
|
|
152
|
+
.np-theme-personal--bright-green & {
|
|
153
|
+
&-base {
|
|
154
|
+
.sentiment-surface-tokens(
|
|
155
|
+
#454745, #353635, #232423, // content-primary (default, hover, active)
|
|
156
|
+
#454745, #353635, #232423, // interactive-primary
|
|
157
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
158
|
+
#E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
|
|
159
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
160
|
+
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
&-elevated {
|
|
164
|
+
.sentiment-surface-tokens(
|
|
165
|
+
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
166
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
167
|
+
#454745, #353635, #232423, // interactive-secondary
|
|
168
|
+
#5A5C5A, #6D6F6D, #727472, // interactive-secondary-neutral
|
|
169
|
+
#454745, #353635, #232423, // interactive-control
|
|
170
|
+
#454745, #353635, #232423 // background-surface
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.np-theme-personal--dark &,
|
|
176
|
+
.np-theme-personal--forest-green & {
|
|
177
|
+
&-base {
|
|
178
|
+
.sentiment-surface-tokens(
|
|
179
|
+
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
180
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
181
|
+
#2A2C29, #414441, #595B58, // interactive-secondary
|
|
182
|
+
#424441, #4C4E4B, #565955, // interactive-secondary-neutral
|
|
183
|
+
#2A2C29, #414441, #595B58, // interactive-control
|
|
184
|
+
#2A2C29, #414441, #595B58 // background-surface
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
&-elevated {
|
|
188
|
+
.sentiment-surface-tokens(
|
|
189
|
+
#2A2C29, #414441, #595B58, // content-primary
|
|
190
|
+
#2A2C29, #414441, #595B58, // interactive-primary
|
|
191
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
192
|
+
#E4E4DC, #DCDCD2, #D3D2C6, // interactive-secondary-neutral
|
|
193
|
+
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
194
|
+
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
&-proposition {
|
|
200
|
+
.np-theme-personal &,
|
|
201
|
+
.np-theme-personal--bright-green & {
|
|
202
|
+
&-base {
|
|
203
|
+
.sentiment-surface-tokens(
|
|
204
|
+
#0E0F0C, #0A2826, #074140, // content-primary (default, hover, active)
|
|
205
|
+
#054D4D, #043A3A, #022626, // interactive-primary
|
|
206
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
207
|
+
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
208
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
209
|
+
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
&-elevated {
|
|
213
|
+
.sentiment-surface-tokens(
|
|
214
|
+
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
215
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
216
|
+
#054D4D, #043A3A, #022626, // interactive-secondary
|
|
217
|
+
#1F6161, #247070, #298080, // interactive-secondary-neutral
|
|
218
|
+
#054D4D, #043A3A, #022626, // interactive-control
|
|
219
|
+
#054D4D, #043A3A, #022626 // background-surface
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.np-theme-personal--dark &,
|
|
225
|
+
.np-theme-personal--forest-green & {
|
|
226
|
+
&-base {
|
|
227
|
+
.sentiment-surface-tokens(
|
|
228
|
+
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
229
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
230
|
+
#0B312F, #124F4C, #176460, // interactive-secondary
|
|
231
|
+
#174E4D, #1D6261, #237675, // interactive-secondary-neutral
|
|
232
|
+
#0B312F, #124F4C, #176460, // interactive-control
|
|
233
|
+
#0B312F, #124F4C, #176460 // background-surface
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
&-elevated {
|
|
237
|
+
.sentiment-surface-tokens(
|
|
238
|
+
#0E0F0C, #0A2826, #074140, // content-primary
|
|
239
|
+
#0B312F, #104744, #16605C, // interactive-primary
|
|
240
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
241
|
+
#B4D5D5, #A3CCCC, #9AC6C6, // interactive-secondary-neutral
|
|
242
|
+
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
243
|
+
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.sentiment-surface-tokens(
|
|
251
|
+
@content-primary,
|
|
252
|
+
@content-primary-hover,
|
|
253
|
+
@content-primary-active,
|
|
254
|
+
@interactive-primary,
|
|
255
|
+
@interactive-primary-hover,
|
|
256
|
+
@interactive-primary-active,
|
|
257
|
+
@interactive-secondary,
|
|
258
|
+
@interactive-secondary-hover,
|
|
259
|
+
@interactive-secondary-active,
|
|
260
|
+
@interactive-secondary-neutral,
|
|
261
|
+
@interactive-secondary-neutral-hover,
|
|
262
|
+
@interactive-secondary-neutral-active,
|
|
263
|
+
@interactive-control,
|
|
264
|
+
@interactive-control-hover,
|
|
265
|
+
@interactive-control-active,
|
|
266
|
+
@background-surface,
|
|
267
|
+
@background-surface-hover,
|
|
268
|
+
@background-surface-active
|
|
269
|
+
) {
|
|
270
|
+
--color-sentiment-content-primary: @content-primary;
|
|
271
|
+
--color-sentiment-content-primary-hover: @content-primary-hover;
|
|
272
|
+
--color-sentiment-content-primary-active: @content-primary-active;
|
|
273
|
+
|
|
274
|
+
--color-sentiment-interactive-primary: @interactive-primary;
|
|
275
|
+
--color-sentiment-interactive-primary-hover: @interactive-primary-hover;
|
|
276
|
+
--color-sentiment-interactive-primary-active: @interactive-primary-active;
|
|
277
|
+
|
|
278
|
+
--color-sentiment-interactive-secondary: @interactive-secondary;
|
|
279
|
+
--color-sentiment-interactive-secondary-hover: @interactive-secondary-hover;
|
|
280
|
+
--color-sentiment-interactive-secondary-active: @interactive-secondary-active;
|
|
281
|
+
|
|
282
|
+
--color-sentiment-interactive-secondary-neutral: @interactive-secondary-neutral;
|
|
283
|
+
--color-sentiment-interactive-secondary-neutral-hover: @interactive-secondary-neutral-hover;
|
|
284
|
+
--color-sentiment-interactive-secondary-neutral-active: @interactive-secondary-neutral-active;
|
|
285
|
+
|
|
286
|
+
--color-sentiment-interactive-control: @interactive-control;
|
|
287
|
+
--color-sentiment-interactive-control-hover: @interactive-control-hover;
|
|
288
|
+
--color-sentiment-interactive-control-active: @interactive-control-active;
|
|
289
|
+
|
|
290
|
+
--color-sentiment-background-surface: @background-surface;
|
|
291
|
+
--color-sentiment-background-surface-hover: @background-surface-hover;
|
|
292
|
+
--color-sentiment-background-surface-active: @background-surface-active;
|
|
293
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { render, screen } from '../test-utils';
|
|
2
|
+
import SentimentSurface from './SentimentSurface';
|
|
3
|
+
import { Sentiment, Emphasis } from './SentimentSurface.types';
|
|
4
|
+
|
|
5
|
+
describe('SentimentSurface', () => {
|
|
6
|
+
const testContent = 'Test content';
|
|
7
|
+
|
|
8
|
+
describe('rendering', () => {
|
|
9
|
+
it('renders with children', () => {
|
|
10
|
+
render(<SentimentSurface sentiment="neutral">{testContent}</SentimentSurface>);
|
|
11
|
+
expect(screen.getByText(testContent)).toBeInTheDocument();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('renders as div by default', () => {
|
|
15
|
+
render(
|
|
16
|
+
<SentimentSurface sentiment="neutral" testId="surface">
|
|
17
|
+
{testContent}
|
|
18
|
+
</SentimentSurface>,
|
|
19
|
+
);
|
|
20
|
+
expect(screen.getByTestId('surface').tagName).toBe('DIV');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('renders as custom element when as prop is provided', () => {
|
|
24
|
+
render(
|
|
25
|
+
<SentimentSurface sentiment="neutral" as="section" testId="surface">
|
|
26
|
+
{testContent}
|
|
27
|
+
</SentimentSurface>,
|
|
28
|
+
);
|
|
29
|
+
expect(screen.getByTestId('surface').tagName).toBe('SECTION');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('sentiment variants', () => {
|
|
34
|
+
const sentiments: Sentiment[] = ['negative', 'warning', 'neutral', 'success', 'proposition'];
|
|
35
|
+
|
|
36
|
+
sentiments.forEach((sentiment) => {
|
|
37
|
+
it(`renders ${sentiment} sentiment with correct class`, () => {
|
|
38
|
+
render(
|
|
39
|
+
<SentimentSurface sentiment={sentiment} testId="surface">
|
|
40
|
+
{testContent}
|
|
41
|
+
</SentimentSurface>,
|
|
42
|
+
);
|
|
43
|
+
const element = screen.getByTestId('surface');
|
|
44
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
45
|
+
expect(element).toHaveClass(`wds-sentiment-surface-${sentiment}-base`);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('emphasis variants', () => {
|
|
51
|
+
const emphasisLevels: Emphasis[] = ['base', 'elevated'];
|
|
52
|
+
|
|
53
|
+
emphasisLevels.forEach((emphasis) => {
|
|
54
|
+
it(`renders ${emphasis} emphasis with correct class`, () => {
|
|
55
|
+
render(
|
|
56
|
+
<SentimentSurface sentiment="neutral" emphasis={emphasis} testId="surface">
|
|
57
|
+
{testContent}
|
|
58
|
+
</SentimentSurface>,
|
|
59
|
+
);
|
|
60
|
+
const element = screen.getByTestId('surface');
|
|
61
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
62
|
+
expect(element).toHaveClass(`wds-sentiment-surface-neutral-${emphasis}`);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('defaults to base emphasis when not provided', () => {
|
|
67
|
+
render(
|
|
68
|
+
<SentimentSurface sentiment="neutral" testId="surface">
|
|
69
|
+
{testContent}
|
|
70
|
+
</SentimentSurface>,
|
|
71
|
+
);
|
|
72
|
+
const element = screen.getByTestId('surface');
|
|
73
|
+
expect(element).toHaveClass('wds-sentiment-surface');
|
|
74
|
+
expect(element).toHaveClass('wds-sentiment-surface-neutral-base');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('custom props', () => {
|
|
79
|
+
it('applies custom className', () => {
|
|
80
|
+
const customClass = 'custom-class';
|
|
81
|
+
render(
|
|
82
|
+
<SentimentSurface sentiment="neutral" className={customClass} testId="surface">
|
|
83
|
+
{testContent}
|
|
84
|
+
</SentimentSurface>,
|
|
85
|
+
);
|
|
86
|
+
expect(screen.getByTestId('surface')).toHaveClass(customClass);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('applies custom id', () => {
|
|
90
|
+
const customId = 'custom-id';
|
|
91
|
+
render(
|
|
92
|
+
<SentimentSurface sentiment="neutral" id={customId}>
|
|
93
|
+
{testContent}
|
|
94
|
+
</SentimentSurface>,
|
|
95
|
+
);
|
|
96
|
+
expect(screen.getByText(testContent)).toHaveAttribute('id', customId);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('applies testId via data-testid', () => {
|
|
100
|
+
const testId = 'test-surface';
|
|
101
|
+
render(
|
|
102
|
+
<SentimentSurface sentiment="neutral" testId={testId}>
|
|
103
|
+
{testContent}
|
|
104
|
+
</SentimentSurface>,
|
|
105
|
+
);
|
|
106
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('applies custom style', () => {
|
|
110
|
+
const customStyle = { padding: '20px' };
|
|
111
|
+
render(
|
|
112
|
+
<SentimentSurface sentiment="neutral" style={customStyle} testId="surface">
|
|
113
|
+
{testContent}
|
|
114
|
+
</SentimentSurface>,
|
|
115
|
+
);
|
|
116
|
+
expect(screen.getByTestId('surface')).toHaveStyle(customStyle);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('HTML attributes', () => {
|
|
121
|
+
it('supports aria-label attribute', () => {
|
|
122
|
+
const ariaLabel = 'Surface label';
|
|
123
|
+
render(
|
|
124
|
+
<SentimentSurface sentiment="neutral" aria-label={ariaLabel} testId="surface">
|
|
125
|
+
{testContent}
|
|
126
|
+
</SentimentSurface>,
|
|
127
|
+
);
|
|
128
|
+
expect(screen.getByTestId('surface')).toHaveAttribute('aria-label', ariaLabel);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('supports role attribute', () => {
|
|
132
|
+
render(
|
|
133
|
+
<SentimentSurface sentiment="neutral" role="region" testId="surface">
|
|
134
|
+
{testContent}
|
|
135
|
+
</SentimentSurface>,
|
|
136
|
+
);
|
|
137
|
+
expect(screen.getByTestId('surface')).toHaveAttribute('role', 'region');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
});
|