diff --git a/src/components/tour/__snapshots__/tour_step.test.tsx.snap b/src/components/tour/__snapshots__/tour_step.test.tsx.snap index b8cfd6955e0..7bd94fd85b8 100644 --- a/src/components/tour/__snapshots__/tour_step.test.tsx.snap +++ b/src/components/tour/__snapshots__/tour_step.test.tsx.snap @@ -57,7 +57,7 @@ exports[`EuiTourStep can change the minWidth and maxWidth 1`] = ` style="left: 0px; top: 10px;" >
@@ -160,7 +160,7 @@ exports[`EuiTourStep can have subtitle 1`] = ` style="left: 0px; top: 10px;" > @@ -268,7 +268,7 @@ exports[`EuiTourStep can override the footer action 1`] = ` style="left: 0px; top: 10px;" > @@ -458,7 +458,7 @@ exports[`EuiTourStep is rendered 1`] = ` style="left: 0px; top: 10px;" > diff --git a/src/components/tour/tour.styles.ts b/src/components/tour/tour.styles.ts index 4cfe96a6c90..76680b4f298 100644 --- a/src/components/tour/tour.styles.ts +++ b/src/components/tour/tour.styles.ts @@ -14,7 +14,7 @@ import { COLOR_MODES_STANDARD, EuiThemeColorModeStandard, } from '../../services'; -import { logicalCSS, mathWithUnits } from '../../global_styling'; +import { logicalCSS, mathWithUnits, euiCanAnimate } from '../../global_styling'; import { openAnimationTiming } from '../popover/popover_panel/_popover_panel.styles'; import { popoverArrowSize } from '../popover/popover_arrow/_popover_arrow.styles'; @@ -26,19 +26,11 @@ const backgroundColor = (color: string, colorMode: EuiThemeColorModeStandard) => export const euiTourStyles = ({ euiTheme, colorMode }: UseEuiTheme) => ({ // Targets EuiPopoverPanel euiTour: css` - &[data-popover-open='true'] { - [class*='euiTourBeacon'] { - opacity: 1; // Must alter here otherwise the transition does not occur - } - } - - [data-popover-arrow='top'] { - &:before { - ${logicalCSS( - 'border-top-color', - backgroundColor(euiTheme.colors.lightestShade, colorMode) - )}; - } + [data-popover-arrow='top']::before { + ${logicalCSS( + 'border-top-color', + backgroundColor(euiTheme.colors.lightestShade, colorMode) + )}; } `, }); @@ -53,10 +45,16 @@ export const euiTourBeaconStyles = ({ euiTheme }: UseEuiTheme) => { euiTourBeacon: css` pointer-events: none; position: absolute; - opacity: 0; - transition: opacity 0s ${euiTheme.animation[openAnimationTiming]}; + ${euiCanAnimate} { + opacity: 0; + transition: opacity 0s ${euiTheme.animation[openAnimationTiming]}; + } + `, + isOpen: css` + ${euiCanAnimate} { + opacity: 1; // Must alter here otherwise the transition does not occur + } `, - // Positions right: css` ${logicalCSS('top', arrowHalfSize)}; @@ -84,7 +82,6 @@ export const euiTourHeaderStyles = ({ euiTheme }: UseEuiTheme) => ({ // Overriding default EuiPopoverTitle styles ${logicalCSS('margin-bottom', euiTheme.size.s)}; `, - // Elements euiTourHeader__title: css` // Removes extra margin applied to sibling EuiTitle's diff --git a/src/components/tour/tour_step.test.tsx b/src/components/tour/tour_step.test.tsx index ad24f2ff247..6d10ba56ea9 100644 --- a/src/components/tour/tour_step.test.tsx +++ b/src/components/tour/tour_step.test.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { requiredProps } from '../../test/required_props'; +import { shouldRenderCustomStyles } from '../../test/internal'; import { EuiTourStep } from './tour_step'; @@ -29,10 +30,24 @@ const config = { title: 'A demo', }; +const props = { ...config, ...steps[0], ...requiredProps }; + describe('EuiTourStep', () => { + shouldRenderCustomStyles( +