diff options
author | Jean-Baptiste Lievremont <jeanbaptiste.lievremont@sonarsource.com> | 2020-12-04 16:01:46 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-12-07 20:07:01 +0000 |
commit | 0a6b1e71cd0b946307cc4c60820d1eca7a80881b (patch) | |
tree | 6ba8ebbe4a6fd14850ba03e290ff14eb08d965fd /server/sonar-web/src/main | |
parent | 6b9d918dc57c2175dfcf2bfc719a8fe5e22661fb (diff) | |
download | sonarqube-0a6b1e71cd0b946307cc4c60820d1eca7a80881b.tar.gz sonarqube-0a6b1e71cd0b946307cc4c60820d1eca7a80881b.zip |
SONAR-14111 Fix label in IDE selection dropdown when description is empty
Diffstat (limited to 'server/sonar-web/src/main')
3 files changed, 13 insertions, 13 deletions
diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx index 1df109c6fad..0e8fdce7fce 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotOpenInIdeOverlay.tsx @@ -30,12 +30,16 @@ export const HotspotOpenInIdeOverlay = ({ }) => ides.length > 1 ? ( <ul className="menu"> - {ides.map(ide => ( - <li key={ide.port}> - <a href="#" onClick={() => onIdeSelected(ide)}> - {ide.ideName} - {ide.description} - </a> - </li> - ))} + {ides.map(ide => { + const { ideName, description } = ide; + const label = ideName + (description ? ` - ${description}` : ''); + return ( + <li key={ide.port}> + <a href="#" onClick={() => onIdeSelected(ide)}> + {label} + </a> + </li> + ); + })} </ul> ) : null; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx index d131f21f455..b0d5ddeef54 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/HotspotOpenInIdeOverlay-test.tsx @@ -39,7 +39,7 @@ it('should render nothing with fewer than 2 IDE', () => { it('should render menu and select the right IDE', () => { const onIdeSelected = jest.fn(); const ide1 = { port: 0, ideName: 'Polop', description: 'Plouf' }; - const ide2 = { port: 1, ideName: 'Foo', description: 'Bar' }; + const ide2 = { port: 1, ideName: 'Foo', description: '' }; const wrapper = shallow( <HotspotOpenInIdeOverlay ides={[ide1, ide2]} onIdeSelected={onIdeSelected} /> ); diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotOpenInIdeOverlay-test.tsx.snap b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotOpenInIdeOverlay-test.tsx.snap index 7c4ffa6c9ef..47edfaa8c8f 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotOpenInIdeOverlay-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/__tests__/__snapshots__/HotspotOpenInIdeOverlay-test.tsx.snap @@ -11,9 +11,7 @@ exports[`should render menu and select the right IDE 1`] = ` href="#" onClick={[Function]} > - Polop - - - Plouf + Polop - Plouf </a> </li> <li @@ -24,8 +22,6 @@ exports[`should render menu and select the right IDE 1`] = ` onClick={[Function]} > Foo - - - Bar </a> </li> </ul> |