Module

Elmish.Test.Query

Package
purescript-elmish-testing-library
Repository
collegevine/purescript-elmish-testing-library

#attr Source

attr :: forall m. Testable m => String -> m String

Returns the given attribute of the current-context element.

#childAt Source

childAt :: forall m. Testable m => Int -> m Element

Within the current-context element, finds a child element at the given index. Crashes if the is no child with the given index.

#children Source

children :: forall m. Testable m => m (Array Element)

Returns all immediate child elements of the current-context element.

find "div" >> children >>= traverse_ \child ->
  tag <- tagName
  when (tag == "BUTTON")
    click

#exists Source

exists :: forall m. Testable m => String -> m Boolean

Returns true if at least one element exists matching the given CSS selector.

#find Source

find :: forall m. Testable m => String -> m Element

Finds exactly one element by CSS selector. If the selector matches zero elements or more than one, this function will throw an exception.

find "button" >> click

#findAll Source

findAll :: forall m. Testable m => String -> m (Array Element)

Finds zero or more elements by CSS selector.

findAll "button" >>= traverse_ \b -> click $$ b

divs <- find "div" length divs shouldEqual 10

#findFirst Source

findFirst :: forall m. Testable m => String -> m Element

Finds the first element out of possibly many matching the given selector. If there are no elements matching the selector, throws an exception.

#findNth Source

findNth :: forall m. Testable m => Int -> String -> m Element

Finds the n-th (zero-based) element out of possibly many matching the given selector. If there are no elements matching the selector, throws an exception.

#html Source

html :: forall m. Testable m => m String

Returns HTML representation of the current-context element.

#prop Source

prop :: forall m a. Testable m => DomProp a -> m a

Returns the given property of the current-context element.

import Elmish.Test.DomProps as P

find "input" >> prop P.value >>= shouldEqual "hello"

#tagName Source

tagName :: forall m. Testable m => m String

Returns the tag name of the current-context element.

#text Source

text :: forall m. Testable m => m String

Returns full inner text of the current-context element.