File tree Expand file tree Collapse file tree
test/functional/page_objects Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 */
88
99import { Position } from '@elastic/charts' ;
10- import Color from 'color ' ;
10+ import chroma from 'chroma-js ' ;
1111
1212import { FtrService } from '../ftr_provider_context' ;
1313
@@ -181,17 +181,17 @@ export class VisualizeChartPageObject extends FtrService {
181181 return items . some ( ( { color : c } ) => c === color ) ;
182182 }
183183
184- public async doesSelectedLegendColorExistForPie ( color : string ) {
184+ public async doesSelectedLegendColorExistForPie ( matchingColor : string ) {
185185 if ( await this . isNewLibraryChart ( pieChartSelector ) ) {
186+ const hexMatchingColor = chroma ( matchingColor ) . hex ( ) . toUpperCase ( ) ;
186187 const slices =
187188 ( await this . getEsChartDebugState ( pieChartSelector ) ) ?. partition ?. [ 0 ] ?. partitions ?? [ ] ;
188- return slices . some ( ( { color : c } ) => {
189- const rgbColor = new Color ( color ) . rgb ( ) . toString ( ) ;
190- return c === rgbColor ;
189+ return slices . some ( ( { color } ) => {
190+ return hexMatchingColor === chroma ( color ) . hex ( ) . toUpperCase ( ) ;
191191 } ) ;
192192 }
193193
194- return await this . testSubjects . exists ( `legendSelectedColor-${ color } ` ) ;
194+ return await this . testSubjects . exists ( `legendSelectedColor-${ matchingColor } ` ) ;
195195 }
196196
197197 public async expectError ( ) {
You can’t perform that action at this time.
0 commit comments