1module Testable.Element exposing
15 , expectRoundedEquality
48{-| This module should mirror the top level `Element` api, with one important distinction.
50The resulting `Element msg` structure can either be rendered to Html or transformed into a test suite that can be run.
52In order to run the test:
55 - gather information from the browser
67layout : List (Testable.Attr msg) -> Testable.Element Testable.Runner.Msg -> Testable.Runner.TestableProgram
69 Testable.Runner.program
70 [ ( "Tests Run", elem )
74text : String -> Testable.Element msg
79el : List (Testable.Attr msg) -> Testable.Element msg -> Testable.Element msg
81 Testable.El (implicitWidthHeightShrink attrs)
84row : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
86 Testable.Row (implicitWidthHeightShrink attrs)
89column : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
91 Testable.Column (implicitWidthHeightShrink attrs)
94none : Testable.Element msg
99paragraph : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
103 implicitTest (widthHelper Nothing Nothing (Fill 1))
104 :: implicitTest (heightHelper Nothing Nothing Shrink)
107 Testable.Paragraph (skipOverridden withImplicits)
110textColumn : List (Testable.Attr msg) -> List (Testable.Element msg) -> Testable.Element msg
114 implicitTest (widthHelper (Just 500) (Just 750) (Fill 1))
115 :: implicitTest (heightHelper Nothing Nothing Shrink)
118 Testable.TextColumn (skipOverridden withImplicits)
122 List (Testable.Attr msg)
125 , label : Testable.Element msg
127 -> Testable.Element msg
129 -- TODO: this is not actually a link element!!
130 Testable.El (implicitWidthHeightShrink attrs) details.label
133{-| Old labeling mechanism that i removed to hastily
140 Testable.Attr (Element.moveUp x)
144 Testable.Attr (Element.moveDown x)
148 Testable.Attr (Element.moveRight x)
152 Testable.Attr (Element.moveLeft x)
194fillPortion : Int -> Length
199transparent : Bool -> Testable.Attr msg
208 , attr = Element.transparent on
215 |> Dict.get "opacity"
216 |> Maybe.withDefault "notfound"
225 [ Testable.equal value selfTransparency ]
230isVisible : Testable.Attr msg
233 { label = "is-visible"
237 [ Testable.equal context.self.isVisible True ]
242alpha : Float -> Testable.Attr msg
245 { label = "alpha-" ++ String.fromFloat a
246 , attr = Element.alpha a
253 |> Dict.get "opacity"
254 |> Maybe.withDefault "notfound"
256 [ Testable.equal (String.fromFloat a) selfTransparency ]
261padding : Int -> Testable.Attr msg
264 { label = "padding " ++ String.fromInt pad
265 , attr = Element.padding pad
269 [ Testable.true ("Padding " ++ String.fromInt pad ++ " is present")
271 [ floor found.self.bbox.padding.left
272 , floor found.self.bbox.padding.right
273 , floor found.self.bbox.padding.top
274 , floor found.self.bbox.padding.bottom
282paddingXY : Int -> Int -> Testable.Attr msg
285 { label = "paddingXY " ++ String.fromInt x ++ ", " ++ String.fromInt y
286 , attr = Element.paddingXY x y
290 [ Testable.true ("PaddingXY (" ++ String.fromInt x ++ ", " ++ String.fromInt y ++ ") is present")
292 [ floor found.self.bbox.padding.left
293 , floor found.self.bbox.padding.right
296 [ floor found.self.bbox.padding.top
297 , floor found.self.bbox.padding.bottom
304widthHelper maybeMin maybeMax len =
312 l |> Element.minimum minPx
320 l |> Element.maximum maxPx
328 " min:" ++ String.fromInt i
336 " max:" ++ String.fromInt i
338 minMaxTest actualWidth =
339 case ( maybeMin, maybeMax ) of
340 ( Nothing, Nothing ) ->
343 ( Just lower, Nothing ) ->
346 ( Just lower, Just higher ) ->
347 lower <= actualWidth && actualWidth <= higher
349 ( Nothing, Just higher ) ->
350 actualWidth <= higher
354 widthHelper (Just m) maybeMax newLen
357 widthHelper maybeMin (Just m) newLen
360 -- Pixel values should ignore min and max?
362 { label = "width " ++ String.fromInt val ++ "px" ++ minLabel ++ maxLabel
363 , id = Testable.IsWidth
372 [ expectRoundedEquality
373 { expected = toFloat val
374 , found = found.self.bbox.width
376 , Testable.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
384 "width fill" ++ minLabel ++ maxLabel
387 "width fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
388 , id = Testable.IsWidth
391 (Element.fillPortion portion
397 if List.member context.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
398 [ Testable.true "width fill doesn't apply to onright/onleft elements" True ]
402 parentAvailableWidth =
403 context.parent.bbox.width - (context.self.bbox.padding.left + context.self.bbox.padding.right)
405 [ case context.parentLayout of
406 Testable.IsNearby _ ->
407 Testable.true "Nearby Element has fill width"
408 ((floor context.parent.bbox.width == floor context.self.bbox.width)
409 || minMaxTest (floor context.self.bbox.width)
413 Testable.true "Element within column has fill width"
414 ((floor parentAvailableWidth == floor context.self.bbox.width)
415 || minMaxTest (floor context.self.bbox.width)
419 Testable.true "Element within element has fill width" <|
420 (floor parentAvailableWidth == floor context.self.bbox.width)
421 || minMaxTest (floor context.self.bbox.width)
426 parentAvailableWidth / toFloat (List.length context.siblings + 1)
428 Testable.true "element has fill width" <|
429 (floor spacePerPortion == floor context.self.bbox.width)
430 || minMaxTest (floor context.self.bbox.width)
431 , Testable.lessThanOrEqual "not larger than parent"
432 context.self.bbox.width
433 context.parent.bbox.width
439 { label = "width shrink" ++ minLabel ++ maxLabel
446 , id = Testable.IsWidth
449 case context.selfElement of
457 |> List.map childWidth
458 |> List.append (List.map .width context.self.textMetrics)
462 context.self.bbox.padding.left + context.self.bbox.padding.right
464 [ expectRoundedEquality
465 { expected = totalChildren + horizontalPadding
466 , found = context.self.bbox.width
468 , Testable.lessThanOrEqual "not larger than parent"
469 context.self.bbox.width
470 context.parent.bbox.width
473 Testable.Row rowAttrs _ ->
474 -- width of row is the sum of all children widths
475 -- both text elements and others.
482 |> List.map childWidth
483 |> List.append (List.map .width context.self.textMetrics)
487 context.self.bbox.padding.left + context.self.bbox.padding.right
490 Testable.getSpacingFromAttributes rowAttrs
493 toFloat spacingAmount * (toFloat (List.length context.children) - 1)
495 [ expectRoundedEquality
496 { expected = totalChildren + horizontalPadding + totalSpacing
497 , found = context.self.bbox.width
499 , Testable.lessThanOrEqual "not larger than parent"
500 context.self.bbox.width
501 context.parent.bbox.width
504 Testable.Column _ _ ->
505 -- The width of the column is the width of the widest child.
509 + context.self.bbox.padding.left
510 + context.self.bbox.padding.right
516 + context.self.bbox.padding.left
517 + context.self.bbox.padding.right
519 context.self.textMetrics
523 |> List.map childWidth
524 |> List.append textChildren
526 [ expectRoundedEquality
527 { expected = Maybe.withDefault 0 (List.maximum allChildren)
528 , found = context.self.bbox.width
530 , Testable.lessThanOrEqual "not larger than parent"
531 context.self.bbox.width
532 context.parent.bbox.width
535 Testable.TextColumn _ _ ->
536 -- The width of the column is the width of the widest child.
540 + context.self.bbox.padding.left
541 + context.self.bbox.padding.right
547 + context.self.bbox.padding.left
548 + context.self.bbox.padding.right
550 context.self.textMetrics
554 |> List.map childWidth
555 |> List.append textChildren
557 [ expectRoundedEquality
558 { expected = Maybe.withDefault 0 (List.maximum allChildren)
559 , found = context.self.bbox.width
561 , Testable.lessThanOrEqual "not larger than parent"
562 context.self.bbox.width
563 context.parent.bbox.width
566 Testable.Paragraph _ _ ->
567 -- This should be the size it's text,
568 -- unless it takes up all available space, in which case it should wrap.
575 |> List.map childWidth
576 |> List.append (List.map .width context.self.textMetrics)
580 context.self.bbox.padding.left + context.self.bbox.padding.right
582 [ expectRoundedEquality
583 { expected = totalChildren + horizontalPadding
584 , found = context.self.bbox.width
586 , Testable.lessThanOrEqual "not larger than parent"
587 context.self.bbox.width
588 context.parent.bbox.width
599heightHelper maybeMin maybeMax len =
607 l |> Element.minimum minPx
615 l |> Element.maximum maxPx
623 " min:" ++ String.fromInt i
631 " max:" ++ String.fromInt i
633 minMaxTest actualheight =
634 case ( maybeMin, maybeMax ) of
635 ( Nothing, Nothing ) ->
638 ( Just lower, Nothing ) ->
639 lower <= actualheight
641 ( Just lower, Just higher ) ->
642 lower <= actualheight && actualheight <= higher
644 ( Nothing, Just higher ) ->
645 actualheight <= higher
649 heightHelper (Just m) maybeMax newLen
652 heightHelper maybeMin (Just m) newLen
655 -- Pixel values should ignore min and max?
657 { label = "height " ++ String.fromInt val ++ "px" ++ minLabel ++ maxLabel
664 , id = Testable.IsHeight
667 [ expectRoundedEquality
668 { expected = toFloat val
669 , found = found.self.bbox.height
671 , Testable.true "min/max holds true"
672 (minMaxTest (floor found.self.bbox.height))
678 { label = "height fill-" ++ String.fromInt portion ++ minLabel ++ maxLabel
681 (Element.fillPortion portion
685 , id = Testable.IsHeight
688 [ if List.member context.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
689 Testable.true "height fill doesn't apply to above/below elements" True
693 parentAvailableHeight =
694 context.parent.bbox.height - (context.self.bbox.padding.top + context.self.bbox.padding.bottom)
696 case context.parentLayout of
697 Testable.IsNearby _ ->
698 Testable.true "Nearby Element has fill height"
699 ((floor context.parent.bbox.height == floor context.self.bbox.height)
700 || minMaxTest (floor context.self.bbox.height)
704 Testable.true "Element within column has fill height"
705 ((floor parentAvailableHeight == floor context.self.bbox.height)
706 || minMaxTest (floor context.self.bbox.height)
710 Testable.true "Element within el has fill height" <|
711 (floor parentAvailableHeight == floor context.self.bbox.height)
712 || minMaxTest (floor context.self.bbox.height)
717 parentAvailableHeight / toFloat (List.length context.siblings + 1)
719 Testable.true "el has fill height" <|
720 (floor spacePerPortion == floor context.self.bbox.height)
721 || minMaxTest (floor context.self.bbox.height)
727 { label = "height shrink" ++ minLabel ++ maxLabel
734 , id = Testable.IsHeight
737 case context.selfElement of
743 [ if List.isEmpty context.children then
744 -- context.self.textMetrics
745 -- |> List.map Testable.textHeight
747 -- TODO: apparently the font metrics we have are for the literal characters rendered
748 -- not for the font itself.
749 -- so for now, we are stubbing this in as 20, which is the default font size.
750 Testable.true "expected multiple of 20"
751 ((round context.self.bbox.height |> modBy 20) == 0)
754 expectRoundedEquality
757 |> List.map childHeight
759 |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
760 , found = context.self.bbox.height
762 , Testable.lessThanOrEqual "not larger than parent"
763 context.self.bbox.height
764 context.parent.bbox.height
772 [ if List.isEmpty context.children then
773 -- context.self.textMetrics
774 -- |> List.map Testable.textHeight
776 -- TODO: apparently the font metrics we have are for the literal characters rendered
777 -- not for the font itself.
778 -- so for now, we are stubbing this in as 20, which is the default font size.
779 Testable.true "expected multiple of 20"
780 ((round context.self.bbox.height |> modBy 20) == 0)
783 expectRoundedEquality
786 |> List.map childHeight
788 |> Maybe.withDefault 0
789 |> (\h -> h + context.self.bbox.padding.top + context.self.bbox.padding.bottom)
790 , found = context.self.bbox.height
792 , Testable.lessThanOrEqual "not larger than parent"
793 context.self.bbox.height
794 context.parent.bbox.height
797 Testable.Column colAttrs _ ->
804 |> List.map childHeight
805 |> List.append (List.map Testable.textHeight context.self.textMetrics)
809 context.self.bbox.padding.top + context.self.bbox.padding.bottom
812 Testable.getSpacingFromAttributes colAttrs
815 toFloat spacingAmount * (toFloat (List.length context.children) - 1)
817 [ expectRoundedEquality
818 { expected = totalChildren + verticalPadding + totalSpacing
819 , found = context.self.bbox.height
821 , Testable.lessThanOrEqual "not larger than parent"
822 context.self.bbox.height
823 context.parent.bbox.height
826 Testable.TextColumn _ _ ->
827 [ Testable.lessThanOrEqual "not larger than parent"
828 context.self.bbox.height
829 context.parent.bbox.height
832 Testable.Paragraph _ _ ->
833 [ Testable.lessThanOrEqual "not larger than parent"
834 context.self.bbox.height
835 context.parent.bbox.height
846width : Length -> Testable.Attr msg
848 widthHelper Nothing Nothing len
851height : Length -> Testable.Attr msg
853 heightHelper Nothing Nothing len
856spacing : Int -> Testable.Attr msg
859 [ Testable.Spacing space
860 , Testable.LabeledTest
861 { label = "spacing: " ++ String.fromInt space
862 , attr = Element.spacing space
867 findDistance child total =
874 - otherChild.bbox.right
879 - otherChild.bbox.bottom
881 [ if horizontal > 0 then
886 , if vertical > 0 then
897 List.foldl findDistance [] found.children
902 if not (x >= space) then
912 ("All children are at least "
913 ++ String.fromInt space
915 ++ Debug.toString allAreSpaced
924{-| alignLeft needs to account for
927 - elements to the left
930in order to calculate the expected result.
932Also need parent rendering context if this is to work with wrapped rows in the future.
937alignLeft : Testable.Attr msg
940 { label = "alignLeft"
941 , attr = Element.alignLeft
945 [ if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
946 Testable.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
949 List.member found.parentLayout
950 [ Testable.IsNearby Testable.InFront
951 , Testable.IsNearby Testable.Behind
952 , Testable.IsNearby Testable.Above
953 , Testable.IsNearby Testable.Below
956 expectRoundedEquality
957 { found = found.self.bbox.left
958 , expected = found.parent.bbox.left
961 else if List.length found.siblings == 0 then
962 expectRoundedEquality
963 { found = found.self.bbox.left
964 , expected = found.parent.bbox.left + found.parent.bbox.padding.left
968 case found.parentLayout of
972 List.filter (\x -> x.bbox.right < found.self.bbox.left) found.siblings
975 toFloat (List.length siblingsOnLeft * found.parentSpacing)
979 |> List.map (.width << .bbox)
982 expectRoundedEquality
983 { found = found.self.bbox.left
984 , expected = found.parent.bbox.left + (found.parent.bbox.padding.left + widthsOnLeft + spacings)
988 expectRoundedEquality
989 { found = found.self.bbox.left
990 , expected = found.parent.bbox.left + found.parent.bbox.padding.left
997centerX : Testable.Attr msg
1001 , attr = Element.centerX
1002 , id = Testable.NoId
1008 found.self.bbox.left + (found.self.bbox.width / 2)
1010 parentCenter : Float
1012 found.parent.bbox.left + (found.parent.bbox.width / 2)
1014 if List.member found.parentLayout [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
1015 [ Testable.true "centerX doesn't apply to elements that are onLeft or onRight" True ]
1017 else if List.length found.siblings == 0 then
1018 [ expectRoundedEquality
1019 { found = selfCenter
1020 , expected = parentCenter
1025 case found.parentLayout of
1029 List.filter (\x -> x.bbox.right < found.self.bbox.left) found.siblings
1032 List.filter (\x -> x.bbox.left > found.self.bbox.right) found.siblings
1034 widthsOnLeft : Float
1037 |> List.map (.width << .bbox)
1039 |> (\x -> x + (toFloat (List.length siblingsOnLeft) * toFloat found.parentSpacing))
1043 |> List.map (.width << .bbox)
1045 |> (\x -> x + (toFloat (List.length siblingsOnRight) * toFloat found.parentSpacing))
1047 expectedCenter : Float
1049 found.parent.bbox.left
1051 + ((found.parent.bbox.width - (widthsOnRight + widthsOnLeft))
1055 [ expectRoundedEquality
1056 { found = selfCenter
1057 , expected = expectedCenter
1062 [ expectRoundedEquality
1063 { found = selfCenter
1064 , expected = parentCenter
1071alignRight : Testable.Attr msg
1073 Testable.LabeledTest
1074 { label = "alignRight"
1075 , attr = Element.alignRight
1076 , id = Testable.NoId
1079 if List.member found.parentLayout [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
1080 [ Testable.true "alignRight doesn't apply to elements that are onLeft or onRight" True ]
1083 List.member found.parentLayout
1084 [ Testable.IsNearby Testable.InFront
1085 , Testable.IsNearby Testable.Behind
1086 , Testable.IsNearby Testable.Above
1087 , Testable.IsNearby Testable.Below
1090 [ expectRoundedEquality
1091 { found = found.self.bbox.right
1092 , expected = found.parent.bbox.right
1096 else if List.length found.siblings == 0 then
1097 [ expectRoundedEquality
1098 { found = found.self.bbox.right
1099 , expected = found.parent.bbox.right + found.parent.bbox.padding.right
1104 case found.parentLayout of
1108 List.filter (\x -> x.bbox.left > found.self.bbox.right) found.siblings
1111 toFloat (List.length siblingsOnRight * found.parentSpacing)
1115 |> List.map (.width << .bbox)
1118 [ expectRoundedEquality
1119 { found = found.self.bbox.right
1120 , expected = found.parent.bbox.right - (found.parent.bbox.padding.right + widthsOnRight + spacings)
1125 [ expectRoundedEquality
1126 { found = found.self.bbox.right
1127 , expected = found.parent.bbox.right + found.parent.bbox.padding.right
1134alignTop : Testable.Attr msg
1136 Testable.LabeledTest
1137 { label = "alignTop"
1138 , attr = Element.alignTop
1139 , id = Testable.NoId
1142 if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1143 [ Testable.true "alignTop doesn't apply to elements that are above or below" True ]
1146 List.member found.parentLayout
1147 [ Testable.IsNearby Testable.InFront
1148 , Testable.IsNearby Testable.Behind
1149 , Testable.IsNearby Testable.OnRight
1150 , Testable.IsNearby Testable.OnLeft
1153 [ expectRoundedEquality
1154 { found = found.self.bbox.top
1155 , expected = found.parent.bbox.top
1159 else if List.length found.siblings == 0 then
1160 [ expectRoundedEquality
1161 { found = found.self.bbox.top
1162 , expected = found.parent.bbox.top + found.parent.bbox.padding.top
1167 case found.parentLayout of
1168 Testable.InColumn ->
1171 List.filter (\x -> x.bbox.bottom < found.self.bbox.top) found.siblings
1174 toFloat (List.length siblingsAbove * found.parentSpacing)
1178 |> List.map (.height << .bbox)
1181 [ expectRoundedEquality
1182 { found = found.self.bbox.top
1183 , expected = found.parent.bbox.top + (found.parent.bbox.padding.top + heightsAbove + spacings)
1188 [ expectRoundedEquality
1189 { found = found.self.bbox.top
1190 , expected = found.parent.bbox.top
1197alignBottom : Testable.Attr msg
1199 Testable.LabeledTest
1200 { label = "alignBottom"
1201 , attr = Element.alignBottom
1202 , id = Testable.NoId
1205 if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1206 [ Testable.true "alignBottom doesn't apply to elements that are above or below" True ]
1209 List.member found.parentLayout
1210 [ Testable.IsNearby Testable.InFront
1211 , Testable.IsNearby Testable.Behind
1212 , Testable.IsNearby Testable.OnRight
1213 , Testable.IsNearby Testable.OnLeft
1216 [ expectRoundedEquality
1217 { found = found.self.bbox.bottom
1218 , expected = found.parent.bbox.bottom
1222 else if List.length found.siblings == 0 then
1223 [ expectRoundedEquality
1224 { found = found.self.bbox.bottom
1225 , expected = found.parent.bbox.bottom + found.parent.bbox.padding.bottom
1230 case found.parentLayout of
1231 Testable.InColumn ->
1234 List.filter (\x -> x.bbox.top > found.self.bbox.bottom) found.siblings
1237 toFloat (List.length siblingsBelow * found.parentSpacing)
1241 |> List.map (.height << .bbox)
1244 [ expectRoundedEquality
1245 { found = found.self.bbox.bottom
1246 , expected = found.parent.bbox.bottom - (found.parent.bbox.padding.bottom + heightsBelow + spacings)
1251 [ expectRoundedEquality
1252 { found = found.self.bbox.bottom
1253 , expected = found.parent.bbox.bottom + found.parent.bbox.padding.bottom
1259expectRoundedEquality : { expected : Float, found : Float } -> Testable.LayoutExpectation
1260expectRoundedEquality { expected, found } =
1262 ("expected " ++ floatToString expected ++ ", found " ++ floatToString found)
1263 (abs (expected - found) < 1)
1266floatToString : Float -> String
1268 String.fromFloat (toFloat (round (x * 100)) / 100)
1272centerY : Testable.Attr msg
1274 Testable.LabeledTest
1276 , attr = Element.centerY
1277 , id = Testable.NoId
1282 found.self.bbox.top + (found.self.bbox.height / 2)
1285 found.parent.bbox.top + (found.parent.bbox.height / 2)
1287 if List.member found.parentLayout [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
1288 [ Testable.true "centerY doesn't apply to elements that are above or below" True ]
1290 else if List.length found.siblings == 0 then
1291 [ expectRoundedEquality
1292 { found = selfCenter
1293 , expected = parentCenter
1298 case found.parentLayout of
1299 Testable.InColumn ->
1302 List.filter (\x -> x.bbox.bottom < found.self.bbox.top) found.siblings
1305 List.filter (\x -> x.bbox.top > found.self.bbox.bottom) found.siblings
1307 heightsAbove : Float
1310 |> List.map (.height << .bbox)
1312 |> (\x -> x + (toFloat (List.length siblingsOnTop) * toFloat found.parentSpacing))
1316 |> List.map (.height << .bbox)
1318 |> (\x -> x + (toFloat (List.length siblingsBelow) * toFloat found.parentSpacing))
1320 expectedCenter : Float
1322 found.parent.bbox.top
1324 + ((found.parent.bbox.height - (heightsBelow + heightsAbove))
1328 [ expectRoundedEquality
1329 { found = selfCenter
1330 , expected = expectedCenter
1335 [ expectRoundedEquality
1336 { found = selfCenter
1337 , expected = parentCenter
1344above : Testable.Element msg -> Testable.Attr msg
1347 { location = Testable.Above
1352 [ expectRoundedEquality
1353 { found = found.self.bbox.bottom
1354 , expected = found.parent.bbox.top
1361below : Testable.Element msg -> Testable.Attr msg
1364 { location = Testable.Below
1369 [ expectRoundedEquality
1370 { found = found.self.bbox.top
1371 , expected = found.parent.bbox.bottom
1378onRight : Testable.Element msg -> Testable.Attr msg
1381 { location = Testable.OnRight
1386 [ expectRoundedEquality
1387 { found = found.self.bbox.left
1388 , expected = found.parent.bbox.right
1395onLeft : Testable.Element msg -> Testable.Attr msg
1398 { location = Testable.OnLeft
1403 [ expectRoundedEquality
1404 { found = found.self.bbox.right
1405 , expected = found.parent.bbox.left
1412 vs (round x) (round y) || vs (floor x) (floor y)
1416inFront : Testable.Element msg -> Testable.Attr msg
1419 { location = Testable.InFront
1424 [ withinHelper found ]
1431 if found.self.bbox.width > found.parent.bbox.width then
1432 [ compare found.self.bbox.right (<=) found.parent.bbox.right
1433 || compare found.self.bbox.left (>=) found.parent.bbox.left
1437 [ compare found.self.bbox.right (<=) found.parent.bbox.right
1438 , compare found.self.bbox.left (>=) found.parent.bbox.left
1442 if found.self.bbox.width > found.parent.bbox.width then
1443 [ compare found.self.bbox.top (>=) found.parent.bbox.top
1444 || compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1448 [ compare found.self.bbox.top (>=) found.parent.bbox.top
1449 , compare found.self.bbox.bottom (<=) found.parent.bbox.bottom
1452 Testable.true "within the confines of the parent"
1453 (List.all ((==) True)
1463behindContent : Testable.Element msg -> Testable.Attr msg
1464behindContent element =
1466 { location = Testable.Behind
1468 , label = "behindContent"
1471 [ withinHelper found ]
1476{- Implicit width/height calcualtions -}
1479implicitWidthHeightShrink attrs =
1482 implicitTest (widthHelper Nothing Nothing Shrink)
1483 :: implicitTest (heightHelper Nothing Nothing Shrink)
1486 skipOverridden withImplicits
1491 Testable.LabeledTest details ->
1494 Testable.AttrTest details ->
1503 (\attr ( found, caught ) ->
1513 , hasHeight = found.hasHeight
1517 Testable.IsHeight ->
1519 , { hasWidth = found.hasWidth
1532 ( { hasWidth = False
1542{-| This is taking a normal test and rmoving its ability to attach a real `Element` attribute.
1546 Testable.LabeledTest details ->
1548 { test = details.test
1549 , label = "Implicit -> " ++ details.label
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list