@@ -3,8 +3,10 @@ module Styled exposing (all)
3
3
-- import ReadmeExample
4
4
5
5
import Css exposing (..)
6
+ import Css.Media as Media
6
7
import Html.Styled exposing (Html , a , button , div , header , img , nav , text , toUnstyled )
7
8
import Html.Styled.Attributes exposing (class , css , src )
9
+ import Html.Styled.Lazy exposing (keyedLazy )
8
10
import Test exposing (Test , describe )
9
11
import Test.Html.Query as Query
10
12
import Test.Html.Selector as Selector
@@ -108,6 +110,7 @@ all =
108
110
]
109
111
)
110
112
, bug564
113
+ , keyedLazyTests
111
114
]
112
115
113
116
@@ -141,3 +144,49 @@ bug564 =
141
144
|> Query . fromHtml
142
145
|> Query . has [ Selector . classes [ " _5dc67897" , " some-custom-class" ] ]
143
146
]
147
+
148
+
149
+ keyedLazyTests : Test
150
+ keyedLazyTests =
151
+ describe " keyedLazy"
152
+ [ Test . test " generates an appropriate selector for the root node" <|
153
+ \ _ ->
154
+ keyedLazy
155
+ ( \ i ->
156
+ ( " item-" ++ String . fromInt i
157
+ , div [ css [ color ( rgb 0 0 0 ) ] ] []
158
+ )
159
+ )
160
+ 1
161
+ |> toUnstyled
162
+ |> Query . fromHtml
163
+ |> Query . has [ Selector . text " #item-1._5dc67897" ]
164
+ , Test . test " generates an appropriate selector for a descendant node" <|
165
+ \ _ ->
166
+ keyedLazy
167
+ ( \ i ->
168
+ ( " item-" ++ String . fromInt i
169
+ , div []
170
+ [ div [ css [ color ( rgb 0 0 0 ) ] ] []
171
+ ]
172
+ )
173
+ )
174
+ 1
175
+ |> toUnstyled
176
+ |> Query . fromHtml
177
+ |> Query . has [ Selector . text " #item-1 ._5dc67897" ]
178
+ , Test . test " generates an appropriate selector with media" <|
179
+ \ _ ->
180
+ keyedLazy
181
+ ( \ i ->
182
+ ( " item-" ++ String . fromInt i
183
+ , div []
184
+ [ div [ css [ Media . withMedia [ Media . only Media . screen [] ] [ color ( rgb 0 0 0 ) ] ] ] []
185
+ ]
186
+ )
187
+ )
188
+ 1
189
+ |> toUnstyled
190
+ |> Query . fromHtml
191
+ |> Query . has [ Selector . text " #item-1 ._22afe2eb" ]
192
+ ]
0 commit comments