]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11058 open documentation and suggestions in a new tab (#535)
authorStas Vilchik <stas.vilchik@sonarsource.com>
Fri, 20 Jul 2018 07:32:27 +0000 (09:32 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 25 Jul 2018 18:21:21 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx
server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx
server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap

index 5cb06388326d3c027b4d3a25dc80dd72b2a20961..5d9cacc42e104866e08f29428a28f52f0b14782c 100644 (file)
@@ -58,7 +58,7 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
         {this.renderTitle(translate('embed_docs.suggestion'))}
         {this.props.suggestions.map((suggestion, index) => (
           <li key={index}>
-            <Link onClick={this.props.onClose} to={suggestion.link}>
+            <Link onClick={this.props.onClose} target="_blank" to={suggestion.link}>
               {suggestion.text}
             </Link>
           </li>
@@ -160,7 +160,7 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
         <ul className="menu abs-width-240">
           {this.renderSuggestions()}
           <li>
-            <Link onClick={this.props.onClose} to="/documentation">
+            <Link onClick={this.props.onClose} target="_blank" to="/documentation">
               {translate('embed_docs.documentation')}
             </Link>
           </li>
index 909c6a5d1d43c20df77c082545c8050d0852e6d2..21cf0bd5bed91e42ef886af10c0e27b4e178e99a 100644 (file)
@@ -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';
 
index 2092c80a14db426a2b529f63bddfd25a23c752c8..c7ca9442a890076d1feb21cf523f15d20d1105e4 100644 (file)
@@ -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 }
 );
index c324ca11c23c193eb6c0d08f808977ad3d7c6da5..abb6a2f122c7145aa756f299a17863cd22e00a36 100644 (file)
@@ -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