File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed
packages/react-components
react-checkbox/library/src/components/Checkbox
react-list/library/src/components/List Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -258,19 +258,16 @@ export const useCheckboxStyles_unstable = (state: CheckboxState): CheckboxState
258258 const indicatorBaseClassName = useIndicatorBaseClassName ( ) ;
259259 const indicatorStyles = useIndicatorStyles ( ) ;
260260 if ( state . indicator ) {
261+ // Apply the appropriate visibility styles even when disabled
262+ const visibilityClass =
263+ checked === 'mixed' ? indicatorStyles . mixed : checked ? indicatorStyles . checked : indicatorStyles . unchecked ;
264+
261265 state . indicator . className = mergeClasses (
262266 checkboxClassNames . indicator ,
263267 indicatorBaseClassName ,
264268 size === 'large' && indicatorStyles . large ,
265269 shape === 'circular' && indicatorStyles . circular ,
266- // Add animation state classes
267- disabled
268- ? undefined // No animation when disabled
269- : checked === 'mixed'
270- ? indicatorStyles . mixed
271- : checked
272- ? indicatorStyles . checked
273- : indicatorStyles . unchecked ,
270+ visibilityClass , // Always apply visibility styles
274271 state . indicator . className ,
275272 ) ;
276273 }
Original file line number Diff line number Diff line change @@ -173,9 +173,18 @@ const validateSetOfListItems = (expectedStates: Array<boolean>) =>
173173 listItem . should ( 'have.attr' , 'aria-selected' , checked . toString ( ) ) ;
174174
175175 cy . log ( 'Validate checkbox state on item' , index + 1 ) ;
176- cy . get ( `[data-test="list-item-${ index + 1 } "] .fui-Checkbox__indicator > svg` ) . should (
177- checked ? 'exist' : 'not.exist' ,
178- ) ;
176+ // Updated to check for visibility instead of existence
177+ if ( checked ) {
178+ // When checked, the checkmark (first svg) should be visible
179+ cy . get ( `[data-test="list-item-${ index + 1 } "] .fui-Checkbox__indicator > svg:first-child` ) . should (
180+ 'have.css' ,
181+ 'opacity' ,
182+ '1' ,
183+ ) ;
184+ } else {
185+ // When unchecked, both icons should be hidden
186+ cy . get ( `[data-test="list-item-${ index + 1 } "] .fui-Checkbox__indicator > svg` ) . should ( 'have.css' , 'opacity' , '0' ) ;
187+ }
179188
180189 cy . log ( 'Validate that the item is present/not present in the parent state (or stringified state)' ) ;
181190 cy . get ( `[data-test="selected-items"]` ) . should ( checked ? 'contain' : 'not.contain' , `list-item-${ index + 1 } ` ) ;
You can’t perform that action at this time.
0 commit comments