mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-22 21:21:52 +03:00
37 lines
1.1 KiB
Elm
37 lines
1.1 KiB
Elm
module SwitchExampleSpec exposing (suite)
|
|
|
|
import Accessibility.Aria as Aria
|
|
import ProgramTest exposing (..)
|
|
import Routes exposing (Route)
|
|
import Test exposing (..)
|
|
import Test.Html.Selector exposing (..)
|
|
import TestApp exposing (app)
|
|
|
|
|
|
route : Route
|
|
route =
|
|
Routes.Doodad "Switch"
|
|
|
|
|
|
suite : Test
|
|
suite =
|
|
describe "Switch"
|
|
[ test "it works" <|
|
|
\() ->
|
|
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
|
|
]
|