/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/iframe-srcdoc-entry/test.js
21 строка
838 B
Sebastian Beltran
feat(html): implement asset URL rewriting for <iframe srcdoc> in HTML (#21226)
23 июн 2026, 23:33
Не верифицирован
23 июн 2026, 23:33
164a6ff
Код
Авторство
О чём код?
const fs = require("fs"); const path = require("path"); it("emits the entry .html (extract default) but not the inline srcdoc module", () => { const files = fs.readdirSync(__dirname); const htmlFiles = files.filter((f) => f.endsWith(".html")); // The not-`"inline"` branch: the HTML entry is emitted as a standalone file. expect(htmlFiles).toContain("page.html"); // The `"inline"` branch: the nested `<iframe srcdoc>` document must NOT emit // its own `.html`, so the entry page is the only HTML file. expect(htmlFiles).toEqual(["page.html"]); // The srcdoc asset is still rewritten in place inside the emitted page. const page = fs.readFileSync(path.resolve(__dirname, "page.html"), "utf-8"); expect(page).toContain( 'srcdoc="<img src="handled-image.png">"' ); expect(page).not.toContain("./image.png"); });