@@ -8,6 +8,7 @@ import Testable
8import Testable.Element exposing (..)
8import Testable.Element exposing (..)
9import Testable.Element.Background as Background
9import Testable.Element.Background as Background
10import Testable.Element.Font as Font
10import Testable.Element.Font as Font
11+import Testable.Generator
11import Testable.Runner
12import Testable.Runner
12import Tests.Palette as Palette exposing (..)
13import Tests.Palette as Palette exposing (..)
@@ -57,365 +58,39 @@ p attrs =
62− Testable.Runner.show view
66−view : Testable.Element msg
61+view : List ( String, Testable.Element msg )
69− transparentBox attrs =
64+ [ [ Tuple.pair "Parent inFront above child inFront" layeredVisibility
70− el
65+ , Tuple.pair "Sibling onLeft above sibling inFront" overlappingChildren
71− ([ Font.color white
66+ , Tuple.pair "el with all nearbys and alignments" master
72− , width (px 50)
67+ , Tuple.pair "paragraph with all nearbys and alignments" masterParagraph
73− , height (px 50)
68+ ]
74− , Background.color white
69+ , Testable.Generator.generate "Nearbys"
75− ]
70+ (\element nearby ->
80− -- single location name box =
81− -- row [ height (px 100), width fill, spacing 50 ]
87− -- , Background.color darkCharcoal
92− -- , box
72+ [ nearby (box [])
95− -- [ width (px 20)
73+ , width (px 200)
96− -- , height (px 20)
74+ , height (px 200)
98− -- , Background.color darkCharcoal
75+ , Background.color red
109− , Background.color darkCharcoal
115− nearby location name render =
116− column [ spacing 32, label "column" ]
117− [ el [ padding 20, Background.color green, Font.color white ] (text name)
118− , row [ height (px 100), width fill, spacing 50 ]
125− , Background.color darkCharcoal
137− , Background.color darkCharcoal
149− , Background.color darkCharcoal
161− , Background.color darkCharcoal
173− , Background.color darkCharcoal
185− , Background.color darkCharcoal
197− , Background.color darkCharcoal
203− , text "widths/heights"
204− , row [ height (px 100), width fill, spacing 50, label "Row" ]
211− , Background.color darkCharcoal
222− , Background.color darkCharcoal
234− , Background.color darkCharcoal
245− , Background.color darkCharcoal
257− , Background.color darkCharcoal
264− , text "on paragraph"
265− , row [ width fill, spacing 50, label "Row" ]
272− , Background.color darkCharcoal
276− ]
79+ |> Testable.Generator.with Testable.Generator.allElements
277− , p
80+ |> Testable.Generator.with Testable.Generator.nearbys
278− [ location
81+ , Testable.Generator.generate "Nearbys with alignment"
279− (el
82+ (\element nearby align ->
280− [ label name
83+ element
281− , width (px 20)
84+ [ nearby (box [ align ])
284− , Background.color darkCharcoal
296− , Background.color darkCharcoal
308− , Background.color darkCharcoal
320− , Background.color darkCharcoal
332− , Background.color darkCharcoal
341− , width (px 20)
85+ , width (px 200)
342− , height (px 20)
86+ , height (px 200)
344− , Background.color darkCharcoal
87+ , Background.color red
352− master =
91+ |> Testable.Generator.with Testable.Generator.allElements
353− el [ padding 20 ] <|
92+ |> Testable.Generator.with Testable.Generator.nearbys
354− box
93+ |> Testable.Generator.with Testable.Generator.alignments
355− [ above (little "above-left" [ alignLeft ])
356− , above (little "above-center" [ centerX ])
357− , above (little "above-right" [ alignRight ])
358− , below (little "below-left" [ alignLeft ])
359− , below (little "below-center" [ centerX ])
360− , below (little "below-right" [ alignRight ])
361− , onRight (little "onRight-left" [ alignTop ])
362− , onRight (little "onRight-center" [ centerY ])
363− , onRight (little "onRight-right" [ alignBottom ])
364− , onLeft (little "onLeft-left" [ alignTop ])
365− , onLeft (little "onLeft-center" [ centerY ])
366− , onLeft (little "onLeft-right" [ alignBottom ])
367− , inFront (little "infront-left-top" [ alignTop, alignLeft ])
368− , inFront (little "infront-center-top" [ alignTop, centerX ])
369− , inFront (little "infront-right-top" [ alignTop, alignRight ])
370− , inFront (little "infront-left-center" [ centerY, alignLeft ])
371− , inFront (little "infront-center-center" [ centerY, centerX ])
372− , inFront (little "infront-right-center" [ centerY, alignRight ])
373− , inFront (little "infront-left-bottom" [ alignBottom, alignLeft ])
374− , inFront (little "infront-center-bottom" [ alignBottom, centerX ])
375− , inFront (little "infront-right-bottom" [ alignBottom, alignRight ])
379− el [ padding 20 ] <|
381− [ above (little "above-left" [ alignLeft ])
382− , above (little "above-center" [ centerX ])
383− , above (little "above-right" [ alignRight ])
384− , below (little "below-left" [ alignLeft ])
385− , below (little "below-center" [ centerX ])
386− , below (little "below-right" [ alignRight ])
387− , onRight (little "onRight-left" [ alignTop ])
388− , onRight (little "onRight-center" [ centerY ])
389− , onRight (little "onRight-right" [ alignBottom ])
390− , onLeft (little "onLeft-left" [ alignTop ])
391− , onLeft (little "onLeft-center" [ centerY ])
392− , onLeft (little "onLeft-right" [ alignBottom ])
393− , inFront (little "infront-left-top" [ alignTop, alignLeft ])
394− , inFront (little "infront-center-top" [ alignTop, centerX ])
395− , inFront (little "infront-right-top" [ alignTop, alignRight ])
396− , inFront (little "infront-left-center" [ centerY, alignLeft ])
397− , inFront (little "infront-center-center" [ centerY, centerX ])
398− , inFront (little "infront-right-center" [ centerY, alignRight ])
399− , inFront (little "infront-left-bottom" [ alignBottom, alignLeft ])
400− , inFront (little "infront-center-bottom" [ alignBottom, centerX ])
401− , inFront (little "infront-right-bottom" [ alignBottom, alignRight ])
405− [ centerX, label "Nearby Elements", spacing 100 ]
407− , overlappingChildren
409− -- Note: visibility checks like the above
410− -- need to be at the top so they're in the viewport
413− , nearby above "above" box
414− , nearby below "below" box
415− , nearby inFront "inFront" box
416− , nearby onRight "onRight" box
417− , nearby onLeft "onLeft" box
418− , nearby behindContent "behindContent" transparentBox
@@ -436,3 +111,69 @@ overlappingChildren =
436 , el [ onLeft (littleBox "overlapping" [ isVisible, Background.color red ]) ]
111 , el [ onLeft (littleBox "overlapping" [ isVisible, Background.color red ]) ]
437 (justBox 40 darkGrey [])
112 (justBox 40 darkGrey [])
121+ , Background.color darkCharcoal
129+ el [ padding 20 ] <|
131+ [ above (little "above-left" [ alignLeft ])
132+ , above (little "above-center" [ centerX ])
133+ , above (little "above-right" [ alignRight ])
134+ , below (little "below-left" [ alignLeft ])
135+ , below (little "below-center" [ centerX ])
136+ , below (little "below-right" [ alignRight ])
137+ , onRight (little "onRight-left" [ alignTop ])
138+ , onRight (little "onRight-center" [ centerY ])
139+ , onRight (little "onRight-right" [ alignBottom ])
140+ , onLeft (little "onLeft-left" [ alignTop ])
141+ , onLeft (little "onLeft-center" [ centerY ])
142+ , onLeft (little "onLeft-right" [ alignBottom ])
143+ , inFront (little "infront-left-top" [ alignTop, alignLeft ])
144+ , inFront (little "infront-center-top" [ alignTop, centerX ])
145+ , inFront (little "infront-right-top" [ alignTop, alignRight ])
146+ , inFront (little "infront-left-center" [ centerY, alignLeft ])
147+ , inFront (little "infront-center-center" [ centerY, centerX ])
148+ , inFront (little "infront-right-center" [ centerY, alignRight ])
149+ , inFront (little "infront-left-bottom" [ alignBottom, alignLeft ])
150+ , inFront (little "infront-center-bottom" [ alignBottom, centerX ])
151+ , inFront (little "infront-right-bottom" [ alignBottom, alignRight ])
156+ el [ padding 20 ] <|
158+ [ above (little "above-left" [ alignLeft ])
159+ , above (little "above-center" [ centerX ])
160+ , above (little "above-right" [ alignRight ])
161+ , below (little "below-left" [ alignLeft ])
162+ , below (little "below-center" [ centerX ])
163+ , below (little "below-right" [ alignRight ])
164+ , onRight (little "onRight-left" [ alignTop ])
165+ , onRight (little "onRight-center" [ centerY ])
166+ , onRight (little "onRight-right" [ alignBottom ])
167+ , onLeft (little "onLeft-left" [ alignTop ])
168+ , onLeft (little "onLeft-center" [ centerY ])
169+ , onLeft (little "onLeft-right" [ alignBottom ])
170+ , inFront (little "infront-left-top" [ alignTop, alignLeft ])
171+ , inFront (little "infront-center-top" [ alignTop, centerX ])
172+ , inFront (little "infront-right-top" [ alignTop, alignRight ])
173+ , inFront (little "infront-left-center" [ centerY, alignLeft ])
174+ , inFront (little "infront-center-center" [ centerY, centerX ])
175+ , inFront (little "infront-right-center" [ centerY, alignRight ])
176+ , inFront (little "infront-left-bottom" [ alignBottom, alignLeft ])
177+ , inFront (little "infront-center-bottom" [ alignBottom, centerX ])
178+ , inFront (little "infront-right-bottom" [ alignBottom, alignRight ])