fix follow for contenteditable

This commit is contained in:
Shin'ya Ueoka 2017-10-12 21:18:52 +09:00
parent 10beccfab2
commit 4646e8b18d
3 changed files with 17 additions and 4 deletions

View file

@ -1,9 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<a href='#' >link</a>
<a id='visible_a' href='#' >link</a>
<a href='#' style='display:none'>invisible 1</a>
<a href='#' style='visibility:hidden'>invisible 2</a>
<i>not link<i>
<div id='editable_div_1' contenteditable>link</div>
<div id='editable_div_2' contenteditable='true'>link</div>
<div id='x' contenteditable='false'>link</div>
</body>
</html>

View file

@ -8,8 +8,11 @@ describe('FollowComponent', () => {
});
it('returns visible links', () => {
let links = FollowComponent.getTargetElements(window.document);
expect(links).to.have.lengthOf(1);
let targets = FollowComponent.getTargetElements(window.document);
expect(targets).to.have.lengthOf(3);
let ids = Array.prototype.map.call(targets, (e) => e.id);
expect(ids).to.include.members(['visible_a', 'editable_div_1', 'editable_div_2']);
});
});
});