MCPcopy
hub / github.com/vitest-dev/vitest / getDOMElement

Function getDOMElement

test/browser/fixtures/expect-dom/toBeInvalid.test.ts:4–8  ·  view source on GitHub ↗
(htmlString: string, selector: string)

Source from the content-addressed store, hash-verified

2import { render } from './utils'
3
4function getDOMElement(htmlString: string, selector: string) {
5 const doc = document.implementation.createHTMLDocument('')
6 doc.body.innerHTML = htmlString
7 return doc.querySelector(selector)
8}
9
10// A required field without a value is invalid
11const invalidInputHtml = `<input required>`

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected