mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 17:45:32 -04:00
Update call out to sticky JS, with test for it
This commit is contained in:
committed by
Chris Hill-Scott
parent
0131f0c1b1
commit
1082a37750
@@ -24,10 +24,10 @@
|
|||||||
.on('scroll', this.maintainHeight);
|
.on('scroll', this.maintainHeight);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
window.GOVUK.stopScrollingAtFooter &&
|
window.GOVUK.stickAtBottomWhenScrolling &&
|
||||||
window.GOVUK.stopScrollingAtFooter.updateFooterTop
|
window.GOVUK.stickAtBottomWhenScrolling.recalculate
|
||||||
) {
|
) {
|
||||||
window.GOVUK.stopScrollingAtFooter.updateFooterTop();
|
window.GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maintainWidth();
|
this.maintainWidth();
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
const helpers = require('./support/helpers');
|
const helpers = require('./support/helpers');
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
// TODO: remove this when tests for sticky JS are written
|
||||||
|
require('../../app/assets/javascripts/stick-to-window-when-scrolling.js');
|
||||||
|
|
||||||
require('../../app/assets/javascripts/fullscreenTable.js');
|
require('../../app/assets/javascripts/fullscreenTable.js');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -171,15 +174,11 @@ describe('FullscreenTable', () => {
|
|||||||
|
|
||||||
describe("when it loads", () => {
|
describe("when it loads", () => {
|
||||||
|
|
||||||
beforeEach(() => {
|
test("it fixes the number column for each row without changing the semantics", () => {
|
||||||
|
|
||||||
// start module
|
// start module
|
||||||
window.GOVUK.modules.start();
|
window.GOVUK.modules.start();
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
test("it fixes the number column for each row without changing the semantics", () => {
|
|
||||||
|
|
||||||
tableFrame = document.querySelector('.fullscreen-scrollable-table');
|
tableFrame = document.querySelector('.fullscreen-scrollable-table');
|
||||||
numberColumnFrame = document.querySelector('.fullscreen-fixed-table');
|
numberColumnFrame = document.querySelector('.fullscreen-fixed-table');
|
||||||
|
|
||||||
@@ -189,6 +188,19 @@ describe('FullscreenTable', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("it calls the sticky JS to update any cached dimensions", () => {
|
||||||
|
|
||||||
|
const stickyJSSpy = jest.spyOn(window.GOVUK.stickAtBottomWhenScrolling, 'recalculate');
|
||||||
|
|
||||||
|
// start module
|
||||||
|
window.GOVUK.modules.start();
|
||||||
|
|
||||||
|
expect(stickyJSSpy.mock.calls.length).toBe(1);
|
||||||
|
|
||||||
|
stickyJSSpy.mockClear();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("the height of the table should fit the vertical space available to it", () => {
|
describe("the height of the table should fit the vertical space available to it", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user