Browse Source

SONAR-10871 Do not automatically display onboarding tutorial for documentation routes

tags/7.5
Grégoire Aubert 6 years ago
parent
commit
79dc6a5cff

+ 1
- 1
server/sonar-web/src/main/js/app/components/GlobalContainer.tsx View File

@@ -35,7 +35,7 @@ export default function GlobalContainer(props: Props) {
return (
<SuggestionsProvider>
{({ suggestions }) => (
<StartupModal>
<StartupModal location={props.location}>
<div className="global-container">
<div className="page-wrapper" id="container">
<div className="page-container">

+ 3
- 1
server/sonar-web/src/main/js/app/components/StartupModal.tsx View File

@@ -42,6 +42,7 @@ interface DispatchProps {
}

interface OwnProps {
location: { pathname: string };
children?: React.ReactNode;
}

@@ -120,7 +121,8 @@ export class StartupModal extends React.PureComponent<Props, State> {
};

tryAutoOpenOnboarding = () => {
if (this.props.currentUser.showOnboardingTutorial) {
const { currentUser, location } = this.props;
if (currentUser.showOnboardingTutorial && !location.pathname.startsWith('documentation')) {
this.setState({ automatic: true });
this.openOnboarding();
}

+ 9
- 0
server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx View File

@@ -80,6 +80,14 @@ it('should render only the children', async () => {
(get as jest.Mock<any>).mockReturnValueOnce('date');
(differenceInDays as jest.Mock<any>).mockReturnValueOnce(0);
await shouldNotHaveModals(getWrapper());

await shouldNotHaveModals(
getWrapper({
canAdmin: false,
currentUser: { ...LOGGED_IN_USER, showOnboardingTutorial: true },
location: { pathname: 'documentation/index' }
})
);
});

it('should render license prompt', async () => {
@@ -130,6 +138,7 @@ function getWrapper(props = {}) {
canAdmin={true}
currentEdition={EditionKey.enterprise}
currentUser={LOGGED_IN_USER}
location={{ pathname: 'foo/bar' }}
skipOnboarding={jest.fn()}
{...props}>
<div />

Loading…
Cancel
Save