Build out Elm test against styleguide app

This commit is contained in:
Tessa Kelly 2022-04-12 12:56:37 -07:00
parent 90310817ca
commit c0772233bb
2 changed files with 15 additions and 1 deletions

View File

@ -45,7 +45,8 @@
"test-dependencies": {
"direct": {
"avh4/elm-program-test": "3.6.3",
"elm-explorations/test": "1.2.2"
"elm-explorations/test": "1.2.2",
"tesk9/accessible-html": "5.0.0"
},
"indirect": {
"avh4/elm-fifo": "1.0.4",

View File

@ -1,5 +1,6 @@
module SwitchExampleSpec exposing (suite)
import Accessibility.Aria as Aria
import ProgramTest exposing (..)
import Routes exposing (Route)
import Test exposing (..)
@ -19,5 +20,17 @@ suite =
\() ->
app route
|> ensureViewHas [ text "Nri.Ui.Switch" ]
-- switch starts with aria-checked=true and text "On"
|> ensureViewHas
[ attribute (Aria.checked (Just True))
, text "On"
]
-- user can click the first switch
|> check "switch-interactive" "On" False
-- the switch now has aria-checked=false and text "Off"
|> ensureViewHas
[ attribute (Aria.checked (Just False))
, text "Off"
]
|> done
]