Files
wordpress-theme-aksrt/tests/widget-system/modal-scrollbar-compensation.test.cjs
T

16 lines
784 B
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.resolve(__dirname, '../..');
const runtime = fs.readFileSync(path.join(root, 'assets/js/core/modal-runtime.js'), 'utf8');
test('modal runtime compensates the removed scrollbar like Bootstrap setScrollbar', () => {
assert.match(runtime, /var gap = window\.innerWidth - html\.clientWidth;/);
assert.match(runtime, /scrollLock\.push\(padRight\(body, gap\)\)/);
assert.match(runtime, /var SCROLLBAR_FIXED = "\.nav-fixed \.header, \.float-right";/);
assert.match(runtime, /entry\.element\.style\.paddingRight = entry\.inline;/);
assert.doesNotMatch(runtime, /classList\.toggle\("aksrt-modal-runtime-open"/);
});