2022-04-12 21:18:09 +03:00
|
|
|
module SwitchExampleSpec exposing (suite)
|
|
|
|
|
2022-04-12 22:56:37 +03:00
|
|
|
import Accessibility.Aria as Aria
|
2022-04-12 22:45:17 +03:00
|
|
|
import ProgramTest exposing (..)
|
|
|
|
import Routes exposing (Route)
|
2022-04-12 21:18:09 +03:00
|
|
|
import Test exposing (..)
|
2022-04-12 22:45:17 +03:00
|
|
|
import Test.Html.Selector exposing (..)
|
|
|
|
import TestApp exposing (app)
|
|
|
|
|
|
|
|
|
|
|
|
route : Route
|
|
|
|
route =
|
|
|
|
Routes.Doodad "Switch"
|
2022-04-12 21:18:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
suite : Test
|
|
|
|
suite =
|
2022-04-12 22:45:17 +03:00
|
|
|
describe "Switch"
|
|
|
|
[ test "it works" <|
|
|
|
|
\() ->
|
|
|
|
app route
|
|
|
|
|> ensureViewHas [ text "Nri.Ui.Switch" ]
|
2022-04-12 22:56:37 +03:00
|
|
|
-- 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"
|
|
|
|
]
|
2022-04-12 22:45:17 +03:00
|
|
|
|> done
|
|
|
|
]
|