Extract Aphrodite-management test code to testUtil (#99)

Summary:
Any tests that render Aphrodite-styled React elements will need to do
this, so it’s nice to have the code in one place.

wchargin-branch: aphrodite-testutils
This commit is contained in:
William Chargin 2018-03-20 17:35:26 -07:00 committed by GitHub
parent 5b420c6294
commit 61624a5dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -2,15 +2,7 @@ import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import App from "./App"; import App from "./App";
import {StyleSheetTestUtils} from "aphrodite/no-important"; require("./testUtil").configureAphrodite();
beforeEach(() => {
StyleSheetTestUtils.suppressStyleInjection();
});
afterEach(() => {
StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
});
// Check that PropTypes check out. // Check that PropTypes check out.
it("renders without crashing", () => { it("renders without crashing", () => {

View File

@ -0,0 +1,11 @@
import {StyleSheetTestUtils} from "aphrodite/no-important";
export function configureAphrodite() {
beforeEach(() => {
StyleSheetTestUtils.suppressStyleInjection();
});
afterEach(() => {
StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
});
}