enzymejs / enzymejs/enzyme

Error: Failed to parse `:not` attribute value selector

Open
#2,268 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
19.8k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

### Current behavior

```ts
wrapper.find(`[role="option"]`) // works
wrapper.find(`[data-itemvalue="apple"]`) // works
wrapper.find(`[role="option"]:not([data-itemvalue="apple"])`) // Error: Failed to parse selector: [role="option"]:not([data-itemvalue="apple"])
```

### Expected behavior

Expected all three examples to work -- @ljharb comments in https://github.com/airbnb/enzyme/issues/456#issuecomment-455670304 that :not selector was added in #1086 and "should be in all versions of enzyme 3."

### Your environment
Jasmine running in Wallaby

#### API

- [ ] shallow
- [x] mount
- [ ] render

#### Version

| library | version
| ------------------- | -------
| enzyme | 3.9.0
| react | 16.8.6
| react-dom | 16.8.6
| react-test-renderer | 16.8.6
| adapter (below) | 1.12.1

#### Adapter

- [x] enzyme-adapter-react-16
- [ ] enzyme-adapter-react-16.3
- [ ] enzyme-adapter-react-16.2
- [ ] enzyme-adapter-react-16.1
- [ ] enzyme-adapter-react-15
- [ ] enzyme-adapter-react-15.4
- [ ] enzyme-adapter-react-14
- [ ] enzyme-adapter-react-13
- [ ] enzyme-adapter-react-helper
- [ ] others ( )

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three wrapper.find examples with mount and the enzyme-adapter-react-16 configuration described in the issue. Trace the selector-parsing path used by the :not attribute-value selector; done means all three selectors work without a parse error and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.