Only render tooltip link if there is a label for it

pull/4795/merge
Thibaud Colas 2018-10-07 22:06:28 +03:00
rodzic aecc8f1a3b
commit 3186950de4
2 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -101,7 +101,7 @@ class TooltipEntity extends Component {
closeOnResize
>
<Tooltip target={showTooltipAt} direction="top">
{(
{label ? (
<a
href={url}
title={url}
@ -111,7 +111,7 @@ class TooltipEntity extends Component {
>
{shortenLabel(label)}
</a>
)}
) : null}
<button
className="button Tooltip__button"

Wyświetl plik

@ -37,6 +37,23 @@ describe('TooltipEntity', () => {
.text()).toBe('www.example.example.…');
});
it('empty label', () => {
expect(shallow((
<TooltipEntity
entityKey="1"
onEdit={() => {}}
onRemove={() => {}}
icon="#icon-test"
url="https://www.example.com/"
label=""
>
test
</TooltipEntity>
)).setState({
showTooltipAt: document.createElement('div').getBoundingClientRect(),
}).find('Tooltip a').length).toBe(0);
});
it('#openTooltip', () => {
const wrapper = shallow((
<TooltipEntity