Skip to content

Commit

Permalink
No pointer events on non interactive toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
Qluxzz committed Nov 2, 2024
1 parent 8a35b31 commit bbaf00c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ toastView message =

insuranceView : Html.Html Msg
insuranceView =
Html.div [ Html.Attributes.class "overlay" ]
Html.div [ Html.Attributes.class "overlay", Html.Attributes.class "interactive" ]
[ Html.div [ Html.Attributes.class "message" ]
[ Html.h1 [] [ Html.text "Buy insurance?" ]
, Html.div [ Html.Attributes.class "button-group" ]
Expand Down
4 changes: 4 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ h1 {
animation: fade-in 250ms ease-in-out;
flex-direction: column;

&:not(.interactive) {
pointer-events: none;
}

.message {
display: flex;
justify-content: center;
Expand Down
16 changes: 16 additions & 0 deletions tests/GameTests.elm
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,22 @@ suite =
|> ProgramTest.advanceTime 2
|> ProgramTest.ensureView (toastHasMessage "You got your bet back!")
|> ProgramTest.expectViewHas [ continueButton ]
, test "If you buy insurance and the dealer doesn't have a blackjack, you win the standard amount - the insurance" <|
\_ ->
start
(defaultSettings
|> withDeck [ Card.Card Card.Ten Card.Spades, Card.Card Card.Ace Card.Spades, Card.Card Card.Seven Card.Diamonds, Card.Card Card.Eight Card.Clubs ]
|> withDelay
)
|> clickMarker 100
|> ProgramTest.advanceTime 4
-- Deal four cards
|> ProgramTest.ensureViewHas
[ Selector.exactText "Buy insurance?" ]
|> ProgramTest.clickButton "Yes"
|> ProgramTest.advanceTime 2
|> ProgramTest.ensureView (toastHasMessage "You got your bet back!")
|> ProgramTest.expectViewHas [ continueButton ]
, test "If you don't buy insurance and the dealer has a blackjack, you lose your bet" <|
\_ ->
start
Expand Down

0 comments on commit bbaf00c

Please sign in to comment.