Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-06-02 15:04:13 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-06-02 15:04:13 -0700
commit1360a4b944c4c2f0fcdf4bcf2aaaaaac204bb532 (patch)
tree2b91b697337b7fbfc643344c3bb5e667999d055c /test/integration/helpers.cjs
parentafda283d49ae0dfda4d7af0a8556c3618675fefa (diff)
Add a test helper to build the svg document
Diffstat (limited to 'test/integration/helpers.cjs')
-rw-r--r--test/integration/helpers.cjs8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/integration/helpers.cjs b/test/integration/helpers.cjs
index d38f1b6..10b0dc6 100644
--- a/test/integration/helpers.cjs
+++ b/test/integration/helpers.cjs
@@ -51,10 +51,10 @@ global.page = {
}
};
-global.mockResponse = async function mockResponse(driver, urlPath, template, createFn) {
+global.mockResponse = async function mockResponse(driver, urlPath, template, buildFn) {
const connection = driver.createCDPConnection('page');
const dom = new JSDOM(template);
- const contents = createFn(dom.window.document);
+ const contents = buildFn(dom.window.document);
const httpResponse = new HttpResponse(url(urlPath));
httpResponse.body = contents;
@@ -86,3 +86,7 @@ global.selectCounter = function (counter) {
counter.querySelector('.counter').classList.add('selected');
return counter;
}
+
+global.svgDocument = function (document) {
+ return `<?xml version="1.0" standalone="yes"?>\n` + document.querySelector('svg').outerHTML;
+}