Module
Elmish.Test.Combinators
- Package
- purescript-elmish-testing-library
- Repository
- collegevine/purescript-elmish-testing-library
#within Source
within :: forall m a. Testable m => String -> m a -> m a
Finds an element by the given selector and runs the given computation in the context of that element.
Example:
describe "My component" $
it "should work" $
testComponent { init, view, update } do
within "section:nth-child(1)" do
find "h2" >> text >>= shouldEqual "First Section"
clickOn "button"
within "section:nth-child(2)" do
find "h2" >> text >>= shouldEqual "Second Section"
find "input[type=text]" >> change "Some Text"
#chainM Source
chainM :: forall m a. Testable m => m Element -> m a -> m a
Used in its operator form >>
, this function chains two DOM operations
together, taking the output of the first operation and making it context of
the second one. For example:
buttonInsideDiv <- find "div" >> find "button"
inputValue <- find "input" >> attr "value"