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:
Pete Bacon Darwin 2019-11-09 11:38:44 +00:00 committed by Kara Erickson
parent d8be830fce
commit f7475870a6
1 changed files with 1 additions and 2 deletions

View File

@ -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);