From f7475870a6b911eeba3c301bf0009e17d7b39030 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Sat, 9 Nov 2019 11:38:44 +0000 Subject: [PATCH] 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 --- packages/private/testing/src/render3.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/private/testing/src/render3.ts b/packages/private/testing/src/render3.ts index a63ab93d3f..c01c5875b5 100644 --- a/packages/private/testing/src/render3.ts +++ b/packages/private/testing/src/render3.ts @@ -37,7 +37,6 @@ */ export function withBody(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);