Skip to content

Commit

Permalink
Merge branch 'master' into delete-debugging-props
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jun 9, 2019
2 parents 36deb54 + f90baf9 commit 26a35f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test-utils/src/index.js
Expand Up @@ -36,6 +36,7 @@ export function act(cb) {
rerender();
}

teardown();
options.requestAnimationFrame = previousRequestAnimationFrame;
}

Expand All @@ -53,4 +54,7 @@ export function teardown() {
options.debounceRendering = options.__test__previousDebounce;
delete options.__test__previousDebounce;
}
else {
options.debounceRendering = undefined;
}
}
16 changes: 16 additions & 0 deletions test-utils/test/shared/act.test.js
Expand Up @@ -16,6 +16,7 @@ describe('act', () => {

afterEach(() => {
teardown(scratch);
options.debounceRendering = undefined;
});

it('should reset options after act finishes', () => {
Expand Down Expand Up @@ -127,4 +128,19 @@ describe('act', () => {
expect(options.requestAnimationFrame).to.equal(spy);
expect(spy).to.not.be.called;
});

it('should restore options.debounceRendering', () => {
const spy = sinon.spy();

options.debounceRendering = spy;
act(() => null);

expect(options.debounceRendering).to.equal(spy);
expect(spy).to.not.be.called;
});

it('should restore options.debounceRendering when it was undefined before', () => {
act(() => null);
expect(options.debounceRendering).to.equal(undefined);
});
});

0 comments on commit 26a35f6

Please sign in to comment.