@@ -1040,6 +1040,10 @@ onLeft element =
10401040 }
10411041
10421042
1043+compare x vs y =
1044+ vs (round x) (round y) || vs (floor x) (floor y)
1045+
1046+
10431047{-| -}
10441048inFront : Testable.Element msg -> Testable.Attr msg
10451049inFront element =
@@ -1048,39 +1052,42 @@ inFront element =
10481052 , element = element
10491053 , label = "inFront"
10501054 , test =
1051− \found _ ->
1052− let
1053− horizontalCheck =
1054− if found.self.bbox.width > found.parent.bbox.width then
1055− [ (found.self.bbox.right <= found.parent.bbox.right)
1056− || (found.self.bbox.left >= found.parent.bbox.left)
1057− ]
1055+ withinHelper
1056+ }
10581057
1059− else
1060− [ found.self.bbox.right <= found.parent.bbox.right
1061− , found.self.bbox.left >= found.parent.bbox.left
1062− ]
10631058
1064− verticalCheck =
1065− if found.self.bbox.width > found.parent.bbox.width then
1066− [ (found.self.bbox.top >= found.parent.bbox.top)
1067− || (found.self.bbox.bottom <= found.parent.bbox.bottom)
1068− ]
1059+withinHelper found _ =
1060+ let
1061+ horizontalCheck =
1062+ if found.self.bbox.width > found.parent.bbox.width then
1063+ [ compare found.self.bbox.right (<=) found.parent.bbox.right
1064+ || compare found.self.bbox.left (>=) found.parent.bbox.left
1065+ ]
10691066
1070− else
1071− [ found.self.bbox.top >= found.parent.bbox.top
1072− , found.self.bbox.bottom <= found.parent.bbox.bottom
1073− ]
1074− in
1075− Expect.true "within the confines of the parent"
1076− (List.all ((==) True)
1077− (List.concat
1078− [ horizontalCheck
1079− , verticalCheck
1080− ]
1081− )
1082− )
1083− }
1067+ else
1068+ [ compare found.self.bbox.right (<=) found.parent.bbox.right
1069+ , compare found.self.bbox.left (>=) found.parent.bbox.left
1070+ ]
1071+
1072+ verticalCheck =
1073+ if found.self.bbox.width > found.parent.bbox.width then
1074+ [ compare found.self.bbox.top (>=) found.parent.bbox.top
1075+ || compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1076+ ]
1077+
1078+ else
1079+ [ compare found.self.bbox.top (>=) found.parent.bbox.top
1080+ , compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1081+ ]
1082+ in
1083+ Expect.true "within the confines of the parent"
1084+ (List.all ((==) True)
1085+ (List.concat
1086+ [ horizontalCheck
1087+ , verticalCheck
1088+ ]
1089+ )
1090+ )
10841091
10851092
10861093{-| -}
@@ -1089,38 +1096,7 @@ behindContent element =
10891096 Testable.Nearby
10901097 { location = Testable.Behind
10911098 , element = element
1092− , label = "behind"
1099+ , label = "behindContent"
10931100 , test =
1094− \found _ ->
1095− let
1096− horizontalCheck =
1097− if found.self.bbox.width > found.parent.bbox.width then
1098− [ (found.self.bbox.right <= found.parent.bbox.right)
1099− || (found.self.bbox.left >= found.parent.bbox.left)
1100− ]
1101−
1102− else
1103− [ found.self.bbox.right <= found.parent.bbox.right
1104− , found.self.bbox.left >= found.parent.bbox.left
1105− ]
1106−
1107− verticalCheck =
1108− if found.self.bbox.width > found.parent.bbox.width then
1109− [ (found.self.bbox.top >= found.parent.bbox.top)
1110− || (found.self.bbox.bottom <= found.parent.bbox.bottom)
1111− ]
1112−
1113− else
1114− [ found.self.bbox.top >= found.parent.bbox.top
1115− , found.self.bbox.bottom <= found.parent.bbox.bottom
1116− ]
1117− in
1118− Expect.true "within the confines of the parent"
1119− (List.all ((==) True)
1120− (List.concat
1121− [ horizontalCheck
1122− , verticalCheck
1123− ]
1124− )
1125− )
1101+ withinHelper
11261102 }