enzymejs/enzyme

Support escaped characters in selectors

Open

#1218 opened on Oct 3, 2017

View on GitHub
 (14 comments) (0 reactions) (0 assignees)JavaScript (19,979 stars) (2,016 forks)batch import
feature requesthelp wanted

Description

Edit from maintainers: this issue was repurposed, see https://github.com/airbnb/enzyme/issues/1218#issuecomment-334489966

Settings

  • React v16
  • Enzyme v3

When i have a component which has a className prop with special character / or @ , it doesnt select anything. I feel enzyme breaks and doesn't continue with the lines after this selector.

Example

const sampleComponent = () => (
    <div className="u-width-1/2@small">
        Something here
    </div>
);

If I have the above component and if I want to select the div containing u-width-1/2@small I tried

const component = shallow(<sampleComponent />);
component.find('.u-width-1/2@small') // This line seems to fail due to error in selector
/* Anything after this doesnt execute */

Contributor guide