@@ -8,7 +8,16 @@ import ValueState from '@ui5/webcomponents-base/dist/types/ValueState.js';
88import { ThemingParameters } from '@ui5/webcomponents-react-base' ;
99import type { IndicationColor } from '../../enums/index.js' ;
1010import { INDICATION_COLOR } from '../../i18n/i18n-defaults.js' ;
11- import { Icon } from '../../webComponents/index.js' ;
11+ import { Icon } from '../../webComponents/Icon/index.js' ;
12+ import { List } from '../../webComponents/List/index.js' ;
13+ import { ListItemCustom } from '../../webComponents/ListItemCustom/index.js' ;
14+ import { Table } from '../../webComponents/Table/index.js' ;
15+ import { TableCell } from '../../webComponents/TableCell/index.js' ;
16+ import { TableHeaderCell } from '../../webComponents/TableHeaderCell/index.js' ;
17+ import { TableHeaderRow } from '../../webComponents/TableHeaderRow/index.js' ;
18+ import { TableRow } from '../../webComponents/TableRow/index.js' ;
19+ import { TableSelectionSingle } from '../../webComponents/TableSelectionSingle/index.js' ;
20+ import { AnalyticalTable } from '../AnalyticalTable/index.js' ;
1221import { ObjectStatus } from './index.js' ;
1322import { cssVarToRgb , cypressPassThroughTestsFactory } from '@/cypress/support/utils' ;
1423
@@ -324,5 +333,97 @@ describe('ObjectStatus', () => {
324333 cy . get ( '[ui5-icon]' ) . should ( 'have.css' , 'height' , '24px' ) ;
325334 } ) ;
326335
336+ it ( 'active state in interactive lists and tables' , ( ) => {
337+ cy . document ( ) . then ( ( doc ) => {
338+ const style = doc . createElement ( 'style' ) ;
339+ style . textContent = `
340+ .interactive-table-row:active .object-status,
341+ .interactive-li[active] .object-status {
342+ --ui5wcr-object-status-icon-color: var(--sapList_Active_TextColor);
343+ color: var(--sapList_Active_TextColor);
344+ text-shadow: none;
345+ }
346+ ` ;
347+ doc . head . appendChild ( style ) ;
348+ } ) ;
349+
350+ const activeTextColor = cssVarToRgb ( ThemingParameters . sapList_Active_TextColor ) ;
351+ const atData = [ { os1 : 'ObjectStatus' , os2 : 'ObjectStatus' } ] ;
352+ const args = { state : ValueState . Positive , inverted : false , showDefaultIcon : true , children : 'ObjectStatus' } ;
353+ const atCols = [
354+ {
355+ accessor : 'os1' ,
356+ Header : 'ObjectStatus (controllable)' ,
357+ Cell : ( ) => < ObjectStatus { ...args } data-testid = "os-at" /> ,
358+ } ,
359+ {
360+ accessor : 'os2' ,
361+ Header : 'ObjectStatus ("Negative")' ,
362+ Cell : ( ) => < ObjectStatus { ...args } state = { 'Negative' } data-testid = "os-at-negative" /> ,
363+ } ,
364+ ] ;
365+
366+ cy . mount (
367+ < >
368+ < Table
369+ headerRow = {
370+ < TableHeaderRow >
371+ < TableHeaderCell > ObjectStatus (controllable)</ TableHeaderCell >
372+ < TableHeaderCell > ObjectStatus ("Negative")</ TableHeaderCell >
373+ </ TableHeaderRow >
374+ }
375+ features = { < TableSelectionSingle behavior = { 'RowOnly' } /> }
376+ >
377+ < TableRow rowKey = { '0' } className = { 'interactive-table-row' } >
378+ < TableCell >
379+ < ObjectStatus { ...args } className = { 'object-status' } data-testid = "os-table" />
380+ </ TableCell >
381+ < TableCell >
382+ < ObjectStatus { ...args } className = { 'object-status' } state = { 'Negative' } data-testid = "os-table-negative" />
383+ </ TableCell >
384+ </ TableRow >
385+ </ Table >
386+ < List selectionMode = "Single" >
387+ < ListItemCustom className = { 'interactive-li' } >
388+ < ObjectStatus { ...args } className = { 'object-status' } data-testid = "os-list" />
389+ </ ListItemCustom >
390+ </ List >
391+ < AnalyticalTable
392+ data = { atData }
393+ columns = { atCols }
394+ minRows = { 1 }
395+ selectionMode = { 'Single' }
396+ selectionBehavior = { 'RowOnly' }
397+ data-testid = "at"
398+ />
399+ </ > ,
400+ ) ;
401+
402+ cy . get ( '.interactive-table-row' ) . realMouseDown ( ) ;
403+ cy . findByTestId ( 'os-table' ) . should ( 'have.css' , 'color' , activeTextColor ) ;
404+ cy . findByTestId ( 'os-table' )
405+ . find ( '[data-component-name="ObjectStatusDefaultIcon"]' )
406+ . should ( 'have.css' , 'color' , activeTextColor ) ;
407+ cy . get ( '.interactive-table-row' ) . realMouseUp ( ) ;
408+
409+ cy . get ( '.interactive-li' ) . realMouseDown ( ) ;
410+ cy . findByTestId ( 'os-list' ) . should ( 'have.css' , 'color' , activeTextColor ) ;
411+ cy . findByTestId ( 'os-list' )
412+ . find ( '[data-component-name="ObjectStatusDefaultIcon"]' )
413+ . should ( 'have.css' , 'color' , activeTextColor ) ;
414+ cy . get ( '.interactive-li' ) . realMouseUp ( ) ;
415+
416+ cy . get ( '[data-testid="at"] [role="row"]' )
417+ . eq ( 1 )
418+ . realMouseDown ( { position : { x : 100 , y : 10 } } ) ; // don't click in the middle as there's the resizer
419+ cy . findByTestId ( 'os-at' ) . should ( 'have.css' , 'color' , activeTextColor ) ;
420+ cy . findByTestId ( 'os-at' )
421+ . find ( '[data-component-name="ObjectStatusDefaultIcon"]' )
422+ . should ( 'have.css' , 'color' , activeTextColor ) ;
423+ cy . get ( '[data-testid="at"] [role="row"]' )
424+ . eq ( 1 )
425+ . realMouseUp ( { position : { x : 100 , y : 10 } } ) ;
426+ } ) ;
427+
327428 cypressPassThroughTestsFactory ( ObjectStatus ) ;
328429} ) ;
0 commit comments