@@ -10,6 +10,7 @@ module Testable.Element exposing
1010 , below
1111 , centerX
1212 , centerY
13+ , clip
1314 , column
1415 , el
1516 , expectRoundedEquality
@@ -20,6 +21,7 @@ module Testable.Element exposing
2021 , isVisible
2122 , label
2223 , layout
24+ , link
2325 , maximum
2426 , minimum
2527 , moveDown
@@ -36,10 +38,14 @@ module Testable.Element exposing
3638 , rgb
3739 , rgba
3840 , row
41+ , scrollbarX
42+ , scrollbarY
43+ , scrollbars
3944 , shrink
4045 , spacing
4146 , text
4247 , textColumn
48+ , toProgram
4349 , transparent
4450 , width
4551 )
@@ -63,11 +69,16 @@ import Testable
6369import Testable.Runner
6470
6571
66−layout : List (Testable.Attr msg) -> Testable.Element Testable.Runner.Msg -> Testable.Runner.TestableProgram
72+{-| This is used when we want to run all tests in a test suite instead of one at a time.
73+-}
74+toProgram : Testable.Runner.Testable -> Testable.Runner.TestableProgram
75+toProgram testable =
76+ Testable.Runner.program [ testable ]
77+
78+
79+layout : List (Testable.Attr msg) -> Testable.Element Testable.Runner.Msg -> Testable.Runner.Testable
6780layout attrs elem =
68− Testable.Runner.program
69− [ ( "Tests Run", elem )
70− ]
81+ Testable.Runner.testable "Test" elem
7182
7283
7384text : String -> Testable.Element msg
@@ -96,13 +107,60 @@ none =
96107
97108
98109paragraph : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
99−paragraph =
100− Testable.Paragraph
110+paragraph attrs =
111+ let
112+ withImplicits =
113+ implicitTest (widthHelper Nothing Nothing (Fill 1))
114+ :: implicitTest (heightHelper Nothing Nothing Shrink)
115+ :: attrs
116+ in
117+ Testable.Paragraph (skipOverridden withImplicits)
101118
102119
103120textColumn : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
104121textColumn attrs =
105− Testable.TextColumn (implicitWidthHeightShrink attrs)
122+ let
123+ withImplicits =
124+ implicitTest (widthHelper (Just 500) (Just 750) (Fill 1))
125+ :: implicitTest (heightHelper Nothing Nothing Shrink)
126+ :: attrs
127+ in
128+ Testable.TextColumn (skipOverridden withImplicits)
129+
130+
131+link :
132+ List (Testable.Attr msg)
133+ ->
134+ { url : String
135+ , label : Testable.Element msg
136+ }
137+ -> Testable.Element msg
138+link attrs details =
139+ Testable.Link details.url
140+ (implicitWidthHeightShrink attrs)
141+ details.label
142+
143+
144+clip =
145+ Testable.Attr Element.clip
146+
147+
148+{-| -}
149+scrollbars : Testable.Attr msg
150+scrollbars =
151+ Testable.Attr Element.scrollbars
152+
153+
154+{-| -}
155+scrollbarY : Testable.Attr msg
156+scrollbarY =
157+ Testable.Attr Element.scrollbarY
158+
159+
160+{-| -}
161+scrollbarX : Testable.Attr msg
162+scrollbarX =
163+ Testable.Attr Element.scrollbarX
106164
107165
108166{-| Old labeling mechanism that i removed to hastily
@@ -276,6 +334,11 @@ paddingXY x y =
276334 }
277335
278336
337+listIf ls =
338+ List.filter Tuple.first ls
339+ |> List.map Tuple.second
340+
341+
279342widthHelper maybeMin maybeMax len =
280343 let
281344 addMin l =
@@ -344,7 +407,10 @@ widthHelper maybeMin maybeMax len =
344407 )
345408 , test =
346409 \found ->
347− [ Testable.true "exact width is exact" (floor found.self.bbox.width == val)
410+ [ expectRoundedEquality
411+ { expected = toFloat val
412+ , found = found.self.bbox.width
413+ }
348414 , Testable.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
349415 ]
350416 }
@@ -366,7 +432,7 @@ widthHelper maybeMin maybeMax len =
366432 )
367433 , test =
368434 \context ->
369− if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
435+ if List.member context.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
370436 [ Testable.true "width fill doesn't apply to onright/onleft elements" True ]
371437
372438 else
@@ -374,33 +440,93 @@ widthHelper maybeMin maybeMax len =
374440 parentAvailableWidth =
375441 context.parent.bbox.width - (context.self.bbox.padding.left + context.self.bbox.padding.right)
376442 in
377− [ case context.location of
378− Testable.IsNearby _ ->
379− Testable.true "Nearby Element has fill width"
380− ((floor context.parent.bbox.width == floor context.self.bbox.width)
381− || minMaxTest (floor context.self.bbox.width)
382− )
383−
384− Testable.InColumn ->
385− Testable.true "Element within column has fill width"
386− ((floor parentAvailableWidth == floor context.self.bbox.width)
387− || minMaxTest (floor context.self.bbox.width)
388− )
389−
390− Testable.InEl ->
391− Testable.true "Element within element has fill width" <|
392− (floor parentAvailableWidth == floor context.self.bbox.width)
393− || minMaxTest (floor context.self.bbox.width)
394−
395− _ ->
396− let
397− spacePerPortion =
398− parentAvailableWidth / toFloat (List.length context.siblings + 1)
399− in
400− Testable.true "element has fill width" <|
401− (floor spacePerPortion == floor context.self.bbox.width)
402− || minMaxTest (floor context.self.bbox.width)
403− ]
443+ List.concat
444+ [ case context.parentLayout of
445+ Testable.IsNearby _ ->
446+ [ Testable.true "Nearby Element has fill width"
447+ ((floor context.parent.bbox.width == floor context.self.bbox.width)
448+ || minMaxTest (floor context.self.bbox.width)
449+ )
450+ ]
451+
452+ Testable.InColumn ->
453+ [ Testable.true "Element within column has fill width"
454+ ((floor parentAvailableWidth == floor context.self.bbox.width)
455+ || minMaxTest (floor context.self.bbox.width)
456+ )
457+ ]
458+
459+ Testable.InEl ->
460+ [ Testable.true "Element within element has fill width" <|
461+ (floor parentAvailableWidth == floor context.self.bbox.width)
462+ || minMaxTest (floor context.self.bbox.width)
463+ ]
464+
465+ _ ->
466+ let
467+ spacePerPortion =
468+ parentAvailableWidth / toFloat (List.length context.siblings + 1)
469+ in
470+ [ Testable.true "element has fill width" <|
471+ (floor spacePerPortion == floor context.self.bbox.width)
472+ || minMaxTest (floor context.self.bbox.width)
473+ ]
474+ , [ Testable.lessThanOrEqual "not larger than parent"
475+ context.self.bbox.width
476+ context.parent.bbox.width
477+ ]
478+ , case context.selfElement of
479+ Testable.Paragraph _ _ ->
480+ -- A paragraph with width fill
481+ -- we want to test for correct text wrapping here.
482+ --
483+ let
484+ childWidth child =
485+ child.bbox.width
486+
487+ totalChildren =
488+ context.children
489+ |> List.map childWidth
490+ |> List.append (List.map .width context.self.textMetrics)
491+ |> List.sum
492+
493+ horizontalPadding =
494+ context.self.bbox.padding.left + context.self.bbox.padding.right
495+
496+ totalCalculatedWidth =
497+ totalChildren + horizontalPadding
498+
499+ expectedLines =
500+ if boxChildrenHeight > 20 then
501+ ceiling (boxChildrenHeight / 20)
502+
503+ else
504+ ceiling (totalCalculatedWidth / context.self.bbox.width)
505+
506+ boxChildrenHeight =
507+ context.children
508+ |> List.map
509+ (\c ->
510+ c.bbox.height
511+ )
512+ |> List.sum
513+ in
514+ [ Testable.true "text wrapping, checking height"
515+ -- all we're doing here is testing if wrapping is occurring
516+ -- not the exact height, which is a little tricky to calculate perfectly without more information.
517+ (if expectedLines > 1 then
518+ context.self.bbox.height >= (20 * 2)
519+
520+ else
521+ -- then it's less than 2 ~ line heights
522+ -- there's some weird variance here which makes it hard to be exact.
523+ context.self.bbox.height < (20 * 2)
524+ )
525+ ]
526+
527+ _ ->
528+ []
529+ ]
404530 }
405531
406532 Shrink ->
@@ -415,36 +541,208 @@ widthHelper maybeMin maybeMax len =
415541 , id = Testable.IsWidth
416542 , test =
417543 \context ->
418− let
419− childWidth child =
420− -- TODO: add margin values to widths
421− child.bbox.width
422−
423− totalChildren =
424− context.children
425− |> List.map childWidth
426− |> List.sum
427−
428− horizontalPadding =
429− context.self.bbox.padding.left + context.self.bbox.padding.right
430−
431− spacingValue =
432− toFloat context.parentSpacing * (toFloat (List.length context.children) - 1)
433− in
434− if totalChildren == 0 then
435− -- TODO: The issue is that we have a hard time measuring `text` elements
436− -- So if a element has a text child, then it's width isn't going to show up in the system.
437− [ Testable.Todo "Calculate text size for width-shrink calculation"
438− ]
544+ case context.selfElement of
545+ Testable.El _ _ ->
546+ let
547+ childWidth child =
548+ child.bbox.width
549+
550+ totalChildren =
551+ context.children
552+ |> List.map childWidth
553+ |> List.append (List.map .width context.self.textMetrics)
554+ |> List.sum
555+
556+ horizontalPadding =
557+ context.self.bbox.padding.left + context.self.bbox.padding.right
558+ in
559+ listIf
560+ [ ( (context.parentLayout /= Testable.InParagraph)
561+ && (context.parentLayout /= Testable.InTextCol)
562+ , Testable.rounded "equals children"
563+ { expected = totalChildren + horizontalPadding
564+ , found = context.self.bbox.width
565+ }
566+ )
567+ , ( context.parentLayout /= Testable.AtRoot
568+ , Testable.lessThanOrEqual "not larger than parent"
569+ context.self.bbox.width
570+ context.parent.bbox.width
571+ )
572+ ]
439573
440− else
441− -- This fails if this element is actually a column
442− -- So we need to capture what this element is in order to do this calculation.
443− [ expectRoundedEquality
444− { expected = totalChildren + horizontalPadding + spacingValue
445− , found = context.self.bbox.width
446− }
447− ]
574+ Testable.Link _ _ _ ->
575+ let
576+ childWidth child =
577+ child.bbox.width
578+
579+ totalChildren =
580+ context.children
581+ |> List.map childWidth
582+ |> List.append (List.map .width context.self.textMetrics)
583+ |> List.sum
584+
585+ horizontalPadding =
586+ context.self.bbox.padding.left + context.self.bbox.padding.right
587+ in
588+ listIf
589+ [ ( (context.parentLayout /= Testable.InParagraph)
590+ && (context.parentLayout /= Testable.InTextCol)
591+ , Testable.rounded "equals children"
592+ { expected = totalChildren + horizontalPadding
593+ , found = context.self.bbox.width
594+ }
595+ )
596+ , ( context.parentLayout /= Testable.AtRoot
597+ , Testable.lessThanOrEqual "not larger than parent"
598+ context.self.bbox.width
599+ context.parent.bbox.width
600+ )
601+ ]
602+
603+ Testable.Row rowAttrs _ ->
604+ -- width of row is the sum of all children widths
605+ -- both text elements and others.
606+ let
607+ childWidth child =
608+ child.bbox.width
609+
610+ totalChildren =
611+ context.children
612+ |> List.map childWidth
613+ |> List.append (List.map .width context.self.textMetrics)
614+ |> List.sum
615+
616+ horizontalPadding =
617+ context.self.bbox.padding.left + context.self.bbox.padding.right
618+
619+ spacingAmount =
620+ Testable.getSpacingFromAttributes rowAttrs
621+
622+ totalSpacing =
623+ toFloat spacingAmount * (toFloat (List.length context.children) - 1)
624+ in
625+ listIf
626+ [ ( True
627+ , expectRoundedEquality
628+ { expected = totalChildren + horizontalPadding + totalSpacing
629+ , found = context.self.bbox.width
630+ }
631+ )
632+ , ( context.parentLayout /= Testable.AtRoot
633+ , Testable.lessThanOrEqual "not larger than parent"
634+ context.self.bbox.width
635+ context.parent.bbox.width
636+ )
637+ ]
638+
639+ Testable.Column _ _ ->
640+ -- The width of the column is the width of the widest child.
641+ let
642+ childWidth child =
643+ child.bbox.width
644+ + context.self.bbox.padding.left
645+ + context.self.bbox.padding.right
646+
647+ textChildren =
648+ List.map
649+ (\txt ->
650+ txt.width
651+ + context.self.bbox.padding.left
652+ + context.self.bbox.padding.right
653+ )
654+ context.self.textMetrics
655+
656+ allChildren =
657+ context.children
658+ |> List.map childWidth
659+ |> List.append textChildren
660+ in
661+ listIf
662+ [ ( True
663+ , expectRoundedEquality
664+ { expected = Maybe.withDefault 0 (List.maximum allChildren)
665+ , found = context.self.bbox.width
666+ }
667+ )
668+ , ( context.parentLayout /= Testable.AtRoot
669+ , Testable.lessThanOrEqual "not larger than parent"
670+ context.self.bbox.width
671+ context.parent.bbox.width
672+ )
673+ ]
674+
675+ Testable.TextColumn _ _ ->
676+ -- The width of the column is the width of the widest child.
677+ let
678+ childWidth child =
679+ child.bbox.width
680+ + context.self.bbox.padding.left
681+ + context.self.bbox.padding.right
682+
683+ textChildren =
684+ List.map
685+ (\txt ->
686+ txt.width
687+ + context.self.bbox.padding.left
688+ + context.self.bbox.padding.right
689+ )
690+ context.self.textMetrics
691+
692+ allChildren =
693+ context.children
694+ |> List.map childWidth
695+ |> List.append textChildren
696+ in
697+ listIf
698+ [ ( True
699+ , expectRoundedEquality
700+ { expected = Maybe.withDefault 0 (List.maximum allChildren)
701+ , found = context.self.bbox.width
702+ }
703+ )
704+ , ( context.parentLayout /= Testable.AtRoot
705+ , Testable.lessThanOrEqual "not larger than parent"
706+ context.self.bbox.width
707+ context.parent.bbox.width
708+ )
709+ ]
710+
711+ Testable.Paragraph _ _ ->
712+ -- This should be the size it's text,
713+ -- unless it takes up all available space, in which case it should wrap.
714+ let
715+ childWidth child =
716+ child.bbox.width
717+
718+ totalChildren =
719+ context.children
720+ |> List.map childWidth
721+ |> List.append (List.map .width context.self.textMetrics)
722+ |> List.sum
723+
724+ horizontalPadding =
725+ context.self.bbox.padding.left + context.self.bbox.padding.right
726+ in
727+ listIf
728+ [ ( True
729+ , expectRoundedEquality
730+ { expected = totalChildren + horizontalPadding
731+ , found = context.self.bbox.width
732+ }
733+ )
734+ , ( context.parentLayout /= Testable.AtRoot
735+ , Testable.lessThanOrEqual "not larger than parent"
736+ context.self.bbox.width
737+ context.parent.bbox.width
738+ )
739+ ]
740+
741+ Testable.Text _ ->
742+ []
743+
744+ Testable.Empty ->
745+ []
448746 }
449747
450748
@@ -516,8 +814,10 @@ heightHelper maybeMin maybeMax len =
516814 , id = Testable.IsHeight
517815 , test =
518816 \found ->
519− [ Testable.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
520− (floor found.self.bbox.height == val)
817+ [ expectRoundedEquality
818+ { expected = toFloat val
819+ , found = found.self.bbox.height
820+ }
521821 , Testable.true "min/max holds true"
522822 (minMaxTest (floor found.self.bbox.height))
523823 ]
@@ -535,7 +835,7 @@ heightHelper maybeMin maybeMax len =
535835 , id = Testable.IsHeight
536836 , test =
537837 \context ->
538− [ if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
838+ [ if List.member context.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
539839 Testable.true "height fill doesn't apply to above/below elements" True
540840
541841 else
@@ -543,7 +843,7 @@ heightHelper maybeMin maybeMax len =
543843 parentAvailableHeight =
544844 context.parent.bbox.height - (context.self.bbox.padding.top + context.self.bbox.padding.bottom)
545845 in
546− case context.location of
846+ case context.parentLayout of
547847 Testable.IsNearby _ ->
548848 Testable.true "Nearby Element has fill height"
549849 ((floor context.parent.bbox.height == floor context.self.bbox.height)
@@ -584,36 +884,131 @@ heightHelper maybeMin maybeMax len =
584884 , id = Testable.IsHeight
585885 , test =
586886 \context ->
587− let
588− childHeight child =
589− -- TODO: add margin values to heights
590− child.bbox.height
591−
592− totalChildren =
593− context.children
594− |> List.map childHeight
595− |> List.sum
596−
597− verticalPadding =
598− context.self.bbox.padding.top + context.self.bbox.padding.bottom
599−
600− spacingValue =
601− toFloat context.parentSpacing * (toFloat (List.length context.children) - 1)
602− in
603− if totalChildren == 0 then
604− -- TODO: The issue is that we have a hard time measuring `text` elements
605− -- So if a element has a text child, then it's height isn't going to show up in the system.
606− [ Testable.Todo "Calculate expected height shrink"
607− ]
887+ case context.selfElement of
888+ Testable.El _ _ ->
889+ let
890+ childHeight child =
891+ child.bbox.height
892+ in
893+ if List.isEmpty context.children then
894+ -- context.self.textMetrics
895+ -- |> List.map Testable.textHeight
896+ -- |> List.sum
897+ -- TODO: apparently the font metrics we have are for the literal characters rendered
898+ -- not for the font itself.
899+ [ Testable.todo "calculate height from actual text metrics"
900+ ]
608901
609− else
610− -- This fails if this element is actually a column
611− -- So we need to capture what this element is in order to do this calculation.
612− [ expectRoundedEquality
613− { expected = totalChildren + verticalPadding + spacingValue
614− , found = context.self.bbox.height
615− }
616− ]
902+ else
903+ [ expectRoundedEquality
904+ { expected =
905+ context.children
906+ |> List.map childHeight
907+ |> List.sum
908+ |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
909+ , found = context.self.bbox.height
910+ }
911+ , Testable.lessThanOrEqual "not larger than parent"
912+ context.self.bbox.height
913+ context.parent.bbox.height
914+ ]
915+
916+ Testable.Link _ _ _ ->
917+ let
918+ childHeight child =
919+ child.bbox.height
920+ in
921+ if List.isEmpty context.children then
922+ -- context.self.textMetrics
923+ -- |> List.map Testable.textHeight
924+ -- |> List.sum
925+ -- TODO: apparently the font metrics we have are for the literal characters rendered
926+ -- not for the font itself.
927+ [ Testable.todo "calculate height from actual text metrics"
928+ ]
929+
930+ else
931+ [ expectRoundedEquality
932+ { expected =
933+ context.children
934+ |> List.map childHeight
935+ |> List.sum
936+ |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
937+ , found = context.self.bbox.height
938+ }
939+ , Testable.lessThanOrEqual "not larger than parent"
940+ context.self.bbox.height
941+ context.parent.bbox.height
942+ ]
943+
944+ Testable.Row _ _ ->
945+ let
946+ childHeight child =
947+ child.bbox.height
948+ in
949+ if List.isEmpty context.children then
950+ -- context.self.textMetrics
951+ -- |> List.map Testable.textHeight
952+ -- |> List.sum
953+ -- TODO: apparently the font metrics we have are for the literal characters rendered
954+ -- not for the font itself.
955+ [ Testable.todo "calculate height from actual text metrics" ]
956+
957+ else
958+ [ expectRoundedEquality
959+ { expected =
960+ context.children
961+ |> List.map childHeight
962+ |> List.maximum
963+ |> Maybe.withDefault 0
964+ |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
965+ , found = context.self.bbox.height
966+ }
967+ , Testable.lessThanOrEqual "not larger than parent"
968+ context.self.bbox.height
969+ context.parent.bbox.height
970+ ]
971+
972+ Testable.Column colAttrs _ ->
973+ let
974+ childHeight child =
975+ child.bbox.height
976+
977+ totalChildren =
978+ context.children
979+ |> List.map childHeight
980+ |> List.append (List.map Testable.textHeight context.self.textMetrics)
981+ |> List.sum
982+
983+ verticalPadding =
984+ context.self.bbox.padding.top + context.self.bbox.padding.bottom
985+
986+ spacingAmount =
987+ Testable.getSpacingFromAttributes colAttrs
988+
989+ totalSpacing =
990+ toFloat spacingAmount * (toFloat (List.length context.children) - 1)
991+ in
992+ [ expectRoundedEquality
993+ { expected = totalChildren + verticalPadding + totalSpacing
994+ , found = context.self.bbox.height
995+ }
996+ , Testable.lessThanOrEqual "not larger than parent"
997+ context.self.bbox.height
998+ context.parent.bbox.height
999+ ]
1000+
1001+ Testable.TextColumn _ _ ->
1002+ []
1003+
1004+ Testable.Paragraph _ _ ->
1005+ []
1006+
1007+ Testable.Text _ ->
1008+ []
1009+
1010+ Testable.Empty ->
1011+ []
6171012 }
6181013
6191014
@@ -716,11 +1111,11 @@ alignLeft =
7161111 , id = Testable.NoId
7171112 , test =
7181113 \found ->
719− [ if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
1114+ [ if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
7201115 Testable.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
7211116
7221117 else if
723− List.member found.location
1118+ List.member found.parentLayout
7241119 [ Testable.IsNearby Testable.InFront
7251120 , Testable.IsNearby Testable.Behind
7261121 , Testable.IsNearby Testable.Above
@@ -739,7 +1134,7 @@ alignLeft =
7391134 }
7401135
7411136 else
742− case found.location of
1137+ case found.parentLayout of
7431138 Testable.InRow ->
7441139 let
7451140 siblingsOnLeft =
@@ -785,7 +1180,7 @@ centerX =
7851180 parentCenter =
7861181 found.parent.bbox.left + (found.parent.bbox.width / 2)
7871182 in
788− if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
1183+ if List.member found.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
7891184 [ Testable.true "centerX doesn't apply to elements that are onLeft or onRight" True ]
7901185
7911186 else if List.length found.siblings == 0 then
@@ -796,7 +1191,7 @@ centerX =
7961191 ]
7971192
7981193 else
799− case found.location of
1194+ case found.parentLayout of
8001195 Testable.InRow ->
8011196 let
8021197 siblingsOnLeft =
@@ -850,11 +1245,11 @@ alignRight =
8501245 , id = Testable.NoId
8511246 , test =
8521247 \found ->
853− if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
1248+ if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
8541249 [ Testable.true "alignRight doesn't apply to elements that are onLeft or onRight" True ]
8551250
8561251 else if
857− List.member found.location
1252+ List.member found.parentLayout
8581253 [ Testable.IsNearby Testable.InFront
8591254 , Testable.IsNearby Testable.Behind
8601255 , Testable.IsNearby Testable.Above
@@ -875,7 +1270,7 @@ alignRight =
8751270 ]
8761271
8771272 else
878− case found.location of
1273+ case found.parentLayout of
8791274 Testable.InRow ->
8801275 let
8811276 siblingsOnRight =
@@ -913,11 +1308,11 @@ alignTop =
9131308 , id = Testable.NoId
9141309 , test =
9151310 \found ->
916− if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1311+ if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
9171312 [ Testable.true "alignTop doesn't apply to elements that are above or below" True ]
9181313
9191314 else if
920− List.member found.location
1315+ List.member found.parentLayout
9211316 [ Testable.IsNearby Testable.InFront
9221317 , Testable.IsNearby Testable.Behind
9231318 , Testable.IsNearby Testable.OnRight
@@ -938,7 +1333,7 @@ alignTop =
9381333 ]
9391334
9401335 else
941− case found.location of
1336+ case found.parentLayout of
9421337 Testable.InColumn ->
9431338 let
9441339 siblingsAbove =
@@ -976,11 +1371,11 @@ alignBottom =
9761371 , id = Testable.NoId
9771372 , test =
9781373 \found ->
979− if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1374+ if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
9801375 [ Testable.true "alignBottom doesn't apply to elements that are above or below" True ]
9811376
9821377 else if
983− List.member found.location
1378+ List.member found.parentLayout
9841379 [ Testable.IsNearby Testable.InFront
9851380 , Testable.IsNearby Testable.Behind
9861381 , Testable.IsNearby Testable.OnRight
@@ -1001,7 +1396,7 @@ alignBottom =
10011396 ]
10021397
10031398 else
1004− case found.location of
1399+ case found.parentLayout of
10051400 Testable.InColumn ->
10061401 let
10071402 siblingsBelow =
@@ -1058,7 +1453,7 @@ centerY =
10581453 parentCenter =
10591454 found.parent.bbox.top + (found.parent.bbox.height / 2)
10601455 in
1061− if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1456+ if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
10621457 [ Testable.true "centerY doesn't apply to elements that are above or below" True ]
10631458
10641459 else if List.length found.siblings == 0 then
@@ -1069,7 +1464,7 @@ centerY =
10691464 ]
10701465
10711466 else
1072− case found.location of
1467+ case found.parentLayout of
10731468 Testable.InColumn ->
10741469 let
10751470 siblingsOnTop =