chore: Hide banners on onboarding view (#8934)
--------- Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
19aef3e94b
commit
9911c5dc12
@@ -48,3 +48,13 @@ export const validateRouteAccess = (to, next, chatwootConfig = {}) => {
|
||||
|
||||
next();
|
||||
};
|
||||
|
||||
export const isOnOnboardingView = route => {
|
||||
const { name = '' } = route || {};
|
||||
|
||||
if (!name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return name.includes('onboarding_');
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { validateRouteAccess } from '../RouteHelper';
|
||||
import { validateRouteAccess, isOnOnboardingView } from '../RouteHelper';
|
||||
import { clearBrowserSessionCookies } from 'dashboard/store/utils/api';
|
||||
import { replaceRouteWithReload } from '../CommonHelper';
|
||||
import Cookies from 'js-cookie';
|
||||
@@ -67,3 +67,24 @@ describe('#validateRouteAccess', () => {
|
||||
expect(next).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isOnOnboardingView', () => {
|
||||
test('returns true for a route with onboarding name', () => {
|
||||
const route = { name: 'onboarding_welcome' };
|
||||
expect(isOnOnboardingView(route)).toBe(true);
|
||||
});
|
||||
|
||||
test('returns false for a route without onboarding name', () => {
|
||||
const route = { name: 'home' };
|
||||
expect(isOnOnboardingView(route)).toBe(false);
|
||||
});
|
||||
|
||||
test('returns false for a route with null name', () => {
|
||||
const route = { name: null };
|
||||
expect(isOnOnboardingView(route)).toBe(false);
|
||||
});
|
||||
|
||||
test('returns false for an undefined route object', () => {
|
||||
expect(isOnOnboardingView()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user