From aacae263dbfdf0c06aaab541b24f53df18faf649 Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Thu, 21 Nov 2019 15:07:25 +0100 Subject: [PATCH] Display settings menu for all type branches (still not for PR) --- .../nav/component/ComponentNavMenu.tsx | 2 +- .../__tests__/ComponentNavMenu-test.tsx | 24 +- .../ComponentNavMenu-test.tsx.snap | 256 ++++++++++++++++++ 3 files changed, 280 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx index 72030ec00cd..081582530b5 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx @@ -198,7 +198,7 @@ export class ComponentNavMenu extends React.PureComponent { renderAdministration() { const { branchLike } = this.props; - if (!this.getConfiguration().showSettings || (branchLike && !isMainBranch(branchLike))) { + if (!this.getConfiguration().showSettings || isPullRequest(branchLike)) { return null; } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx index 06362038183..bc27db6e1ef 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx @@ -19,7 +19,11 @@ */ import { shallow } from 'enzyme'; import * as React from 'react'; -import { mockBranch, mockMainBranch } from '../../../../../helpers/mocks/branch-like'; +import { + mockBranch, + mockMainBranch, + mockPullRequest +} from '../../../../../helpers/mocks/branch-like'; import { ComponentNavMenu } from '../ComponentNavMenu'; const mainBranch = mockMainBranch(); @@ -122,6 +126,24 @@ it('should work for a branch', () => { ); }); +it('should work for pull requests', () => { + [true, false].forEach(showSettings => + expect( + shallow( + + ) + ).toMatchSnapshot() + ); +}); + it('should work for all qualifiers', () => { ['TRK', 'VW', 'SVW', 'APP'].forEach(checkWithQualifier); expect.assertions(4); diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap index a9d856cf7c7..940c071c240 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap @@ -147,6 +147,104 @@ exports[`should work for a branch 1`] = ` project_activity.page + +
  • + + project_settings.page + +
  • +
  • + + project_branch_pull_request.page + +
  • +
  • + + project_baseline.page + +
  • +
  • + + webhooks.page + +
  • +
  • + + deletion.page + +
  • + + } + tagName="li" + > + +
    `; @@ -822,6 +920,164 @@ exports[`should work for all qualifiers 4`] = ` `; +exports[`should work for pull requests 1`] = ` + +
  • + + overview.page + +
  • +
  • + + issues.page + +
  • +
  • + + layout.measures + +
  • +
  • + + code.page + +
  • +
    +`; + +exports[`should work for pull requests 2`] = ` + +
  • + + overview.page + +
  • +
  • + + issues.page + +
  • +
  • + + layout.measures + +
  • +
  • + + code.page + +
  • +
    +`; + exports[`should work with extensions 1`] = `