A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://enzymejs.github.io/enzyme/docs/api/ShallowWrapper/hostNodes.html below:

hostNodes() ยท Enzyme

.hostNodes() => ShallowWrapper

Returns a new wrapper with only host nodes. When using react-dom, host nodes are HTML elements rather than custom React components, e.g. <div> versus <MyComponent>.

Returns

ShallowWrapper: A new wrapper that wraps the filtered nodes.

Examples

The following code takes a wrapper with two nodes, one a <MyComponent> React component, and the other a <span>, and filters out the React component.

const wrapper = shallow((
  <div>
    <MyComponent className="foo" />
    <span className="foo" />
  </div>
));
const twoNodes = wrapper.find('.foo');
expect(twoNodes.hostNodes()).to.have.lengthOf(1);

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4