import fs from 'fs'; import path from 'path'; /* * The document page's embedded viewer, and which of them is withheld in a filtering theme. * * This is the surface that measured 55% non-red pixels in night mode: a PDF is drawn by the * browser in its own out-of-process viewer, which the theme's SVG filter never reaches, so it * arrives in full color however the iframe is styled. The EPUB viewer is a document of our own * and tints correctly, so gating it would hide something for no reason. * * Read off the source. DocPage renders only after `useDoc` resolves a file group and reaches * the embed through several branches of file selection; a render test here would assert more * about the mocks than about the wiring. ui.test.js covers what MediaGate itself does, and * FilePreview.test.js covers the same contract on the other embed surface. */ const source = fs.readFileSync(path.join(__dirname, 'Docs.js'), 'utf8'); describe('DocPage embed gating (source contract)', () => { it('wraps the embedded viewer in a MediaGate', () => { // The iframe must not be reachable without passing through the gate. const embed = source.match(/]*>\s*