我如何编写一个测试来获取我在测试中键入的确切元素?
How can I write a test which gets the exact element I typed in the test?
以下是如何获取在酶测试中键入的元素:
expect(wrapper.containsMatchingElement( <img alt="img" src={'./name.jpg'}> ))
我想知道如何使用 react-testing-library 键入这种测试?
这有点像酶测试
expect(screen.getByTestId('div')).toMatchInlineSnapshot(` <h1>Hello, World!</h1> `)
以下是如何获取在酶测试中键入的元素:
expect(wrapper.containsMatchingElement( <img alt="img" src={'./name.jpg'}> ))
我想知道如何使用 react-testing-library 键入这种测试?
这有点像酶测试
expect(screen.getByTestId('div')).toMatchInlineSnapshot(` <h1>Hello, World!</h1> `)