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

2 participants
@chenesan
Copy link
Contributor

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', () => {

This comment has been minimized.

@chenesan

chenesan Jan 6, 2019

Contributor

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

Show resolved Hide resolved packages/enzyme-test-suite/test/selector-spec.jsx Outdated
Show resolved Hide resolved packages/enzyme-test-suite/test/selector-spec.jsx
Show resolved Hide resolved packages/enzyme-test-suite/test/selector-spec.jsx
Show resolved Hide resolved packages/enzyme-test-suite/test/selector-spec.jsx
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 packages/enzyme/src/selectors.js Outdated
Show resolved Hide resolved packages/enzyme/src/selectors.js Outdated

@ljharb ljharb added Mount MINOR labels Jan 8, 2019

@ljharb ljharb added this to Open in Make string selectors awesome via automation Jan 8, 2019

@ljharb

ljharb approved these changes Jan 8, 2019

@ljharb ljharb force-pushed the chenesan:focus-pseudo-selector branch from bc74714 to d66104f Jan 8, 2019

@ljharb ljharb merged commit d66104f into airbnb:master Jan 8, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

Make string selectors awesome automation moved this from Open to Closed/Merged Jan 8, 2019

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