@@ -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; |
@@ -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} /> | |||
); |
@@ -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> |