0.6.4 • Published 1 year ago

@nichoth/test-dom v0.6.4

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

test dom

Tools for interacting with DOM elements

install

npm i -D @nichoth/test-dom

use

commonjs

const dom = require('@nichoth/test-dom')

esm

import { dom } from '@nichoth/test-dom'

example

waitForText

const el = await dom.waitForText({
    // `dom.qs` is a convenience function, short for `document.querySelector`
    element: dom.qs('.css-query'),
    regex: /foo/
})

waitFor

const el = await dom.waitFor({
    // css query here
    selector: 'p'
})

qs

// document.querySelector
const el = dom.qs('#my-css-id')

qsa

// document.querySelectorAll
const elements = dom.qsa('.my-css-class')

click

Automate click events

const element = dom.qs('#example')
dom.click(element)

test

npm test
0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago