kopia lustrzana https://github.com/wagtail/wagtail
Only render tooltip link if there is a label for it
rodzic
aecc8f1a3b
commit
3186950de4
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue