test: cleanup `document` "after" each test (#33712)
It looks like there was a typo when it originally was written. As it works right now, the `beforeEach` and `afterEach` cancel each other out. But then `ensureDocument()` is called anyway in the `withBody()` function. With this change there is no need to call `ensureDocument() in the `withBody() function. PR Close #33712
This commit is contained in:
parent
d8be830fce
commit
f7475870a6
|
@ -37,7 +37,6 @@
|
|||
*/
|
||||
export function withBody<T extends Function>(html: string, blockFn: T): T {
|
||||
return function(done: DoneFn) {
|
||||
ensureDocument();
|
||||
if (typeof blockFn === 'function') {
|
||||
document.body.innerHTML = html;
|
||||
const blockReturn = blockFn();
|
||||
|
@ -120,4 +119,4 @@ export function cleanupDocument(): void {
|
|||
}
|
||||
|
||||
if (typeof beforeEach == 'function') beforeEach(ensureDocument);
|
||||
if (typeof afterEach == 'function') beforeEach(cleanupDocument);
|
||||
if (typeof afterEach == 'function') afterEach(cleanupDocument);
|
||||
|
|
Loading…
Reference in New Issue