From c76da4346704fdc8a2ce5ecedb1e0461186ba222 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 20 Jul 2018 09:32:27 +0200 Subject: [PATCH] SONAR-11058 open documentation and suggestions in a new tab (#535) --- .../js/app/components/embed-docs-modal/EmbedDocsPopup.tsx | 4 ++-- .../app/components/embed-docs-modal/SuggestionsProvider.tsx | 2 +- .../embed-docs-modal/__tests__/SuggestionsProvider-test.tsx | 6 ++++-- .../__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap | 6 ++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx index 5cb06388326..5d9cacc42e1 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx @@ -58,7 +58,7 @@ export default class EmbedDocsPopup extends React.PureComponent { {this.renderTitle(translate('embed_docs.suggestion'))} {this.props.suggestions.map((suggestion, index) => (
  • - + {suggestion.text}
  • @@ -160,7 +160,7 @@ export default class EmbedDocsPopup extends React.PureComponent {
      {this.renderSuggestions()}
    • - + {translate('embed_docs.documentation')}
    • diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx index 909c6a5d1d4..21cf0bd5bed 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import * as PropTypes from 'prop-types'; // eslint-disable-next-line import/no-extraneous-dependencies -import * as suggestionsJson from 'Docs/EmbedDocsSuggestions.json'; +import suggestionsJson from 'Docs/EmbedDocsSuggestions.json'; import { SuggestionsContext } from './SuggestionsContext'; import { isSonarCloud } from '../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx index 2092c80a14d..c7ca9442a89 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx @@ -25,8 +25,10 @@ import { isSonarCloud } from '../../../../helpers/system'; jest.mock( 'Docs/EmbedDocsSuggestions.json', () => ({ - pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }], - pageB: [{ link: '/qux', text: 'Qux' }] + default: { + pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }], + pageB: [{ link: '/qux', text: 'Qux' }] + } }), { virtual: true } ); diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap index c324ca11c23..abb6a2f122c 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap @@ -18,6 +18,7 @@ exports[`should display correct links for SonarCloud 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="#" > foo @@ -30,6 +31,7 @@ exports[`should display correct links for SonarCloud 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="#" > bar @@ -44,6 +46,7 @@ exports[`should display correct links for SonarCloud 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="/documentation" > embed_docs.documentation @@ -140,6 +143,7 @@ exports[`should display suggestion links 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="#" > foo @@ -152,6 +156,7 @@ exports[`should display suggestion links 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="#" > bar @@ -166,6 +171,7 @@ exports[`should display suggestion links 1`] = ` onClick={[MockFunction]} onlyActiveOnIndex={false} style={Object {}} + target="_blank" to="/documentation" > embed_docs.documentation -- 2.39.5