Skip to content

Commit 3fedf96

Browse files
committed
Adds failing test
1 parent a2ec9ea commit 3fedf96

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/Styled.elm

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module Styled exposing (all)
44

55
import Css exposing (..)
66
import Html.Styled exposing (Html, a, button, div, header, img, nav, text, toUnstyled)
7-
import Html.Styled.Attributes exposing (css, src)
7+
import Html.Styled.Attributes exposing (class, css, src)
88
import Test exposing (Test, describe)
99
import Test.Html.Query as Query
1010
import Test.Html.Selector as Selector
@@ -107,4 +107,37 @@ all =
107107
, Selector.text "._20d887e{padding:16px;padding-left:24px;padding-right:24px;margin-left:50px;margin-right:auto;color:rgb(255,255,255);background-color:rgb(27,217,130);vertical-align:middle;}"
108108
]
109109
)
110+
, bug564
111+
]
112+
113+
114+
bug564 : Test
115+
bug564 =
116+
describe "Github Issue #564: https://github.com/rtfeldman/elm-css/issues/564"
117+
[ Test.test "generated class is included when there's no custom class" <|
118+
\_ ->
119+
div
120+
[ css [ color (rgb 0 0 0) ]
121+
]
122+
[]
123+
|> toUnstyled
124+
|> Query.fromHtml
125+
|> Query.has [ Selector.class "_5dc67897" ]
126+
, Test.test "custom class is included when there's no generated class" <|
127+
\_ ->
128+
div [ class "some-custom-class" ]
129+
[]
130+
|> toUnstyled
131+
|> Query.fromHtml
132+
|> Query.has [ Selector.class "some-custom-class" ]
133+
, Test.test "custom class is included as well as generated class" <|
134+
\_ ->
135+
div
136+
[ css [ color (rgb 0 0 0) ]
137+
, class "some-custom-class"
138+
]
139+
[]
140+
|> toUnstyled
141+
|> Query.fromHtml
142+
|> Query.has [ Selector.classes [ "_5dc67897", "some-custom-class" ] ]
110143
]

0 commit comments

Comments
 (0)