mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-11 03:28:09 +03:00
Adds role assertions
This commit is contained in:
parent
fcbba87765
commit
61db0f617f
@ -1,5 +1,6 @@
|
||||
module Spec.ClickableAttributes exposing (suite)
|
||||
|
||||
import Accessibility.Role as Role
|
||||
import ClickableAttributes exposing (ClickableAttributes)
|
||||
import Expect
|
||||
import Html.Attributes exposing (href)
|
||||
@ -24,6 +25,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with an external href" <|
|
||||
\() ->
|
||||
@ -31,6 +34,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with an external href that also supports tracking" <|
|
||||
\() ->
|
||||
@ -38,6 +43,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a SPA link" <|
|
||||
\() ->
|
||||
@ -45,6 +52,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a link with a method" <|
|
||||
\() ->
|
||||
@ -52,6 +61,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a link with tracking" <|
|
||||
\() ->
|
||||
@ -59,6 +70,8 @@ linkAttributes =
|
||||
|> setupLinkTest
|
||||
|> Expect.all
|
||||
[ Query.has [ Selector.attribute (href "some-route") ]
|
||||
, -- should not include redundant roles
|
||||
Query.hasNot [ Selector.attribute Role.link ]
|
||||
]
|
||||
]
|
||||
|
||||
@ -72,6 +85,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with an external href" <|
|
||||
\() ->
|
||||
@ -79,6 +94,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with an external href that also supports tracking" <|
|
||||
\() ->
|
||||
@ -86,6 +103,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a SPA link" <|
|
||||
\() ->
|
||||
@ -93,6 +112,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a link with a method" <|
|
||||
\() ->
|
||||
@ -100,6 +121,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
, test "with a link with tracking" <|
|
||||
\() ->
|
||||
@ -107,6 +130,8 @@ disabledLinkAttributes =
|
||||
|> setupDisabledLinkTest
|
||||
|> Expect.all
|
||||
[ Query.hasNot [ Selector.attribute (href "some-route") ]
|
||||
, -- should explicitly be tagged as having the link role
|
||||
Query.has [ Selector.attribute Role.link ]
|
||||
]
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user