test-dom
/
0.0.1
test-dom 0.0.1
Install from the command line:
Learn more about npm packages
$ npm install @socketsupply/test-dom@0.0.1
Install via package.json:
"@socketsupply/test-dom": "0.0.1"
About this version
We had previously used @testing-library/dom
& @testing-library/user-event
.
Here we implement similar functionality but with less code.
npm i -D @socketsupply/test-dom
const dom = require('@socketsupply/test-dom')
import dom from '@socketsupply/test-dom'
const el = await dom.waitForText({
// `dom.qs` is a convenience function, short for `document.querySelector`
element: dom.qs('.css-query'),
regex: /foo/
})
const el = await dom.waitFor({
// css query here
selector: 'p'
})
// document.querySelector
const el = dom.qs('#my-css-id')
// document.querySelectorAll
const elements = dom.qsa('.my-css-class')
Automate click events
const element = dom.qs('#example')
dom.click(element)
npm test