@transferwise/components 46.116.1 → 46.117.0
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/main.css +60 -131
- package/build/prompt/InlinePrompt/InlinePrompt.js +14 -8
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +15 -9
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/sentimentSurface/SentimentSurface.js +6 -5
- package/build/sentimentSurface/SentimentSurface.js.map +1 -1
- package/build/sentimentSurface/SentimentSurface.mjs +6 -5
- package/build/sentimentSurface/SentimentSurface.mjs.map +1 -1
- package/build/styles/button/Button.css +17 -17
- package/build/styles/button/Button.vars.css +16 -16
- package/build/styles/iconButton/IconButton.css +8 -8
- package/build/styles/link/Link.css +1 -0
- package/build/styles/main.css +60 -131
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/build/styles/sentimentSurface/SentimentSurface.css +8 -1
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts +19 -3
- package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.d.ts +5 -4
- package/build/types/sentimentSurface/SentimentSurface.d.ts.map +1 -1
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts +4 -16
- package/build/types/sentimentSurface/SentimentSurface.types.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +24 -0
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/button/Button.css +17 -17
- package/src/button/Button.less +1 -1
- package/src/button/Button.story.tsx +75 -110
- package/src/button/Button.tests.story.tsx +189 -0
- package/src/button/Button.vars.css +16 -16
- package/src/button/Button.vars.less +58 -18
- package/src/iconButton/IconButton.css +8 -8
- package/src/iconButton/IconButton.less +35 -4
- package/src/iconButton/IconButton.story.tsx +72 -3
- package/src/link/Link.css +1 -0
- package/src/link/Link.less +1 -0
- package/src/link/Link.story.tsx +28 -0
- package/src/main.css +60 -131
- package/src/prompt/InlinePrompt/InlinePrompt.css +26 -105
- package/src/prompt/InlinePrompt/InlinePrompt.less +31 -119
- package/src/prompt/InlinePrompt/InlinePrompt.spec.tsx +87 -29
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +223 -31
- package/src/prompt/InlinePrompt/InlinePrompt.tsx +42 -11
- package/src/sentimentSurface/SentimentSurface.css +8 -1
- package/src/sentimentSurface/SentimentSurface.docs.mdx +32 -495
- package/src/sentimentSurface/SentimentSurface.less +121 -114
- package/src/sentimentSurface/SentimentSurface.spec.tsx +31 -11
- package/src/sentimentSurface/SentimentSurface.story.tsx +323 -108
- package/src/sentimentSurface/SentimentSurface.tests.story.tsx +90 -40
- package/src/sentimentSurface/SentimentSurface.tsx +16 -9
- package/src/sentimentSurface/SentimentSurface.types.ts +5 -20
- package/src/test-utils/story-config.ts +0 -1
- package/build/sentimentSurface/classMap.js +0 -17
- package/build/sentimentSurface/classMap.js.map +0 -1
- package/build/sentimentSurface/classMap.mjs +0 -14
- package/build/sentimentSurface/classMap.mjs.map +0 -1
- package/build/types/sentimentSurface/classMap.d.ts +0 -4
- package/build/types/sentimentSurface/classMap.d.ts.map +0 -1
- package/src/sentimentSurface/classMap.ts +0 -15
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
.wds-sentiment-surface {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
&--hasBaseStyles {
|
|
3
|
+
background-color: var(--color-sentiment-background-surface);
|
|
4
|
+
color: var(--color-sentiment-content-primary);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&-negative {
|
|
8
|
+
.np-theme-personal &,
|
|
9
|
+
.np-theme-personal--bright-green & {
|
|
10
|
+
&-base {
|
|
11
|
+
.sentiment-surface-tokens(
|
|
7
12
|
#CB272F, #B8232B, #A72027,
|
|
8
13
|
#CB272F, #B8232B, #A72027,
|
|
9
14
|
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
@@ -11,23 +16,23 @@
|
|
|
11
16
|
#FBEAEA, #F9E1E1, #F8D8D8,
|
|
12
17
|
#FBEAEA, #F9E1E1, #F8D8D8
|
|
13
18
|
);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
}
|
|
20
|
+
&-elevated {
|
|
21
|
+
.sentiment-surface-tokens(
|
|
17
22
|
#FFFFFF, #F5CCCC, #F1B7B7,
|
|
18
23
|
#FBEAEA, #F5CCCC, #F1B7B7,
|
|
19
24
|
#CB272F, #B8232B, #A72027,
|
|
20
|
-
#9B141B, #831116, #
|
|
25
|
+
#9B141B, #831116, #6D0e13,
|
|
21
26
|
#CB272F, #B8232B, #A72027,
|
|
22
27
|
#90000D, #B8232B, #A72027
|
|
23
28
|
);
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
}
|
|
30
|
+
}
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
.np-theme-personal--dark &,
|
|
33
|
+
.np-theme-personal--forest-green & {
|
|
34
|
+
&-base {
|
|
35
|
+
.sentiment-surface-tokens(
|
|
31
36
|
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
32
37
|
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
33
38
|
#410B0D, #641115, #761418,
|
|
@@ -35,9 +40,9 @@
|
|
|
35
40
|
#410B0D, #641115, #761418,
|
|
36
41
|
#410B0D, #641115, #761418
|
|
37
42
|
);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
}
|
|
44
|
+
&-elevated {
|
|
45
|
+
.sentiment-surface-tokens(
|
|
41
46
|
#410B0D, #641115, #761418,
|
|
42
47
|
#410B0D, #641115, #761418,
|
|
43
48
|
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
@@ -45,15 +50,15 @@
|
|
|
45
50
|
#FFA8AD, #FFBDC0, #FFD1D3,
|
|
46
51
|
#FFA8AD, #FFBDC0, #FFD1D3
|
|
47
52
|
);
|
|
48
|
-
|
|
49
|
-
}
|
|
53
|
+
}
|
|
50
54
|
}
|
|
55
|
+
}
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
&-warning {
|
|
58
|
+
.np-theme-personal &,
|
|
59
|
+
.np-theme-personal--bright-green & {
|
|
60
|
+
&-base {
|
|
61
|
+
.sentiment-surface-tokens(
|
|
57
62
|
#4A3B1C, #302612, #2C2311, // content-primary (default, hover, active)
|
|
58
63
|
#FFD11A, #FFBF0F, #FFBB00, // interactive-primary
|
|
59
64
|
#FFF7D7, #FFF0B2, #FFE98F, // interactive-secondary
|
|
@@ -61,9 +66,9 @@
|
|
|
61
66
|
#4A3B1C, #302612, #2C2311, // interactive-control
|
|
62
67
|
#FFF7D7, #FFF0B2, #FFE98F // background-surface
|
|
63
68
|
);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
}
|
|
70
|
+
&-elevated {
|
|
71
|
+
.sentiment-surface-tokens(
|
|
67
72
|
#4A3B1C, #302612, #2C2311, // content-primary
|
|
68
73
|
#4A3B1C, #302612, #2C2311, // interactive-primary
|
|
69
74
|
#FFD11A, #FFBF0F, #FFBB00, // interactive-secondary
|
|
@@ -71,13 +76,13 @@
|
|
|
71
76
|
#FFD11A, #FFBF0F, #FFBB00, // interactive-control
|
|
72
77
|
#FFD11A, #FFBF0F, #FFBB00 // background-surface
|
|
73
78
|
);
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
}
|
|
80
|
+
}
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
.np-theme-personal--dark &,
|
|
83
|
+
.np-theme-personal--forest-green & {
|
|
84
|
+
&-base {
|
|
85
|
+
.sentiment-surface-tokens(
|
|
81
86
|
#FADC65, #F9D648, #F8CD20, // content-primary
|
|
82
87
|
#FADC65, #F9D648, #F8CD20, // interactive-primary
|
|
83
88
|
#3A3523, #504930, #665D3D, // interactive-secondary
|
|
@@ -85,9 +90,9 @@
|
|
|
85
90
|
#3A3523, #504930, #665D3D, // interactive-control
|
|
86
91
|
#3A3523, #504930, #665D3D // background-surface
|
|
87
92
|
);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
}
|
|
94
|
+
&-elevated {
|
|
95
|
+
.sentiment-surface-tokens(
|
|
91
96
|
#3A3523, #504930, #665D3D, // content-primary
|
|
92
97
|
#3A3523, #504930, #665D3D, // interactive-primary
|
|
93
98
|
#FADC65, #F9D648, #F8CD20, // interactive-secondary
|
|
@@ -95,14 +100,14 @@
|
|
|
95
100
|
#FADC65, #F9D648, #F8CD20, // interactive-control
|
|
96
101
|
#FADC65, #F9D648, #F8CD20 // background-surface
|
|
97
102
|
);
|
|
98
|
-
|
|
99
|
-
}
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
}
|
|
106
|
+
&-success {
|
|
107
|
+
.np-theme-personal &,
|
|
108
|
+
.np-theme-personal--bright-green & {
|
|
109
|
+
&-base {
|
|
110
|
+
.sentiment-surface-tokens(
|
|
106
111
|
#054D28, #043A1E, #022614, // content-primary (default, hover, active)
|
|
107
112
|
#054D28, #043A1E, #022614, // interactive-primary
|
|
108
113
|
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-secondary
|
|
@@ -110,9 +115,9 @@
|
|
|
110
115
|
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-control
|
|
111
116
|
#E2F6D5, #D3F2C0, #C5EDAB // background-surface
|
|
112
117
|
);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
}
|
|
119
|
+
&-elevated {
|
|
120
|
+
.sentiment-surface-tokens(
|
|
116
121
|
#E2F6D5, #D3F2C0, #C5EDAB, // content-primary
|
|
117
122
|
#E2F6D5, #D3F2C0, #C5EDAB, // interactive-primary
|
|
118
123
|
#054D28, #043A1E, #022614, // interactive-secondary
|
|
@@ -120,13 +125,13 @@
|
|
|
120
125
|
#054D28, #043A1E, #022614, // interactive-control
|
|
121
126
|
#054D28, #043A1E, #022614 // background-surface
|
|
122
127
|
);
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
}
|
|
129
|
+
}
|
|
125
130
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
131
|
+
.np-theme-personal--dark &,
|
|
132
|
+
.np-theme-personal--forest-green & {
|
|
133
|
+
&-base {
|
|
134
|
+
.sentiment-surface-tokens(
|
|
130
135
|
#BAE5A0, #C8EAB3, #D6F0C7, // content-primary
|
|
131
136
|
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-primary
|
|
132
137
|
#252C20, #323B2B, #3E4A36, // interactive-secondary
|
|
@@ -134,9 +139,9 @@
|
|
|
134
139
|
#252C20, #323B2B, #3E4A36, // interactive-control
|
|
135
140
|
#252C20, #323B2B, #3E4A36 // background-surface
|
|
136
141
|
);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
}
|
|
143
|
+
&-elevated {
|
|
144
|
+
.sentiment-surface-tokens(
|
|
140
145
|
#252C20, #323B2B, #3E4A36, // content-primary
|
|
141
146
|
#252C20, #323B2B, #3E4A36, // interactive-primary
|
|
142
147
|
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-secondary
|
|
@@ -144,14 +149,14 @@
|
|
|
144
149
|
#BAE5A0, #C8EAB3, #D6F0C7, // interactive-control
|
|
145
150
|
#BAE5A0, #C8EAB3, #D6F0C7 // background-surface
|
|
146
151
|
);
|
|
147
|
-
|
|
148
|
-
}
|
|
152
|
+
}
|
|
149
153
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
}
|
|
155
|
+
&-neutral {
|
|
156
|
+
.np-theme-personal &,
|
|
157
|
+
.np-theme-personal--bright-green & {
|
|
158
|
+
&-base {
|
|
159
|
+
.sentiment-surface-tokens(
|
|
155
160
|
#454745, #353635, #232423, // content-primary (default, hover, active)
|
|
156
161
|
#454745, #353635, #232423, // interactive-primary
|
|
157
162
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
@@ -159,9 +164,9 @@
|
|
|
159
164
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
160
165
|
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
161
166
|
);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
}
|
|
168
|
+
&-elevated {
|
|
169
|
+
.sentiment-surface-tokens(
|
|
165
170
|
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
166
171
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
167
172
|
#454745, #353635, #232423, // interactive-secondary
|
|
@@ -169,13 +174,13 @@
|
|
|
169
174
|
#454745, #353635, #232423, // interactive-control
|
|
170
175
|
#454745, #353635, #232423 // background-surface
|
|
171
176
|
);
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
}
|
|
178
|
+
}
|
|
174
179
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
.np-theme-personal--dark &,
|
|
181
|
+
.np-theme-personal--forest-green & {
|
|
182
|
+
&-base {
|
|
183
|
+
.sentiment-surface-tokens(
|
|
179
184
|
#F1F1ED, #E7E7E1, #DFDED5, // content-primary
|
|
180
185
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-primary
|
|
181
186
|
#2A2C29, #414441, #595B58, // interactive-secondary
|
|
@@ -183,9 +188,9 @@
|
|
|
183
188
|
#2A2C29, #414441, #595B58, // interactive-control
|
|
184
189
|
#2A2C29, #414441, #595B58 // background-surface
|
|
185
190
|
);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
191
|
+
}
|
|
192
|
+
&-elevated {
|
|
193
|
+
.sentiment-surface-tokens(
|
|
189
194
|
#2A2C29, #414441, #595B58, // content-primary
|
|
190
195
|
#2A2C29, #414441, #595B58, // interactive-primary
|
|
191
196
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-secondary
|
|
@@ -193,14 +198,14 @@
|
|
|
193
198
|
#F1F1ED, #E7E7E1, #DFDED5, // interactive-control
|
|
194
199
|
#F1F1ED, #E7E7E1, #DFDED5 // background-surface
|
|
195
200
|
);
|
|
196
|
-
|
|
197
|
-
}
|
|
201
|
+
}
|
|
198
202
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
}
|
|
204
|
+
&-proposition {
|
|
205
|
+
.np-theme-personal &,
|
|
206
|
+
.np-theme-personal--bright-green & {
|
|
207
|
+
&-base {
|
|
208
|
+
.sentiment-surface-tokens(
|
|
204
209
|
#0E0F0C, #0A2826, #074140, // content-primary (default, hover, active)
|
|
205
210
|
#054D4D, #043A3A, #022626, // interactive-primary
|
|
206
211
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
@@ -208,9 +213,9 @@
|
|
|
208
213
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
209
214
|
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
210
215
|
);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
}
|
|
217
|
+
&-elevated {
|
|
218
|
+
.sentiment-surface-tokens(
|
|
214
219
|
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
215
220
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
216
221
|
#054D4D, #043A3A, #022626, // interactive-secondary
|
|
@@ -218,13 +223,13 @@
|
|
|
218
223
|
#054D4D, #043A3A, #022626, // interactive-control
|
|
219
224
|
#054D4D, #043A3A, #022626 // background-surface
|
|
220
225
|
);
|
|
221
|
-
|
|
222
|
-
|
|
226
|
+
}
|
|
227
|
+
}
|
|
223
228
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
.np-theme-personal--dark &,
|
|
230
|
+
.np-theme-personal--forest-green & {
|
|
231
|
+
&-base {
|
|
232
|
+
.sentiment-surface-tokens(
|
|
228
233
|
#FFFFFF, #EAF9F9, #D5F4F4, // content-primary
|
|
229
234
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-primary
|
|
230
235
|
#0B312F, #124F4C, #176460, // interactive-secondary
|
|
@@ -232,9 +237,9 @@
|
|
|
232
237
|
#0B312F, #124F4C, #176460, // interactive-control
|
|
233
238
|
#0B312F, #124F4C, #176460 // background-surface
|
|
234
239
|
);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
240
|
+
}
|
|
241
|
+
&-elevated {
|
|
242
|
+
.sentiment-surface-tokens(
|
|
238
243
|
#0E0F0C, #0A2826, #074140, // content-primary
|
|
239
244
|
#0B312F, #104744, #16605C, // interactive-primary
|
|
240
245
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-secondary
|
|
@@ -242,9 +247,11 @@
|
|
|
242
247
|
#E0F7F7, #CAF1F1, #B6ECEC, // interactive-control
|
|
243
248
|
#E0F7F7, #CAF1F1, #B6ECEC // background-surface
|
|
244
249
|
);
|
|
245
|
-
|
|
246
|
-
}
|
|
250
|
+
}
|
|
247
251
|
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
--ring-outline-color: var(--color-sentiment-content-primary, var(--color-content-primary));
|
|
248
255
|
}
|
|
249
256
|
|
|
250
257
|
.sentiment-surface-tokens(
|
|
@@ -267,27 +274,27 @@
|
|
|
267
274
|
@background-surface-hover,
|
|
268
275
|
@background-surface-active
|
|
269
276
|
) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
277
|
+
--color-sentiment-content-primary: @content-primary;
|
|
278
|
+
--color-sentiment-content-primary-hover: @content-primary-hover;
|
|
279
|
+
--color-sentiment-content-primary-active: @content-primary-active;
|
|
273
280
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
281
|
+
--color-sentiment-interactive-primary: @interactive-primary;
|
|
282
|
+
--color-sentiment-interactive-primary-hover: @interactive-primary-hover;
|
|
283
|
+
--color-sentiment-interactive-primary-active: @interactive-primary-active;
|
|
277
284
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
285
|
+
--color-sentiment-interactive-secondary: @interactive-secondary;
|
|
286
|
+
--color-sentiment-interactive-secondary-hover: @interactive-secondary-hover;
|
|
287
|
+
--color-sentiment-interactive-secondary-active: @interactive-secondary-active;
|
|
281
288
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
289
|
+
--color-sentiment-interactive-secondary-neutral: @interactive-secondary-neutral;
|
|
290
|
+
--color-sentiment-interactive-secondary-neutral-hover: @interactive-secondary-neutral-hover;
|
|
291
|
+
--color-sentiment-interactive-secondary-neutral-active: @interactive-secondary-neutral-active;
|
|
285
292
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
--color-sentiment-interactive-control: @interactive-control;
|
|
294
|
+
--color-sentiment-interactive-control-hover: @interactive-control-hover;
|
|
295
|
+
--color-sentiment-interactive-control-active: @interactive-control-active;
|
|
289
296
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
297
|
+
--color-sentiment-background-surface: @background-surface;
|
|
298
|
+
--color-sentiment-background-surface-hover: @background-surface-hover;
|
|
299
|
+
--color-sentiment-background-surface-active: @background-surface-active;
|
|
293
300
|
}
|
|
@@ -13,7 +13,7 @@ describe('SentimentSurface', () => {
|
|
|
13
13
|
|
|
14
14
|
it('renders as div by default', () => {
|
|
15
15
|
render(
|
|
16
|
-
<SentimentSurface sentiment="neutral"
|
|
16
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
17
17
|
{testContent}
|
|
18
18
|
</SentimentSurface>,
|
|
19
19
|
);
|
|
@@ -22,7 +22,7 @@ describe('SentimentSurface', () => {
|
|
|
22
22
|
|
|
23
23
|
it('renders as custom element when as prop is provided', () => {
|
|
24
24
|
render(
|
|
25
|
-
<SentimentSurface sentiment="neutral" as="section"
|
|
25
|
+
<SentimentSurface sentiment="neutral" as="section" data-testid="surface">
|
|
26
26
|
{testContent}
|
|
27
27
|
</SentimentSurface>,
|
|
28
28
|
);
|
|
@@ -30,13 +30,33 @@ describe('SentimentSurface', () => {
|
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
+
describe('hasBaseStyles', () => {
|
|
34
|
+
it('applies base styles by default', () => {
|
|
35
|
+
render(
|
|
36
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
37
|
+
{testContent}
|
|
38
|
+
</SentimentSurface>,
|
|
39
|
+
);
|
|
40
|
+
expect(screen.getByTestId('surface')).toHaveClass('wds-sentiment-surface--hasBaseStyles');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('does not apply base styles when hasBaseStyles is false', () => {
|
|
44
|
+
render(
|
|
45
|
+
<SentimentSurface sentiment="neutral" hasBaseStyles={false} data-testid="surface">
|
|
46
|
+
{testContent}
|
|
47
|
+
</SentimentSurface>,
|
|
48
|
+
);
|
|
49
|
+
expect(screen.getByTestId('surface')).not.toHaveClass('wds-sentiment-surface--hasBaseStyles');
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
33
53
|
describe('sentiment variants', () => {
|
|
34
54
|
const sentiments: Sentiment[] = ['negative', 'warning', 'neutral', 'success', 'proposition'];
|
|
35
55
|
|
|
36
56
|
sentiments.forEach((sentiment) => {
|
|
37
57
|
it(`renders ${sentiment} sentiment with correct class`, () => {
|
|
38
58
|
render(
|
|
39
|
-
<SentimentSurface sentiment={sentiment}
|
|
59
|
+
<SentimentSurface sentiment={sentiment} data-testid="surface">
|
|
40
60
|
{testContent}
|
|
41
61
|
</SentimentSurface>,
|
|
42
62
|
);
|
|
@@ -53,7 +73,7 @@ describe('SentimentSurface', () => {
|
|
|
53
73
|
emphasisLevels.forEach((emphasis) => {
|
|
54
74
|
it(`renders ${emphasis} emphasis with correct class`, () => {
|
|
55
75
|
render(
|
|
56
|
-
<SentimentSurface sentiment="neutral" emphasis={emphasis}
|
|
76
|
+
<SentimentSurface sentiment="neutral" emphasis={emphasis} data-testid="surface">
|
|
57
77
|
{testContent}
|
|
58
78
|
</SentimentSurface>,
|
|
59
79
|
);
|
|
@@ -65,7 +85,7 @@ describe('SentimentSurface', () => {
|
|
|
65
85
|
|
|
66
86
|
it('defaults to base emphasis when not provided', () => {
|
|
67
87
|
render(
|
|
68
|
-
<SentimentSurface sentiment="neutral"
|
|
88
|
+
<SentimentSurface sentiment="neutral" data-testid="surface">
|
|
69
89
|
{testContent}
|
|
70
90
|
</SentimentSurface>,
|
|
71
91
|
);
|
|
@@ -79,7 +99,7 @@ describe('SentimentSurface', () => {
|
|
|
79
99
|
it('applies custom className', () => {
|
|
80
100
|
const customClass = 'custom-class';
|
|
81
101
|
render(
|
|
82
|
-
<SentimentSurface sentiment="neutral" className={customClass}
|
|
102
|
+
<SentimentSurface sentiment="neutral" className={customClass} data-testid="surface">
|
|
83
103
|
{testContent}
|
|
84
104
|
</SentimentSurface>,
|
|
85
105
|
);
|
|
@@ -96,10 +116,10 @@ describe('SentimentSurface', () => {
|
|
|
96
116
|
expect(screen.getByText(testContent)).toHaveAttribute('id', customId);
|
|
97
117
|
});
|
|
98
118
|
|
|
99
|
-
it('applies
|
|
119
|
+
it('applies data-testid attribute', () => {
|
|
100
120
|
const testId = 'test-surface';
|
|
101
121
|
render(
|
|
102
|
-
<SentimentSurface sentiment="neutral"
|
|
122
|
+
<SentimentSurface sentiment="neutral" data-testid={testId}>
|
|
103
123
|
{testContent}
|
|
104
124
|
</SentimentSurface>,
|
|
105
125
|
);
|
|
@@ -109,7 +129,7 @@ describe('SentimentSurface', () => {
|
|
|
109
129
|
it('applies custom style', () => {
|
|
110
130
|
const customStyle = { padding: '20px' };
|
|
111
131
|
render(
|
|
112
|
-
<SentimentSurface sentiment="neutral" style={customStyle}
|
|
132
|
+
<SentimentSurface sentiment="neutral" style={customStyle} data-testid="surface">
|
|
113
133
|
{testContent}
|
|
114
134
|
</SentimentSurface>,
|
|
115
135
|
);
|
|
@@ -121,7 +141,7 @@ describe('SentimentSurface', () => {
|
|
|
121
141
|
it('supports aria-label attribute', () => {
|
|
122
142
|
const ariaLabel = 'Surface label';
|
|
123
143
|
render(
|
|
124
|
-
<SentimentSurface sentiment="neutral" aria-label={ariaLabel}
|
|
144
|
+
<SentimentSurface sentiment="neutral" aria-label={ariaLabel} data-testid="surface">
|
|
125
145
|
{testContent}
|
|
126
146
|
</SentimentSurface>,
|
|
127
147
|
);
|
|
@@ -130,7 +150,7 @@ describe('SentimentSurface', () => {
|
|
|
130
150
|
|
|
131
151
|
it('supports role attribute', () => {
|
|
132
152
|
render(
|
|
133
|
-
<SentimentSurface sentiment="neutral" role="region"
|
|
153
|
+
<SentimentSurface sentiment="neutral" role="region" data-testid="surface">
|
|
134
154
|
{testContent}
|
|
135
155
|
</SentimentSurface>,
|
|
136
156
|
);
|