@@ -23,6 +23,8 @@ module Testable.Element exposing
25 , moveDown
25 , moveDown
@@ -104,6 +106,12 @@ textColumn =
104 Testable.TextColumn
106 Testable.TextColumn
109+{-| Old labeling mechanism that i removed to hastily
107moveUp x =
115moveUp x =
108 Testable.Attr (Element.moveUp x)
116 Testable.Attr (Element.moveUp x)
@@ -112,6 +120,14 @@ moveDown x =
112 Testable.Attr (Element.moveDown x)
120 Testable.Attr (Element.moveDown x)
124+ Testable.Attr (Element.moveRight x)
128+ Testable.Attr (Element.moveLeft x)
115type Length
131type Length
117 | Fill Int
133 | Fill Int
@@ -156,11 +172,6 @@ fillPortion =
159−label : String -> Testable.Attr msg
164transparent : Bool -> Testable.Attr msg
175transparent : Bool -> Testable.Attr msg
165transparent on =
176transparent on =
166 Testable.LabeledTest
177 Testable.LabeledTest
@@ -172,7 +183,7 @@ transparent on =
173 , attr = Element.transparent on
184 , attr = Element.transparent on
175− \context _ ->
186+ \context ->
177 selfTransparency =
188 selfTransparency =
178 context.self.style
189 context.self.style
@@ -186,7 +197,7 @@ transparent on =
189− Expect.equal value selfTransparency
200+ [ Testable.equal value selfTransparency ]
@@ -197,8 +208,8 @@ isVisible =
197 { label = "is-visible"
208 { label = "is-visible"
198 , attr = Element.htmlAttribute (Html.Attributes.style "not" "applicable")
209 , attr = Element.htmlAttribute (Html.Attributes.style "not" "applicable")
200− \context _ ->
211+ \context ->
201− Expect.equal context.self.isVisible True
212+ [ Testable.equal context.self.isVisible True ]
@@ -209,14 +220,14 @@ alpha a =
209 { label = "alpha-" ++ String.fromFloat a
220 { label = "alpha-" ++ String.fromFloat a
210 , attr = Element.alpha a
221 , attr = Element.alpha a
212− \context _ ->
223+ \context ->
214 selfTransparency =
225 selfTransparency =
215 context.self.style
226 context.self.style
216 |> Dict.get "opacity"
227 |> Dict.get "opacity"
217 |> Maybe.withDefault "notfound"
228 |> Maybe.withDefault "notfound"
219− Expect.equal (String.fromFloat a) selfTransparency
230+ [ Testable.equal (String.fromFloat a) selfTransparency ]
@@ -227,8 +238,8 @@ padding pad =
227 { label = "padding " ++ String.fromInt pad
238 { label = "padding " ++ String.fromInt pad
228 , attr = Element.padding pad
239 , attr = Element.padding pad
230− \found _ ->
241+ \found ->
231− Expect.true ("Padding " ++ String.fromInt pad ++ " is present")
242+ [ Testable.true ("Padding " ++ String.fromInt pad ++ " is present")
232 (List.all ((==) pad)
243 (List.all ((==) pad)
233 [ floor found.self.bbox.padding.left
244 [ floor found.self.bbox.padding.left
234 , floor found.self.bbox.padding.right
245 , floor found.self.bbox.padding.right
@@ -236,6 +247,7 @@ padding pad =
236 , floor found.self.bbox.padding.bottom
247 , floor found.self.bbox.padding.bottom
@@ -246,8 +258,8 @@ paddingXY x y =
246 { label = "paddingXY " ++ String.fromInt x ++ ", " ++ String.fromInt y
258 { label = "paddingXY " ++ String.fromInt x ++ ", " ++ String.fromInt y
247 , attr = Element.paddingXY x y
259 , attr = Element.paddingXY x y
249− \found _ ->
261+ \found ->
250− Expect.true ("PaddingXY (" ++ String.fromInt x ++ ", " ++ String.fromInt y ++ ") is present")
262+ [ Testable.true ("PaddingXY (" ++ String.fromInt x ++ ", " ++ String.fromInt y ++ ") is present")
251 (List.all ((==) x)
263 (List.all ((==) x)
252 [ floor found.self.bbox.padding.left
264 [ floor found.self.bbox.padding.left
253 , floor found.self.bbox.padding.right
265 , floor found.self.bbox.padding.right
@@ -257,6 +269,7 @@ paddingXY x y =
257 , floor found.self.bbox.padding.bottom
269 , floor found.self.bbox.padding.bottom
@@ -326,18 +339,20 @@ widthHelper maybeMin maybeMax len =
326 |> addMax
339 |> addMax
329− \found _ ->
342+ \found ->
332− Expect.true "exact width is exact" (floor found.self.bbox.width == val)
343+ [ Testable.true "exact width is exact" (floor found.self.bbox.width == val)
333− , \_ -> Expect.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
344+ , Testable.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
338 Fill portion ->
348 Fill portion ->
339 Testable.LabeledTest
349 Testable.LabeledTest
351+ if portion == 1 then
352+ "width fill" ++ minLabel ++ maxLabel
340− { label = "width fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
355+ "width fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
342 Element.width
357 Element.width
343 (Element.fillPortion portion
358 (Element.fillPortion portion
@@ -345,30 +360,30 @@ widthHelper maybeMin maybeMax len =
345 |> addMax
360 |> addMax
348− \context _ ->
363+ \context ->
349 if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
364 if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
350− Expect.true "width fill doesn't apply to onright/onleft elements" True
365+ [ Testable.true "width fill doesn't apply to onright/onleft elements" True ]
354 parentAvailableWidth =
369 parentAvailableWidth =
355 context.parent.bbox.width - (context.self.bbox.padding.left + context.self.bbox.padding.right)
370 context.parent.bbox.width - (context.self.bbox.padding.left + context.self.bbox.padding.right)
357− case context.location of
372+ [ case context.location of
358 Testable.IsNearby _ ->
373 Testable.IsNearby _ ->
359− Expect.true "Nearby Element has fill width"
374+ Testable.true "Nearby Element has fill width"
360 ((floor context.parent.bbox.width == floor context.self.bbox.width)
375 ((floor context.parent.bbox.width == floor context.self.bbox.width)
361 || minMaxTest (floor context.self.bbox.width)
376 || minMaxTest (floor context.self.bbox.width)
364 Testable.InColumn ->
379 Testable.InColumn ->
365− Expect.true "Element within column has fill width"
380+ Testable.true "Element within column has fill width"
366 ((floor parentAvailableWidth == floor context.self.bbox.width)
381 ((floor parentAvailableWidth == floor context.self.bbox.width)
367 || minMaxTest (floor context.self.bbox.width)
382 || minMaxTest (floor context.self.bbox.width)
370 Testable.InEl ->
385 Testable.InEl ->
371− Expect.true "Element within element has fill width" <|
386+ Testable.true "Element within element has fill width" <|
372 (floor parentAvailableWidth == floor context.self.bbox.width)
387 (floor parentAvailableWidth == floor context.self.bbox.width)
373 || minMaxTest (floor context.self.bbox.width)
388 || minMaxTest (floor context.self.bbox.width)
@@ -377,9 +392,10 @@ widthHelper maybeMin maybeMax len =
377 spacePerPortion =
392 spacePerPortion =
378 parentAvailableWidth / toFloat (List.length context.siblings + 1)
393 parentAvailableWidth / toFloat (List.length context.siblings + 1)
380− Expect.true "element has fill width" <|
395+ Testable.true "element has fill width" <|
381 (floor spacePerPortion == floor context.self.bbox.width)
396 (floor spacePerPortion == floor context.self.bbox.width)
382 || minMaxTest (floor context.self.bbox.width)
397 || minMaxTest (floor context.self.bbox.width)
385 Shrink ->
401 Shrink ->
@@ -392,7 +408,7 @@ widthHelper maybeMin maybeMax len =
392 |> addMax
408 |> addMax
395− \context _ ->
411+ \context ->
397 childWidth child =
413 childWidth child =
398 -- TODO: add margin values to widths
414 -- TODO: add margin values to widths
@@ -412,12 +428,12 @@ widthHelper maybeMin maybeMax len =
412 if totalChildren == 0 then
428 if totalChildren == 0 then
413 -- TODO: The issue is that we have a hard time measuring `text` elements
429 -- TODO: The issue is that we have a hard time measuring `text` elements
414 -- So if a element has a text child, then it's width isn't going to show up in the system.
430 -- So if a element has a text child, then it's width isn't going to show up in the system.
415− expectRoundedEquality context.self.bbox.width context.self.bbox.width
431+ [ expectRoundedEquality context.self.bbox.width context.self.bbox.width ]
418 -- This fails if this element is actually a column
434 -- This fails if this element is actually a column
419 -- So we need to capture what this element is in order to do this calculation.
435 -- So we need to capture what this element is in order to do this calculation.
420− expectRoundedEquality (totalChildren + horizontalPadding + spacingValue) context.self.bbox.width
436+ [ expectRoundedEquality (totalChildren + horizontalPadding + spacingValue) context.self.bbox.width ]
@@ -487,16 +503,12 @@ heightHelper maybeMin maybeMax len =
487 |> addMax
503 |> addMax
490− \found _ ->
506+ \found ->
493− Expect.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
507+ [ Testable.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
494− (floor found.self.bbox.height == val)
508+ (floor found.self.bbox.height == val)
496− Expect.true "min/max holds true"
509+ , Testable.true "min/max holds true"
497− (minMaxTest (floor found.self.bbox.height))
510+ (minMaxTest (floor found.self.bbox.height))
502 Fill portion ->
514 Fill portion ->
@@ -509,30 +521,30 @@ heightHelper maybeMin maybeMax len =
509 |> addMax
521 |> addMax
512− \context _ ->
524+ \context ->
513− if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
525+ [ if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
514− Expect.true "height fill doesn't apply to above/below elements" True
526+ Testable.true "height fill doesn't apply to above/below elements" True
518 parentAvailableHeight =
530 parentAvailableHeight =
519 context.parent.bbox.height - (context.self.bbox.padding.top + context.self.bbox.padding.bottom)
531 context.parent.bbox.height - (context.self.bbox.padding.top + context.self.bbox.padding.bottom)
521 case context.location of
533 case context.location of
522 Testable.IsNearby _ ->
534 Testable.IsNearby _ ->
523− Expect.true "Nearby Element has fill height"
535+ Testable.true "Nearby Element has fill height"
524 ((floor context.parent.bbox.height == floor context.self.bbox.height)
536 ((floor context.parent.bbox.height == floor context.self.bbox.height)
525 || minMaxTest (floor context.self.bbox.height)
537 || minMaxTest (floor context.self.bbox.height)
528 Testable.InColumn ->
540 Testable.InColumn ->
529− Expect.true "Element within column has fill height"
541+ Testable.true "Element within column has fill height"
530 ((floor parentAvailableHeight == floor context.self.bbox.height)
542 ((floor parentAvailableHeight == floor context.self.bbox.height)
531 || minMaxTest (floor context.self.bbox.height)
543 || minMaxTest (floor context.self.bbox.height)
534 Testable.InEl ->
546 Testable.InEl ->
535− Expect.true "Element within el has fill height" <|
547+ Testable.true "Element within el has fill height" <|
536 (floor parentAvailableHeight == floor context.self.bbox.height)
548 (floor parentAvailableHeight == floor context.self.bbox.height)
537 || minMaxTest (floor context.self.bbox.height)
549 || minMaxTest (floor context.self.bbox.height)
@@ -541,9 +553,10 @@ heightHelper maybeMin maybeMax len =
541 spacePerPortion =
553 spacePerPortion =
542 parentAvailableHeight / toFloat (List.length context.siblings + 1)
554 parentAvailableHeight / toFloat (List.length context.siblings + 1)
544− Expect.true "el has fill height" <|
556+ Testable.true "el has fill height" <|
545 (floor spacePerPortion == floor context.self.bbox.height)
557 (floor spacePerPortion == floor context.self.bbox.height)
546 || minMaxTest (floor context.self.bbox.height)
558 || minMaxTest (floor context.self.bbox.height)
549 Shrink ->
562 Shrink ->
@@ -556,7 +569,7 @@ heightHelper maybeMin maybeMax len =
556 |> addMax
569 |> addMax
559− \context _ ->
572+ \context ->
561 childWidth child =
574 childWidth child =
562 -- TODO: add margin values to heights
575 -- TODO: add margin values to heights
@@ -576,12 +589,12 @@ heightHelper maybeMin maybeMax len =
576 if totalChildren == 0 then
589 if totalChildren == 0 then
577 -- TODO: The issue is that we have a hard time measuring `text` elements
590 -- TODO: The issue is that we have a hard time measuring `text` elements
578 -- So if a element has a text child, then it's height isn't going to show up in the system.
591 -- So if a element has a text child, then it's height isn't going to show up in the system.
579− expectRoundedEquality context.self.bbox.height context.self.bbox.height
592+ [ expectRoundedEquality context.self.bbox.height context.self.bbox.height ]
582 -- This fails if this element is actually a column
595 -- This fails if this element is actually a column
583 -- So we need to capture what this element is in order to do this calculation.
596 -- So we need to capture what this element is in order to do this calculation.
584− expectRoundedEquality (totalChildren + verticalPadding + spacingValue) context.self.bbox.height
597+ [ expectRoundedEquality (totalChildren + verticalPadding + spacingValue) context.self.bbox.height ]
@@ -603,7 +616,7 @@ spacing space =
603 { label = "spacing: " ++ String.fromInt space
616 { label = "spacing: " ++ String.fromInt space
604 , attr = Element.spacing space
617 , attr = Element.spacing space
606− \found _ ->
619+ \found ->
608 findDistance child total =
621 findDistance child total =
609 List.concatMap
622 List.concatMap
@@ -649,7 +662,7 @@ spacing space =
650 distances
663 distances
652− Expect.true
665+ [ Testable.true
653 ("All children are at least "
666 ("All children are at least "
654 ++ String.fromInt space
667 ++ String.fromInt space
655 ++ " pixels apart."
668 ++ " pixels apart."
@@ -657,6 +670,7 @@ spacing space =
657 ++ " are not though"
670 ++ " are not though"
659 (allAreSpaced == [])
672 (allAreSpaced == [])
@@ -680,28 +694,28 @@ alignLeft =
680 { label = "alignLeft"
694 { label = "alignLeft"
681 , attr = Element.alignLeft
695 , attr = Element.alignLeft
683− \found _ ->
697+ \found ->
684− if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
698+ [ if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
685− Expect.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
699+ Testable.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
688 List.member found.location
702 List.member found.location
689 [ Testable.IsNearby Testable.InFront
703 [ Testable.IsNearby Testable.InFront
690 , Testable.IsNearby Testable.Behind
704 , Testable.IsNearby Testable.Behind
691 , Testable.IsNearby Testable.Above
705 , Testable.IsNearby Testable.Above
692 , Testable.IsNearby Testable.Below
706 , Testable.IsNearby Testable.Below
695 expectRoundedEquality
709 expectRoundedEquality
696 found.self.bbox.left
710 found.self.bbox.left
697 found.parent.bbox.left
711 found.parent.bbox.left
699− else if List.length found.siblings == 0 then
713+ else if List.length found.siblings == 0 then
700 expectRoundedEquality
714 expectRoundedEquality
701 found.self.bbox.left
715 found.self.bbox.left
702 (found.parent.bbox.left + found.parent.bbox.padding.left)
716 (found.parent.bbox.left + found.parent.bbox.padding.left)
705 case found.location of
719 case found.location of
706 Testable.InRow ->
720 Testable.InRow ->
@@ -724,6 +738,7 @@ alignLeft =
724 expectRoundedEquality
738 expectRoundedEquality
725 found.self.bbox.left
739 found.self.bbox.left
726 (found.parent.bbox.left + found.parent.bbox.padding.left)
740 (found.parent.bbox.left + found.parent.bbox.padding.left)
@@ -734,7 +749,7 @@ centerX =
734 { label = "centerX"
749 { label = "centerX"
735 , attr = Element.centerX
750 , attr = Element.centerX
737− \found _ ->
752+ \found ->
739 selfCenter : Float
754 selfCenter : Float
740 selfCenter =
755 selfCenter =
@@ -745,12 +760,13 @@ centerX =
745 found.parent.bbox.left + (found.parent.bbox.width / 2)
760 found.parent.bbox.left + (found.parent.bbox.width / 2)
747 if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
762 if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
748− Expect.true "centerX doesn't apply to elements that are onLeft or onRight" True
763+ [ Testable.true "centerX doesn't apply to elements that are onLeft or onRight" True ]
750 else if List.length found.siblings == 0 then
765 else if List.length found.siblings == 0 then
751− expectRoundedEquality
766+ [ expectRoundedEquality
752 selfCenter
767 selfCenter
753 parentCenter
768 parentCenter
756 case found.location of
772 case found.location of
@@ -783,12 +799,13 @@ centerX =
786− expectRoundedEquality
802+ [ expectRoundedEquality
787 selfCenter
803 selfCenter
788 expectedCenter
804 expectedCenter
791− expectRoundedEquality selfCenter parentCenter
808+ [ expectRoundedEquality selfCenter parentCenter ]
@@ -799,9 +816,9 @@ alignRight =
799 { label = "alignRight"
816 { label = "alignRight"
800 , attr = Element.alignRight
817 , attr = Element.alignRight
802− \found _ ->
819+ \found ->
803 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
820 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
804− Expect.true "alignRight doesn't apply to elements that are onLeft or onRight" True
821+ [ Testable.true "alignRight doesn't apply to elements that are onLeft or onRight" True ]
807 List.member found.location
824 List.member found.location
@@ -811,14 +828,16 @@ alignRight =
811 , Testable.IsNearby Testable.Below
828 , Testable.IsNearby Testable.Below
814− expectRoundedEquality
831+ [ expectRoundedEquality
815 found.self.bbox.right
832 found.self.bbox.right
816 found.parent.bbox.right
833 found.parent.bbox.right
818 else if List.length found.siblings == 0 then
836 else if List.length found.siblings == 0 then
819− expectRoundedEquality
837+ [ expectRoundedEquality
820 found.self.bbox.right
838 found.self.bbox.right
821 (found.parent.bbox.right + found.parent.bbox.padding.right)
839 (found.parent.bbox.right + found.parent.bbox.padding.right)
824 case found.location of
843 case found.location of
@@ -835,14 +854,16 @@ alignRight =
835 |> List.map (.width << .bbox)
854 |> List.map (.width << .bbox)
836 |> List.sum
855 |> List.sum
838− expectRoundedEquality
857+ [ expectRoundedEquality
839 found.self.bbox.right
858 found.self.bbox.right
840 (found.parent.bbox.right - (found.parent.bbox.padding.right + widthsOnRight + spacings))
859 (found.parent.bbox.right - (found.parent.bbox.padding.right + widthsOnRight + spacings))
843− expectRoundedEquality
863+ [ expectRoundedEquality
844 found.self.bbox.right
864 found.self.bbox.right
845 (found.parent.bbox.right + found.parent.bbox.padding.right)
865 (found.parent.bbox.right + found.parent.bbox.padding.right)
@@ -853,9 +874,9 @@ alignTop =
853 { label = "alignTop"
874 { label = "alignTop"
854 , attr = Element.alignTop
875 , attr = Element.alignTop
856− \found _ ->
877+ \found ->
857 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
878 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
858− Expect.true "alignTop doesn't apply to elements that are above or below" True
879+ [ Testable.true "alignTop doesn't apply to elements that are above or below" True ]
861 List.member found.location
882 List.member found.location
@@ -865,14 +886,16 @@ alignTop =
865 , Testable.IsNearby Testable.OnLeft
886 , Testable.IsNearby Testable.OnLeft
868− expectRoundedEquality
889+ [ expectRoundedEquality
869 found.self.bbox.top
890 found.self.bbox.top
870 found.parent.bbox.top
891 found.parent.bbox.top
872 else if List.length found.siblings == 0 then
894 else if List.length found.siblings == 0 then
873− expectRoundedEquality
895+ [ expectRoundedEquality
874 found.self.bbox.top
896 found.self.bbox.top
875 (found.parent.bbox.top + found.parent.bbox.padding.top)
897 (found.parent.bbox.top + found.parent.bbox.padding.top)
878 case found.location of
901 case found.location of
@@ -889,14 +912,16 @@ alignTop =
889 |> List.map (.height << .bbox)
912 |> List.map (.height << .bbox)
890 |> List.sum
913 |> List.sum
892− expectRoundedEquality
915+ [ expectRoundedEquality
893 found.self.bbox.top
916 found.self.bbox.top
894 (found.parent.bbox.top + (found.parent.bbox.padding.top + heightsAbove + spacings))
917 (found.parent.bbox.top + (found.parent.bbox.padding.top + heightsAbove + spacings))
897− expectRoundedEquality
921+ [ expectRoundedEquality
898 found.self.bbox.top
922 found.self.bbox.top
899 found.parent.bbox.top
923 found.parent.bbox.top
@@ -907,9 +932,9 @@ alignBottom =
907 { label = "alignBottom"
932 { label = "alignBottom"
908 , attr = Element.alignBottom
933 , attr = Element.alignBottom
910− \found _ ->
935+ \found ->
911 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
936 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
912− Expect.true "alignBottom doesn't apply to elements that are above or below" True
937+ [ Testable.true "alignBottom doesn't apply to elements that are above or below" True ]
915 List.member found.location
940 List.member found.location
@@ -919,14 +944,16 @@ alignBottom =
919 , Testable.IsNearby Testable.OnLeft
944 , Testable.IsNearby Testable.OnLeft
922− expectRoundedEquality
947+ [ expectRoundedEquality
923 found.self.bbox.bottom
948 found.self.bbox.bottom
924 found.parent.bbox.bottom
949 found.parent.bbox.bottom
926 else if List.length found.siblings == 0 then
952 else if List.length found.siblings == 0 then
927− expectRoundedEquality
953+ [ expectRoundedEquality
928 found.self.bbox.bottom
954 found.self.bbox.bottom
929 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
955 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
932 case found.location of
959 case found.location of
@@ -943,22 +970,30 @@ alignBottom =
943 |> List.map (.height << .bbox)
970 |> List.map (.height << .bbox)
944 |> List.sum
971 |> List.sum
946− expectRoundedEquality
973+ [ expectRoundedEquality
947 found.self.bbox.bottom
974 found.self.bbox.bottom
948 (found.parent.bbox.bottom - (found.parent.bbox.padding.bottom + heightsBelow + spacings))
975 (found.parent.bbox.bottom - (found.parent.bbox.padding.bottom + heightsBelow + spacings))
951− expectRoundedEquality
979+ [ expectRoundedEquality
952 found.self.bbox.bottom
980 found.self.bbox.bottom
953 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
981 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
957expectRoundedEquality x y =
986expectRoundedEquality x y =
958− Expect.true ("within 1 of each other " ++ String.fromFloat x ++ ":" ++ String.fromFloat y)
987+ Testable.true
988+ ("within 1 of each other " ++ floatToString x ++ ", " ++ floatToString y)
959 (abs (x - y) < 1)
989 (abs (x - y) < 1)
992+floatToString : Float -> String
994+ String.fromFloat (toFloat (round (x * 100)) / 100)
963centerY : Testable.Attr msg
998centerY : Testable.Attr msg
@@ -966,7 +1001,7 @@ centerY =
966 { label = "centerY"
1001 { label = "centerY"
967 , attr = Element.centerY
1002 , attr = Element.centerY
968 , test =
1003 , test =
969− \found _ ->
1004+ \found ->
971 selfCenter =
1006 selfCenter =
972 found.self.bbox.top + (found.self.bbox.height / 2)
1007 found.self.bbox.top + (found.self.bbox.height / 2)
@@ -975,12 +1010,13 @@ centerY =
975 found.parent.bbox.top + (found.parent.bbox.height / 2)
1010 found.parent.bbox.top + (found.parent.bbox.height / 2)
977 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1012 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
978− Expect.true "centerY doesn't apply to elements that are above or below" True
1013+ [ Testable.true "centerY doesn't apply to elements that are above or below" True ]
980 else if List.length found.siblings == 0 then
1015 else if List.length found.siblings == 0 then
981− expectRoundedEquality
1016+ [ expectRoundedEquality
982 selfCenter
1017 selfCenter
983 parentCenter
1018 parentCenter
986 case found.location of
1022 case found.location of
@@ -1013,12 +1049,13 @@ centerY =
1016− expectRoundedEquality
1052+ [ expectRoundedEquality
1017 selfCenter
1053 selfCenter
1018 expectedCenter
1054 expectedCenter
1021− expectRoundedEquality selfCenter parentCenter
1058+ [ expectRoundedEquality selfCenter parentCenter ]
@@ -1030,8 +1067,8 @@ above element =
1030 , element = element
1067 , element = element
1031 , label = "above"
1068 , label = "above"
1032 , test =
1069 , test =
1033− \found _ ->
1070+ \found ->
1034− expectRoundedEquality found.self.bbox.bottom found.parent.bbox.top
1071+ [ expectRoundedEquality found.self.bbox.bottom found.parent.bbox.top ]
@@ -1043,8 +1080,8 @@ below element =
1043 , element = element
1080 , element = element
1044 , label = "below"
1081 , label = "below"
1045 , test =
1082 , test =
1046− \found _ ->
1083+ \found ->
1047− expectRoundedEquality found.self.bbox.top found.parent.bbox.bottom
1084+ [ expectRoundedEquality found.self.bbox.top found.parent.bbox.bottom ]
@@ -1056,8 +1093,8 @@ onRight element =
1056 , element = element
1093 , element = element
1057 , label = "onRight"
1094 , label = "onRight"
1058 , test =
1095 , test =
1059− \found _ ->
1096+ \found ->
1060− expectRoundedEquality found.self.bbox.left found.parent.bbox.right
1097+ [ expectRoundedEquality found.self.bbox.left found.parent.bbox.right ]
@@ -1069,8 +1106,8 @@ onLeft element =
1069 , element = element
1106 , element = element
1070 , label = "onLeft"
1107 , label = "onLeft"
1071 , test =
1108 , test =
1072− \found _ ->
1109+ \found ->
1073− expectRoundedEquality found.self.bbox.right found.parent.bbox.left
1110+ [ expectRoundedEquality found.self.bbox.right found.parent.bbox.left ]
@@ -1086,11 +1123,12 @@ inFront element =
1086 , element = element
1123 , element = element
1087 , label = "inFront"
1124 , label = "inFront"
1088 , test =
1125 , test =
1089− withinHelper
1127+ [ withinHelper found ]
1093−withinHelper found _ =
1131+withinHelper found =
1095 horizontalCheck =
1133 horizontalCheck =
1096 if found.self.bbox.width > found.parent.bbox.width then
1134 if found.self.bbox.width > found.parent.bbox.width then
@@ -1114,7 +1152,7 @@ withinHelper found _ =
1114 , compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1152 , compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1117− Expect.true "within the confines of the parent"
1155+ Testable.true "within the confines of the parent"
1118 (List.all ((==) True)
1156 (List.all ((==) True)
1119 (List.concat
1157 (List.concat
1120 [ horizontalCheck
1158 [ horizontalCheck
@@ -1132,5 +1170,6 @@ behindContent element =
1132 , element = element
1170 , element = element
1133 , label = "behindContent"
1171 , label = "behindContent"
1134 , test =
1172 , test =
1135− withinHelper
1174+ [ withinHelper found ]