Skip to content

Commit

Permalink
add button type tests to ClickableText spec
Browse files Browse the repository at this point in the history
  • Loading branch information
charbelrami committed Oct 30, 2023
1 parent b0dd5cc commit 45b5f76
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/Spec/Nri/Ui/ClickableText.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ elementTests =

attributeTests : List Test
attributeTests =
[ test "a link has the `href` attribute set to the provided value" <|
[ test "a button has the `type` attribute set to `\"button\"`" <|
\() ->
programButton []
|> ensureViewHas [ attribute (Attributes.type_ "button") ]
|> done
, test "a button with the `submit` type has the `type` attribute set to `\"submit\"`" <|
\() ->
programButton [ ClickableText.submit ]
|> ensureViewHas [ attribute (Attributes.type_ "submit") ]
|> done
, test "a link has the `href` attribute set to the provided value" <|
\() ->
programLink [ ClickableText.href "https://example.com" ]
|> ensureViewHas
Expand Down Expand Up @@ -198,6 +208,21 @@ disabledStateTests =
|> clickOnButton
|> done
|> expectFailure "Event.expectEvent: I found a node, but it does not listen for \"click\" events like I expected it would."
, test "the `type` attribute is present and set to `\"button\"` for a disabled ClickableText" <|
\() ->
programButton
[ ClickableText.disabled True
]
|> ensureViewHas [ attribute (Attributes.type_ "button") ]
|> done
, test "the `type` attribute is present and set to `\"button\"` for a disabled ClickableText with the `submit` type" <|
\() ->
programButton
[ ClickableText.disabled True
, ClickableText.submit
]
|> ensureViewHas [ attribute (Attributes.type_ "button") ]
|> done
]


Expand Down

0 comments on commit 45b5f76

Please sign in to comment.