Skip to content

Commit

Permalink
Merge pull request #7552 from Automattic/fix/highlight-not-removed-tour
Browse files Browse the repository at this point in the history
Fix highlight not removed after closing tour
  • Loading branch information
Imran92 committed Mar 20, 2024
2 parents f813af2 + 106c6a7 commit e8cf694
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/admin/tour/components/sensei-tour-kit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ function SenseiTourKit( {

const config = {
steps,
closeHandler: () => setTourShowStatus( false, true, tourName ),
closeHandler: () => {
removeHighlightClasses();
setTourShowStatus( false, true, tourName );
},
options: {
effects: {
spotlight: null,
Expand Down
7 changes: 7 additions & 0 deletions assets/admin/tour/components/sensei-tour-kit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import SenseiTourKit from './index';
import getTourSteps from '../../course-tour/steps';
import { removeHighlightClasses } from '../../helper';
/**
* External dependencies
*/
Expand All @@ -26,6 +27,8 @@ jest.mock( '@wordpress/data', () => ( {
useSelect: jest.fn().mockImplementation( () => ( {} ) ),
} ) );

jest.mock( '../../helper' );

const mockFunction = jest.fn();

describe( 'SenseiTourKit', () => {
Expand Down Expand Up @@ -105,6 +108,9 @@ describe( 'SenseiTourKit', () => {

test( 'should close the tour when closeHandler is called', () => {
const setTourShowStatus = jest.fn();
const removeHighlight = jest.fn();

removeHighlightClasses.mockImplementation( removeHighlight );

useDispatch.mockReturnValue( { setTourShowStatus } );

Expand All @@ -119,6 +125,7 @@ describe( 'SenseiTourKit', () => {
true,
'test-tour'
);
expect( removeHighlight ).toHaveBeenCalled();
} );

test( 'should call the event log function when step is viewed', () => {
Expand Down

0 comments on commit e8cf694

Please sign in to comment.