diff --git a/tests/javascripts/stick-to-window-when-scrolling.test.js b/tests/javascripts/stick-to-window-when-scrolling.test.js new file mode 100644 index 000000000..863cc7f45 --- /dev/null +++ b/tests/javascripts/stick-to-window-when-scrolling.test.js @@ -0,0 +1,433 @@ +const helpers = require('./support/helpers'); +const STOP_PADDING = 10; +function getScreenItemBottomPosition (screenItem) { + return screenItem.offsetTop + screenItem.offsetHeight; +}; + +beforeAll(() => { + require('../../app/assets/javascripts/stick-to-window-when-scrolling.js'); +}); + +afterAll(() => { + require('./support/teardown.js'); +}); + +describe("Stick to top/bottom of window when scrolling", () => { + + let screenMock; + + describe("If intending to stick to the top", () => { + + let inputForm; + let formFooter; + let footer; + let windowHeight; + + beforeEach(() => { + + document.body.innerHTML = ` +