-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce StyleSheetTestUtils to make writing tests for Aphrodite easier
Imagine you're trying to introduce Aphrodite gradually into an existing codebase that already has extensive test coverage for rendering components. If those tests are run in node without any fake DOM being constructed, your previously working tests will now fail with the following error: Error: Cannot automatically buffer without a document The introduction of StyleSheetTestUtils makes it easy to suppress such problems by preventing Aphrodite from trying to interact with the DOM at all. The new API would be usable in your tests like so (using Mocha syntax for demonstration purposes): import { StyleSheetTestUtils } from 'aphrodite'; beforeEach(() => { StyleSheetTestUtils.suppressStyleInjection(); }); afterEach(() => { StyleSheetTestUtils.clearBufferAndResumeStyleInjection(); }); Meant to solve the problem presented in #41
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters