diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-04-26 15:31:42 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-05-03 20:20:50 +0200 |
commit | 4a31f1ff8f39bdd5189d75f420ab052ec5a75cd6 (patch) | |
tree | bdb0ff5255e953a466c67629e214f6f0e544fee3 /server/sonar-web/src/main/js/apps | |
parent | 4c2edb7abdb283c6bed56ce6be32304f67529045 (diff) | |
download | sonarqube-4a31f1ff8f39bdd5189d75f420ab052ec5a75cd6.tar.gz sonarqube-4a31f1ff8f39bdd5189d75f420ab052ec5a75cd6.zip |
SONAR-10609 Rework the global help modal to a dropdown (#177)
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
3 files changed, 11 insertions, 16 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx index cd9547a11b4..2f164bcc170 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx @@ -24,6 +24,7 @@ import { omitBy } from 'lodash'; import PageHeader from './PageHeader'; import ProjectsList from './ProjectsList'; import PageSidebar from './PageSidebar'; +import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import Visualizations from '../visualizations/Visualizations'; import { CurrentUser, isLoggedIn } from '../../../app/types'; import handleRequiredAuthentication from '../../../app/utils/handleRequiredAuthentication'; @@ -317,6 +318,7 @@ export default class AllProjects extends React.PureComponent<Props, State> { render() { return ( <div className="layout-page projects-page" id="projects-page"> + <Suggestions suggestions="projects" /> <Helmet title={translate('projects.page')} /> {this.renderSide()} diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx index e3fac302fb4..b6339e6c3fb 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/AllProjects-test.tsx @@ -19,7 +19,7 @@ */ /* eslint-disable import/order */ import * as React from 'react'; -import { mount, shallow } from 'enzyme'; +import { shallow } from 'enzyme'; import AllProjects, { Props } from '../AllProjects'; import { get, save } from '../../../../helpers/storage'; @@ -71,7 +71,7 @@ it('renders', () => { }); it('fetches projects', () => { - mountRender(); + shallowRender(); expect(fetchProjects).lastCalledWith( { coverage: undefined, @@ -104,7 +104,7 @@ it('redirects to the saved search', () => { (key: string) => (key === 'sonarqube.projects.view' ? 'leak' : null) ); const replace = jest.fn(); - mountRender({}, jest.fn(), replace); + shallowRender({}, jest.fn(), replace); expect(replace).lastCalledWith({ pathname: '/projects', query: { view: 'leak' } }); }); @@ -161,19 +161,6 @@ it('changes perspective to risk visualization', () => { expect(save).toHaveBeenCalledWith('sonarqube.projects.visualization', 'risk', undefined); }); -function mountRender(props: any = {}, push: Function = jest.fn(), replace: Function = jest.fn()) { - return mount( - <AllProjects - currentUser={{ isLoggedIn: true }} - fetchProjects={jest.fn()} - isFavorite={false} - location={{ pathname: '/projects', query: {} }} - {...props} - />, - { context: { router: { push, replace } } } - ); -} - function shallowRender( props: Partial<Props> = {}, push: Function = jest.fn(), diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap index 3dd798e4094..ec7df22da87 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap @@ -5,6 +5,9 @@ exports[`renders 1`] = ` className="layout-page projects-page" id="projects-page" > + <Suggestions + suggestions="projects" + /> <HelmetWrapper defer={true} encodeSpecialCharacters={true} @@ -134,6 +137,9 @@ exports[`renders 2`] = ` className="layout-page projects-page" id="projects-page" > + <Suggestions + suggestions="projects" + /> <HelmetWrapper defer={true} encodeSpecialCharacters={true} |