55 currentColorDescription ,
66 advancedColorPickerCell ,
77 simpleColorPickerInput ,
8- simpleColorPickerComponent ,
9- advancedColorPickerPreview ,
108} from "../../../playwright/components/advanced-color-picker" ;
119import {
1210 dialog as advancedColorPickerParent ,
@@ -16,25 +14,6 @@ import { closeIconButton } from "../../../playwright/components/index";
1614import { CHARACTERS } from "../../../playwright/support/constants" ;
1715import { checkAccessibility } from "../../../playwright/support/helper" ;
1816
19- // TODO: Skipped due to flaky focus behaviour. To review in FE-6428
20- test . skip ( "should have the expected styling when focused" , async ( {
21- mount,
22- page,
23- } ) => {
24- await mount ( < AdvancedColorPickerCustom open /> ) ;
25-
26- const icon = closeIconButton ( page ) ;
27- await icon . focus ( ) ;
28- await expect ( closeIconButton ( page ) ) . toHaveCSS (
29- "box-shadow" ,
30- "rgb(255, 188, 25) 0px 0px 0px 3px, rgba(0, 0, 0, 0.9) 0px 0px 0px 6px" ,
31- ) ;
32- await expect ( closeIconButton ( page ) ) . toHaveCSS (
33- "outline" ,
34- "rgba(0, 0, 0, 0) solid 3px" ,
35- ) ;
36- } ) ;
37-
3817test ( "when AdvancedColorPicker is opened and then closed, with the `restoreFocusOnClose` prop passed as `false`, the call to action element should not be focused" , async ( {
3918 mount,
4019 page,
@@ -57,38 +36,6 @@ test("when AdvancedColorPicker is opened and then closed, with the `restoreFocus
5736} ) ;
5837
5938test . describe ( "should render AdvancedColorPicker component and check functionality" , ( ) => {
60- (
61- [
62- [ "ArrowUp" , 2 ] ,
63- [ "ArrowLeft" , 6 ] ,
64- [ "ArrowRight" , 8 ] ,
65- ] as [ string , number ] [ ]
66- ) . forEach ( ( [ key , index ] ) => {
67- test ( `should use ${ key } key and move selection` , async ( {
68- mount,
69- page,
70- } ) => {
71- await mount ( < AdvancedColorPickerCustom /> ) ;
72-
73- const picker = simpleColorPickerInput ( page , 7 ) ;
74- await picker . press ( key ) ;
75- await expect ( simpleColorPickerInput ( page , index ) ) . toBeChecked ( ) ;
76- } ) ;
77- } ) ;
78-
79- test ( "should move selection down using downarrow" , async ( {
80- mount,
81- page,
82- } ) => {
83- await mount ( < AdvancedColorPickerCustom /> ) ;
84-
85- const picker = simpleColorPickerInput ( page , 7 ) ;
86- await picker . press ( "ArrowUp" ) ;
87- const newPicker = simpleColorPickerInput ( page , 2 ) ;
88- await newPicker . press ( "ArrowDown" ) ;
89- await expect ( simpleColorPickerInput ( page , 7 ) ) . toBeChecked ( ) ;
90- } ) ;
91-
9239 test ( "should regain focus on color after second tab" , async ( {
9340 mount,
9441 page,
@@ -103,40 +50,10 @@ test.describe("should render AdvancedColorPicker component and check functionali
10350
10451 await expect ( simpleColorPickerInput ( page , 7 ) ) . toBeFocused ( ) ;
10552 } ) ;
106-
107- ( [ "Space" , "Enter" ] as const ) . forEach ( ( key ) => {
108- test ( `should close AdvancedColorPicker using ${ key } on selected color` , async ( {
109- mount,
110- page,
111- } ) => {
112- await mount ( < AdvancedColorPickerCustom /> ) ;
113-
114- const picker = simpleColorPickerInput ( page , 7 ) ;
115- await picker . press ( key ) ;
116- await expect ( simpleColorPickerComponent ( page ) ) . toBeHidden ( ) ;
117- } ) ;
118- } ) ;
119-
120- [ 1 , 2 , 3 ] . forEach ( ( index ) => {
121- test ( `should confirm dedicated ${ index } color was selected` , async ( {
122- mount,
123- page,
124- } ) => {
125- await mount ( < AdvancedColorPickerCustom /> ) ;
126-
127- const input = simpleColorPickerInput ( page , index ) ;
128- await input . click ( ) ;
129- await expect ( simpleColorPickerInput ( page , index ) ) . toBeChecked ( ) ;
130- } ) ;
131- } ) ;
13253} ) ;
13354
13455test . describe ( "should render AdvancedColorPicker component and check props" , ( ) => {
13556 const testPropValue = CHARACTERS . STANDARD ;
136- const colors = [
137- { value : "#111222" , label : "superBlack" } ,
138- { value : "#333555" , label : "black" } ,
139- ] ;
14057
14158 test ( "should render AdvancedColorPicker with aria-describedby prop" , async ( {
14259 mount,
@@ -210,88 +127,6 @@ test.describe("should render AdvancedColorPicker component and check props", ()
210127 ) ;
211128 } ) ;
212129
213- test ( "should render AdvancedColorPicker with availableColors prop" , async ( {
214- mount,
215- page,
216- } ) => {
217- await mount (
218- < AdvancedColorPickerCustom
219- availableColors = { colors }
220- selectedColor = "#111222"
221- /> ,
222- ) ;
223-
224- await expect ( simpleColorPickerInput ( page , 0 ) ) . toHaveAttribute (
225- "value" ,
226- colors [ 0 ] . value ,
227- ) ;
228- await expect ( simpleColorPickerInput ( page , 0 ) ) . toHaveAttribute (
229- "aria-label" ,
230- colors [ 0 ] . label ,
231- ) ;
232- await expect ( simpleColorPickerInput ( page , 1 ) ) . toHaveAttribute (
233- "value" ,
234- colors [ 1 ] . value ,
235- ) ;
236- await expect ( simpleColorPickerInput ( page , 1 ) ) . toHaveAttribute (
237- "aria-label" ,
238- colors [ 1 ] . label ,
239- ) ;
240- } ) ;
241-
242- test ( "should render AdvancedColorPicker with selectedColor prop" , async ( {
243- mount,
244- page,
245- } ) => {
246- await mount (
247- < AdvancedColorPickerCustom
248- availableColors = { colors }
249- selectedColor = "#333555"
250- /> ,
251- ) ;
252-
253- await expect ( simpleColorPickerInput ( page , 1 ) ) . toHaveAttribute (
254- "value" ,
255- colors [ 1 ] . value ,
256- ) ;
257- await expect ( simpleColorPickerInput ( page , 1 ) ) . toHaveAttribute (
258- "aria-label" ,
259- colors [ 1 ] . label ,
260- ) ;
261- } ) ;
262-
263- test ( "should render AdvancedColorPicker with defaultColor prop" , async ( {
264- mount,
265- page,
266- } ) => {
267- await mount (
268- < AdvancedColorPickerCustom
269- availableColors = { colors }
270- selectedColor = "#111222"
271- /> ,
272- ) ;
273-
274- await expect ( advancedColorPickerPreview ( page ) ) . toHaveAttribute (
275- "color" ,
276- colors [ 0 ] . value ,
277- ) ;
278- } ) ;
279-
280- [ true , false ] . forEach ( ( bool ) => {
281- test ( `should render AdvancedColorPicker with open prop set to ${ bool } ` , async ( {
282- mount,
283- page,
284- } ) => {
285- await mount ( < AdvancedColorPickerCustom open = { bool } /> ) ;
286-
287- if ( bool ) {
288- await expect ( advancedColorPickerParent ( page ) ) . toBeVisible ( ) ;
289- } else {
290- await expect ( advancedColorPickerParent ( page ) ) . toBeHidden ( ) ;
291- }
292- } ) ;
293- } ) ;
294-
295130 test ( "should render AdvancedColorPicker with correct description when color is selected" , async ( {
296131 mount,
297132 page,
@@ -314,14 +149,3 @@ test.describe("Accessibility tests for AdvancedColorPicker component", () => {
314149 await checkAccessibility ( page ) ;
315150 } ) ;
316151} ) ;
317-
318- test ( "color picker preview should have the expected border radius styling" , async ( {
319- mount,
320- page,
321- } ) => {
322- await mount ( < AdvancedColorPickerCustom /> ) ;
323- await expect ( advancedColorPickerPreview ( page ) ) . toHaveCSS (
324- "border-radius" ,
325- "4px" ,
326- ) ;
327- } ) ;
0 commit comments