diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-16 21:48:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-16 21:48:41 +0900 |
commit | 33a97a0e8c18c099b23cd50a832242985837edca (patch) | |
tree | 73a15a1a39b41e0c42ea79a2d521d63865f83f06 /test/content/components/common/follow.test.js | |
parent | 7ced514f83a69f557c19c1eb24ad792b3f2ace89 (diff) | |
parent | cf3a1eaf16d7dd5c71de57901415fb147793aa56 (diff) |
Merge pull request #61 from ueokande/multi-frame-following
Multi frame following
Diffstat (limited to 'test/content/components/common/follow.test.js')
-rw-r--r-- | test/content/components/common/follow.test.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/content/components/common/follow.test.js b/test/content/components/common/follow.test.js new file mode 100644 index 0000000..1fc935e --- /dev/null +++ b/test/content/components/common/follow.test.js @@ -0,0 +1,21 @@ +import { expect } from "chai"; +import FollowComponent from 'content/components/common/follow'; + +describe('FollowComponent', () => { + describe('#getTargetElements', () => { + beforeEach(() => { + document.body.innerHTML = __html__['test/content/components/common/follow.html']; + }); + + it('returns visible links', () => { + let targets = FollowComponent.getTargetElements( + window, + { width: window.innerWidth, height: window.innerHeight }, + { x: 0, y: 0 }); + 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']); + }); + }); +}); |