// Integration test in a REAL DOM (jsdom): // - HTML comes from the running server's /partials/plugins (real template output) // - list_filter.js is loaded as a real script // - plugin data comes from the running server's real API // - interactions are real dispatched DOM events on the real pill/select nodes // This exercises HTML parsing, attribute reflection, event bubbling and // delegation for real — none of which the hand-rolled shim could vouch for. const fs = require('fs'); const http = require('http'); const { JSDOM, VirtualConsole } = require('jsdom'); const path = require('path'); const V3 = path.resolve(__dirname, '../../../web_interface/static/v3'); const BASE = process.env.BASE || 'http://localhost:5000'; function get(path) { return new Promise((res, rej) => { http.get(BASE + path, r => { let d = ''; r.on('data', c => d += c); r.on('end', () => res(d)); }) .on('error', rej); }); } (async () => { const partial = await get('/partials/plugins'); const installed = JSON.parse(await get('/api/v3/plugins/installed')).data.plugins; // Collected so an uncaught error inside a handler fails the run instead of // silently vanishing. const jsErrors = []; const vc = new VirtualConsole(); vc.on('jsdomError', e => jsErrors.push(String(e.message || e))); vc.on('error', (...a) => jsErrors.push('console.error: ' + a.join(' '))); const dom = new JSDOM( `