@@ -8,7 +8,6 @@ import Testable
88import Testable.Element exposing (..)
99import Testable.Element.Background as Background
1010import Testable.Element.Font as Font
11−import Testable.Generator
1211import Testable.Runner
1312import Tests.Palette as Palette exposing (..)
1413
@@ -58,39 +57,365 @@ p attrs =
5857
5958
6059{-| -}
61−view : List ( String, Testable.Element msg )
60+main : Html.Html msg
61+main =
62+ Testable.Runner.show view
63+
64+
65+{-| -}
66+view : Testable.Element msg
6267view =
63− List.concat
64− [ [ Tuple.pair "Parent inFront above child inFront" layeredVisibility
65− , Tuple.pair "Sibling onLeft above sibling inFront" overlappingChildren
66− , Tuple.pair "el with all nearbys and alignments" master
67− , Tuple.pair "paragraph with all nearbys and alignments" masterParagraph
68− ]
69− , Testable.Generator.generate "Nearbys"
70− (\element nearby ->
71− element
72− [ nearby (box [])
73− , width (px 200)
74− , height (px 200)
75− , Background.color red
68+ let
69+ transparentBox attrs =
70+ el
71+ ([ Font.color white
72+ , width (px 50)
73+ , height (px 50)
74+ , Background.color white
75+ ]
76+ ++ attrs
77+ )
78+ (text "hi")
79+
80+ -- single location name box =
81+ -- row [ height (px 100), width fill, spacing 50 ]
82+ -- [ box
83+ -- [ location
84+ -- (el
85+ -- [ width (px 20)
86+ -- , height (px 20)
87+ -- , Background.color darkCharcoal
88+ -- ]
89+ -- none
90+ -- )
91+ -- ]
92+ -- , box
93+ -- [ location
94+ -- (el
95+ -- [ width (px 20)
96+ -- , height (px 20)
97+ -- , alignLeft
98+ -- , Background.color darkCharcoal
99+ -- ]
100+ -- none
101+ -- )
102+ -- ]
103+ -- ]
104+ little name attrs =
105+ el
106+ ([ label name
107+ , width (px 5)
108+ , height (px 5)
109+ , Background.color darkCharcoal
110+ ]
111+ ++ attrs
112+ )
113+ none
114+
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 ]
119+ [ render
120+ [ location
121+ (el
122+ [ label name
123+ , width (px 20)
124+ , height (px 20)
125+ , Background.color darkCharcoal
126+ ]
127+ none
128+ )
129+ ]
130+ , render
131+ [ location
132+ (el
133+ [ label name
134+ , width (px 20)
135+ , height (px 20)
136+ , alignLeft
137+ , Background.color darkCharcoal
138+ ]
139+ none
140+ )
141+ ]
142+ , render
143+ [ location
144+ (el
145+ [ label name
146+ , width (px 20)
147+ , height (px 20)
148+ , centerX
149+ , Background.color darkCharcoal
150+ ]
151+ none
152+ )
153+ ]
154+ , render
155+ [ location
156+ (el
157+ [ label name
158+ , width (px 20)
159+ , height (px 20)
160+ , alignRight
161+ , Background.color darkCharcoal
162+ ]
163+ none
164+ )
165+ ]
166+ , render
167+ [ location
168+ (el
169+ [ label name
170+ , width (px 20)
171+ , height (px 20)
172+ , alignTop
173+ , Background.color darkCharcoal
174+ ]
175+ none
176+ )
177+ ]
178+ , render
179+ [ location
180+ (el
181+ [ label name
182+ , width (px 20)
183+ , height (px 20)
184+ , centerY
185+ , Background.color darkCharcoal
186+ ]
187+ none
188+ )
189+ ]
190+ , render
191+ [ location
192+ (el
193+ [ label name
194+ , width (px 20)
195+ , height (px 20)
196+ , alignBottom
197+ , Background.color darkCharcoal
198+ ]
199+ none
200+ )
201+ ]
202+ ]
203+ , text "widths/heights"
204+ , row [ height (px 100), width fill, spacing 50, label "Row" ]
205+ [ render
206+ [ location
207+ (el
208+ [ label name
209+ , width fill
210+ , height fill
211+ , Background.color darkCharcoal
212+ ]
213+ none
214+ )
215+ ]
216+ , render
217+ [ location
218+ (el
219+ [ label name
220+ , width (px 20)
221+ , height fill
222+ , Background.color darkCharcoal
223+ ]
224+ none
225+ )
226+ ]
227+ , render
228+ [ label "render"
229+ , location
230+ (el
231+ [ label name
232+ , width fill
233+ , height (px 20)
234+ , Background.color darkCharcoal
235+ ]
236+ none
237+ )
238+ ]
239+ , render
240+ [ location
241+ (el
242+ [ label name
243+ , width (px 20)
244+ , height shrink
245+ , Background.color darkCharcoal
246+ , Font.color white
247+ ]
248+ (text "h-shrink")
249+ )
250+ ]
251+ , render
252+ [ location
253+ (el
254+ [ label name
255+ , width shrink
256+ , height (px 20)
257+ , Background.color darkCharcoal
258+ , Font.color white
259+ ]
260+ (text "w-shrink")
261+ )
262+ ]
76263 ]
77− none
78− )
79− |> Testable.Generator.with Testable.Generator.allElements
80− |> Testable.Generator.with Testable.Generator.nearbys
81− , Testable.Generator.generate "Nearbys with alignment"
82− (\element nearby align ->
83− element
84− [ nearby (box [ align ])
85− , width (px 200)
86− , height (px 200)
87− , Background.color red
264+ , text "on paragraph"
265+ , row [ width fill, spacing 50, label "Row" ]
266+ [ p
267+ [ location
268+ (el
269+ [ label name
270+ , width (px 20)
271+ , height (px 20)
272+ , Background.color darkCharcoal
273+ ]
274+ none
275+ )
276+ ]
277+ , p
278+ [ location
279+ (el
280+ [ label name
281+ , width (px 20)
282+ , height (px 20)
283+ , alignLeft
284+ , Background.color darkCharcoal
285+ ]
286+ none
287+ )
288+ ]
289+ , p
290+ [ location
291+ (el
292+ [ label name
293+ , width (px 20)
294+ , height (px 20)
295+ , centerX
296+ , Background.color darkCharcoal
297+ ]
298+ none
299+ )
300+ ]
301+ , p
302+ [ location
303+ (el
304+ [ label name
305+ , width (px 20)
306+ , height (px 20)
307+ , alignRight
308+ , Background.color darkCharcoal
309+ ]
310+ none
311+ )
312+ ]
313+ , p
314+ [ location
315+ (el
316+ [ label name
317+ , width (px 20)
318+ , height (px 20)
319+ , alignTop
320+ , Background.color darkCharcoal
321+ ]
322+ none
323+ )
324+ ]
325+ , p
326+ [ location
327+ (el
328+ [ label name
329+ , width (px 20)
330+ , height (px 20)
331+ , centerY
332+ , Background.color darkCharcoal
333+ ]
334+ none
335+ )
336+ ]
337+ , p
338+ [ location
339+ (el
340+ [ label name
341+ , width (px 20)
342+ , height (px 20)
343+ , alignBottom
344+ , Background.color darkCharcoal
345+ ]
346+ none
347+ )
348+ ]
88349 ]
89− none
90− )
91− |> Testable.Generator.with Testable.Generator.allElements
92− |> Testable.Generator.with Testable.Generator.nearbys
93− |> Testable.Generator.with Testable.Generator.alignments
350+ ]
351+
352+ master =
353+ el [ padding 20 ] <|
354+ box
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 ])
376+ ]
377+
378+ masterParagraph =
379+ el [ padding 20 ] <|
380+ p
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 ])
402+ ]
403+ in
404+ column
405+ [ centerX, label "Nearby Elements", spacing 100 ]
406+ [ layeredVisibility
407+ , overlappingChildren
408+
409+ -- Note: visibility checks like the above
410+ -- need to be at the top so they're in the viewport
411+ , master
412+ , masterParagraph
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
94419 ]
95420
96421
@@ -111,69 +436,3 @@ overlappingChildren =
111436 , el [ onLeft (littleBox "overlapping" [ isVisible, Background.color red ]) ]
112437 (justBox 40 darkGrey [])
113438 ]
114−
115−
116−little name attrs =
117− el
118− ([ label name
119− , width (px 5)
120− , height (px 5)
121− , Background.color darkCharcoal
122− ]
123− ++ attrs
124− )
125− none
126−
127−
128−master =
129− el [ padding 20 ] <|
130− box
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 ])
152− ]
153−
154−
155−masterParagraph =
156− el [ padding 20 ] <|
157− p
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 ])
179− ]