From 156057a38b155b88d7ffcffec7b930659f2703c0 Mon Sep 17 00:00:00 2001 From: Oscar Shrimpton Date: Tue, 30 Jan 2018 19:11:56 +0000 Subject: [PATCH] bottomVisible() test --- test/bottomVisible/bottomVisible.test.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/test/bottomVisible/bottomVisible.test.js b/test/bottomVisible/bottomVisible.test.js index 1c8eae4be..dc8119130 100644 --- a/test/bottomVisible/bottomVisible.test.js +++ b/test/bottomVisible/bottomVisible.test.js @@ -1,12 +1,29 @@ const test = require('tape'); -const bottomVisible = require('./bottomVisible.js'); +// const bottomVisible = require('./bottomVisible.js'); + +// Make the fake properties used by the function +const document = { + documentElement: { + clientHeight: 1080, + scrollHeight: 1080 + } +}; + +const window = { + scrollY: 2160 +} + +// Override the function to use these fake properties +const bottomVisible = () => +document.documentElement.clientHeight + window.scrollY >= +(document.documentElement.scrollHeight || document.documentElement.clientHeight); test('Testing bottomVisible', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof bottomVisible === 'function', 'bottomVisible is a Function'); //t.deepEqual(bottomVisible(args..), 'Expected'); - //t.equal(bottomVisible(args..), 'Expected'); + t.true(bottomVisible(), 'Produces the correct result'); //t.false(bottomVisible(args..), 'Expected'); //t.throws(bottomVisible(args..), 'Expected'); t.end();