fix: recs skip btn event gets cancelled on redirection (#1058)
This commit is contained in:
committed by
GitHub
parent
2d11477037
commit
512deae883
@@ -19,7 +19,7 @@ import useAlgoliaRecommendations from './data/hooks/useAlgoliaRecommendations';
|
||||
import messages from './messages';
|
||||
import RecommendationsLargeLayout from './RecommendationsPageLayouts/LargeLayout';
|
||||
import RecommendationsSmallLayout from './RecommendationsPageLayouts/SmallLayout';
|
||||
import { trackRecommendationsViewed, trackSkipButtonClicked } from './track';
|
||||
import { LINK_TIMEOUT, trackRecommendationsViewed, trackSkipButtonClicked } from './track';
|
||||
import { DEFAULT_REDIRECT_URL } from '../data/constants';
|
||||
|
||||
const RecommendationsPage = () => {
|
||||
@@ -56,7 +56,7 @@ const RecommendationsPage = () => {
|
||||
const handleSkip = (e) => {
|
||||
e.preventDefault();
|
||||
trackSkipButtonClicked(userId);
|
||||
handleSkipRecommendationPage();
|
||||
setTimeout(() => { handleSkipRecommendationPage(); }, LINK_TIMEOUT);
|
||||
};
|
||||
|
||||
if (!registrationResponse) {
|
||||
|
||||
@@ -92,9 +92,10 @@ describe('RecommendationsPageTests', () => {
|
||||
|
||||
it('should redirect user if they click "Skip for now" button', () => {
|
||||
mockUseLocation();
|
||||
jest.useFakeTimers();
|
||||
const recommendationsPage = mount(reduxWrapper(<IntlRecommendationsPage />));
|
||||
recommendationsPage.find('.pgn__stateful-btn-state-default').first().simulate('click');
|
||||
|
||||
jest.advanceTimersByTime(300);
|
||||
expect(window.location.href).toEqual(redirectUrl);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user