PHP Classes

File: tests/js/setup.js

Recommend this page to a friend!
  Packages of Boss Ibrahim Mussa   Caelrik   tests/js/setup.js   Download  
File: tests/js/setup.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Caelrik
Build Web user interface from PHP components
Author: By
Last change:
Date: 8 days ago
Size: 1,269 bytes
 

 

Contents

Class file image Download
// Browser API stubs for jsdom. Tests running in the Node environment (themes.test.js) skip them. if (typeof window !== 'undefined') { // jsdom does not implement matchMedia, which Inputmask reads at import time. if (!window.matchMedia) { window.matchMedia = (query) => ({ matches: false, media: query, onchange: null, addListener() {}, removeListener() {}, addEventListener() {}, removeEventListener() {}, dispatchEvent: () => false, }); } // FilePond checks these at import time and refuses to run without them. if (!window.URL.createObjectURL) { window.URL.createObjectURL = () => 'blob:jsdom'; window.URL.revokeObjectURL = () => {}; } if (!window.CSS?.supports) { window.CSS = { ...window.CSS, supports: () => true }; } // jsdom has no canvas backend; axe-core probes it and only needs a null context. HTMLCanvasElement.prototype.getContext = () => null; // Under CommonJS (Jest), DataTables 3 no longer sets window.DataTable, while its Buttons // extension still reads window.DataTable.Buttons. The browser bundle uses the ES module // builds, which pass DataTable along instead. if (!window.DataTable) { window.DataTable = require('datatables.net-bs5'); } }