Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support :focus pseudo selector in mount #1965

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

chenesan
Copy link
Contributor

@chenesan chenesan commented Jan 5, 2019

Fixes #1709 by compare document.activeElement and host DOM node of rst node. Work with DOMElement and component element.

Note that this only works with mount, not works with shallow. Also it won't work with simulate:

const wrapper = mount(<input type="text" />)
wrapper.simulate('focus')
// will print false
console.log(wrapper.is(":focus"))

I've tested this with jsdom@6 (in test suite), 13 and 12.


});

it('focus pseudo works on functional component in mount', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that stateless component not work in react@0.13 so removed it here and rewrite other tests with class component

packages/enzyme-test-suite/test/selector-spec.jsx Outdated Show resolved Hide resolved
packages/enzyme/src/selectors.js Outdated Show resolved Hide resolved
packages/enzyme/src/selectors.js Outdated Show resolved Hide resolved
packages/enzyme/src/selectors.js Outdated Show resolved Hide resolved
packages/enzyme/src/selectors.js Outdated Show resolved Hide resolved
@ljharb ljharb added this to Open in Make string selectors awesome via automation Jan 8, 2019
@ljharb ljharb merged commit d66104f into enzymejs:master Jan 8, 2019
Make string selectors awesome automation moved this from Open to Closed/Merged Jan 8, 2019
@malouro
Copy link

malouro commented Jan 24, 2019

This hasn't been released yet, right? Curious to know when the next release might be. Thanks 🙂

@ljharb
Copy link
Member

ljharb commented Feb 24, 2019

@malouro it has been released now, in v3.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants