Answers for "enzyme childAt example"

0

enzyme childAt example

// dom.js

import React from 'react'

const DomTest = () => (
  <div>
    <div className='domGroup'>
      <p className='domSatu satu'>DOM Satu</p>
      <p className='domDua'>DOM Dua</p>
      <p className='domTiga'>DOM Tiga</p>
    </div>
  </div>
)

export default DomTest

// dom.test.js
test('find element in DomTest Component by index using childAt', () => {
  expect(wrapper.find('.domGroup').childAt(0).text()).toStrictEqual('DOM Satu')
  expect(wrapper.find('.domGroup').childAt(1).text()).toStrictEqual('DOM Dua')
  expect(wrapper.find('.domGroup').childAt(2).text()).toStrictEqual('DOM Tiga')
})
Posted by: Guest on November-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language