Documentation
¶
Overview ¶
Package htmltest contains test helpers when working with the html package
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnwrapHTMLElement ¶ added in v0.8.0
func UnwrapHTMLElement[T html.HTMLElement](h HTMLElementHelper) (res T)
Types ¶
type BrowserHelper ¶
func NewBrowserHelper ¶
func NewBrowserHelper(t testing.TB, b *browser.Browser) BrowserHelper
func (BrowserHelper) OpenWindow ¶
func (b BrowserHelper) OpenWindow(url string) WindowHelper
type HTMLDocumentHelper ¶
type HTMLDocumentHelper struct { HTMLParentNodeHelper dom.Document // contains filtered or unexported fields }
Helper type on top of html.HTMLDocument to provide useful helper functions for testing.
func NewHTMLDocumentHelper ¶
func NewHTMLDocumentHelper(t testing.TB, doc dom.Document) HTMLDocumentHelper
func ParseHTMLDocument ¶ added in v0.8.0
func ParseHTMLDocument(t testing.TB, s string) HTMLDocumentHelper
func (HTMLDocumentHelper) CreateHTMLElement ¶
func (h HTMLDocumentHelper) CreateHTMLElement(tag string) HTMLElementHelper
func (HTMLDocumentHelper) GetHTMLElementById ¶
func (h HTMLDocumentHelper) GetHTMLElementById(id string) html.HTMLElement
GetHTMLElementById works as html/HTMLDocument.GetElementById but assumes the found element to be an html/HTMLElement
type HTMLElementHelper ¶
type HTMLElementHelper struct { html.HTMLElement HTMLParentNodeHelper // contains filtered or unexported fields }
func NewHTMLElementHelper ¶
func NewHTMLElementHelper(t testing.TB, e html.HTMLElement) HTMLElementHelper
func (*HTMLElementHelper) AttributeValue ¶
func (h *HTMLElementHelper) AttributeValue(key string) string
type HTMLHelper ¶
func (HTMLHelper) CreateHTMLElement ¶
func (h HTMLHelper) CreateHTMLElement(tagname string) HTMLElementHelper
Create a single HTMLElement for testing element behaviour.
func (HTMLHelper) NewDocument ¶
func (h HTMLHelper) NewDocument() HTMLDocumentHelper
type HTMLParentNodeHelper ¶ added in v0.8.0
type HTMLParentNodeHelper struct { ElementParent dom.ElementParent // contains filtered or unexported fields }
func NewHTMLParentNodeHelper ¶ added in v0.8.0
func NewHTMLParentNodeHelper(t testing.TB, n dom.ElementParent) HTMLParentNodeHelper
func (HTMLParentNodeHelper) QuerySelectorHTML ¶ added in v0.8.0
func (h HTMLParentNodeHelper) QuerySelectorHTML(pattern string) (res HTMLElementHelper)
func (HTMLParentNodeHelper) QuerySelectorHTMLOpt ¶ added in v0.8.0
func (h HTMLParentNodeHelper) QuerySelectorHTMLOpt(pattern string) (res *HTMLElementHelper)
type WindowHelper ¶
Helper type on top of html.HTMLDocument to provide useful helper functions for testing.
func NewWindowHelper ¶
func NewWindowHelper(t testing.TB, win html.Window) WindowHelper
func (WindowHelper) HTMLDocument ¶
func (win WindowHelper) HTMLDocument() HTMLDocumentHelper
func (WindowHelper) MustEval ¶ added in v0.6.0
func (win WindowHelper) MustEval(script string) any
func (WindowHelper) MustLoadHTML ¶ added in v0.5.4
func (h WindowHelper) MustLoadHTML(html string)
func (WindowHelper) MustRun ¶ added in v0.6.0
func (win WindowHelper) MustRun(script string)
Click to show internal directories.
Click to hide internal directories.