enzyme childat example

Solutions on MaxInterview for enzyme childat example by the best coders in the world

showing results for - "enzyme childat example"
Antonio
28 Apr 2020
1// dom.js
2
3import React from 'react'
4
5const DomTest = () => (
6  <div>
7    <div className='domGroup'>
8      <p className='domSatu satu'>DOM Satu</p>
9      <p className='domDua'>DOM Dua</p>
10      <p className='domTiga'>DOM Tiga</p>
11    </div>
12  </div>
13)
14
15export default DomTest
16
17// dom.test.js
18test('find element in DomTest Component by index using childAt', () => {
19  expect(wrapper.find('.domGroup').childAt(0).text()).toStrictEqual('DOM Satu')
20  expect(wrapper.find('.domGroup').childAt(1).text()).toStrictEqual('DOM Dua')
21  expect(wrapper.find('.domGroup').childAt(2).text()).toStrictEqual('DOM Tiga')
22})