Skip to content

please export StyleSheetTestUtils #72

@RonHouben

Description

@RonHouben

Hi!
First of all thanks for making this interface!

Is it possible to export the following test-utility function from aphrodite:
StyleSheetTestUtils

This would remove the need to add the complete aphrodite dependency to a project while only actually using react-with-styles-interface-aphrodite, just for testing purposes.

I'm currently only using this interface for the react-dates dateRangePicker component but the tests are currently throwing this error:

styleTag = document.querySelector("style[data-aphrodite]")
                        ^
TypeError: Cannot read property 'querySelector' of null

This issue can be solved by adding the following for each test:

beforeEach(() => {
  StyleSheetTestUtils.suppressStyleInjection();
});
afterEach(() => {
  StyleSheetTestUtils.clearBufferAndResumeStyleInjection();
});

Since the StyleSheetTestUtils are not exported by react-with-styles-interface-aphrodite I'll need to install the complete aphrodite package just for testing, which feels like an overkill.

I'll prepare an PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions