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