diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/content/follow.html | 9 | ||||
-rw-r--r-- | test/content/follow.test.js | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/content/follow.html b/test/content/follow.html new file mode 100644 index 0000000..6bd8f87 --- /dev/null +++ b/test/content/follow.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> + <body> + <a href='#' >link</a> + <a href='#' style='display:none'>invisible 1</a> + <a href='#' style='visibility:hidden'>invisible 2</a> + <i>not link<i> + </body> +</html> diff --git a/test/content/follow.test.js b/test/content/follow.test.js index eb3d679..fd4f0bc 100644 --- a/test/content/follow.test.js +++ b/test/content/follow.test.js @@ -11,4 +11,15 @@ describe('Follow class', () => { expect(Follow.codeChars([])).to.be.equal(''); }); }); + + describe('#getTargetElements', () => { + beforeEach(() => { + document.body.innerHTML = __html__['test/content/follow.html']; + }); + + it('returns visible links', () => { + let links = Follow.getTargetElements(window.document); + expect(links).to.have.lengthOf(1); + }); + }); }); |