@@ -16,16 +16,6 @@ const EXAMPLE_COLORS = [
16
16
] ;
17
17
const INITIAL_COLOR = EXAMPLE_COLORS [ 0 ] . color ;
18
18
19
- const CSS_VARIABLE_COLORS = [
20
- { name : 'red' , color : 'var(--red)' } ,
21
- { name : 'blue' , color : 'var(--blue)' } ,
22
- ] ;
23
-
24
- const CSS_VARS_STYLE_PROPS = {
25
- '--red' : '#f00' ,
26
- '--blue' : '#00f' ,
27
- } as React . CSSProperties ;
28
-
29
19
function getWrappingPopoverElement ( element : HTMLElement ) {
30
20
return element . closest ( '.components-popover' ) ;
31
21
}
@@ -211,52 +201,4 @@ describe( 'ColorPalette', () => {
211
201
screen . getByRole ( 'button' , { name : 'Clear' } )
212
202
) . toBeInTheDocument ( ) ;
213
203
} ) ;
214
-
215
- it ( 'should show the readable text label even when the background color has a CSS variable.' , async ( ) => {
216
- // const user = userEvent.setup();
217
- const onChange = jest . fn ( ) ;
218
-
219
- render (
220
- < div style = { CSS_VARS_STYLE_PROPS } >
221
- < ColorPalette
222
- colors = { CSS_VARIABLE_COLORS }
223
- value = { CSS_VARIABLE_COLORS [ 0 ] . color }
224
- onChange = { onChange }
225
- />
226
- </ div >
227
- ) ;
228
-
229
- const dropdownButton = screen . getByRole ( 'button' , {
230
- name : / ^ C u s t o m c o l o r p i c k e r / ,
231
- expanded : false ,
232
- } ) ;
233
-
234
- const dropdownButtonStyles = window . getComputedStyle ( dropdownButton ) ;
235
- expect ( dropdownButtonStyles . color ) . toBe ( 'rgb(0, 0, 0)' ) ;
236
- } ) ;
237
-
238
- it ( 'should render dropdown with Hex value transformed from CSS a variable to actual color' , async ( ) => {
239
- const user = userEvent . setup ( ) ;
240
- const onChange = jest . fn ( ) ;
241
-
242
- render (
243
- < div style = { CSS_VARS_STYLE_PROPS } >
244
- < ColorPalette
245
- colors = { CSS_VARIABLE_COLORS }
246
- value = { CSS_VARIABLE_COLORS [ 0 ] . color }
247
- onChange = { onChange }
248
- />
249
- </ div >
250
- ) ;
251
-
252
- const dropdownButton = screen . getByRole ( 'button' , {
253
- name : / ^ C u s t o m c o l o r p i c k e r / ,
254
- expanded : false ,
255
- } ) ;
256
-
257
- await user . click ( dropdownButton ) ;
258
-
259
- const dropdownColorInput = screen . getByLabelText ( 'Hex color' ) ;
260
- expect ( dropdownColorInput ) . toHaveValue ( 'FF0000' ) ;
261
- } ) ;
262
204
} ) ;
0 commit comments