Skip to content

Commit 2c81da4

Browse files
vrtmrzjanl
authored andcommitted
(pouchdb#8581) - Fix test
Fix format issues.
1 parent 3d36d2d commit 2c81da4

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

‎tests/integration/test.issue8581.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,27 @@ function runTests() {
2121
callbackFnName = "callback" + Date.now();
2222
iframe = window.document.createElement("iframe", { src: "about:blank" });
2323
window.document.body.appendChild(iframe);
24-
})
24+
});
2525

2626
it('#8581 Should not raise error', function (done) {
2727
window[callbackFnName] = (err) => {
28-
if (timeout) timeout = clearTimeout(timeout);
28+
if (timeout) {
29+
timeout = clearTimeout(timeout);
30+
}
2931
done(err);
3032
window[callbackFnName] = () => { };
3133
};
32-
let timeout = setTimeout(() => callbackFnName in window && window[callbackFnName](new Error(`Timed out`)), 500);
34+
let timeout = setTimeout(
35+
() => {
36+
if (callbackFnName in window) {
37+
window[callbackFnName](new Error(`Timed out`));
38+
}
39+
}
40+
, 500);
3341
const target = iframe.contentDocument;
3442
const scriptElement = target.createElement("script");
35-
scriptElement.innerHTML = `localStorage.setItem("Hello",new Date());setTimeout(window.parent.${callbackFnName},100);`;
43+
scriptElement.innerHTML =
44+
`localStorage.setItem("Hello",new Date());setTimeout(window.parent.${callbackFnName},100);`;
3645
target.body.appendChild(scriptElement);
3746
});
3847
});

0 commit comments

Comments
 (0)