import { imageCompare } from '../common/image-compare' ; import { FocusIndicatorButtonsPage } from './focus-indicator.po.spec' ; describe ( 'Focus Indicator Tests' , ( ) => { let page = new FocusIndicatorButtonsPage ( ) ; beforeEach ( async ( ) => { await page . getPage ( ) ; } ) ; it ( 'should have correct initial states' , async ( ) => { expect ( await page . getFocusIndicatorClass ( ) ) . toBe ( true ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( false ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'false' ) ; expect ( await imageCompare ( 'focus-indicator-initial' ) ) . toEqual ( 0 ) ; } ) ; it ( 'should not focus on click when mouseFocusIndicator: false' , async ( ) => { await page . target . click ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( false ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'false' ) ; } ) ; it ( 'should focus on click when mouseFocusIndicator: true' , async ( ) => { await page . mouseToggle . click ( ) ; await page . target . click ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( true ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'true' ) ; } ) ; it ( 'should not focus on programmatic focus when programmaticFocusIndicator: false' , async ( ) => { await page . setProgrammaticFocus ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( false ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'false' ) ; } ) ; it ( 'should focus on programmatic focus when programmaticFocusIndicator: true' , async ( ) => { await page . programmaticToggle . click ( ) ; await page . setProgrammaticFocus ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( true ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'true' ) ; expect ( await imageCompare ( 'focus-indicator-focused' ) ) . toEqual ( 0 ) ; } ) ; it ( 'should not focus on keyboard when keyboardFocusIndicator: false' , async ( ) => { await page . setContainerFocused ( ) ; await page . pressTab ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( false ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'false' ) ; } ) ; it ( 'should focus on keyboard when keyboardFocusIndicator: true' , async ( ) => { await page . keyboardToggle . click ( ) ; await page . setContainerFocused ( ) ; await page . pressTab ( ) ; expect ( await page . getFocusIndicatorActiveClass ( ) ) . toBe ( true ) ; expect ( await page . getIndicatorLabel ( ) ) . toBe ( 'true' ) ; } ) ; } ) ;