git.iko.soy/typeable/elm-ui
on master help sign in
isVisible test
531e23fMatthew Griffith
NOTES.mdnew file+10
@@ -0,0 +1,10 @@
1+# Rendering Order
2+
3+Nearby elements such as `below`, `above`, `behindContent`, and `inFront` are rendered after the other children of the `Element.
4+
5+This is so:
6+
7+- `inFront` doesn't need a special `z-index` to work. This can increase performance because too many `z-index` overrides means shipping more layers to the gpu.
8+- Nearby elements higher up in the DOM hierarchy will be on top of elements lower in the hierarchy. `inFront` on a higher element should be on top of `inFront` elements on a lower element.
9+- Allows nearby elements to be affected by `focused` for `Input`, because they can be reached by a sibling selector. `.focuesed:focus ~ .focusable-style {}`
10+
tests/Tests/Nearby.elm+42−1
@@ -23,6 +23,28 @@ box attrs =
23 none
23 none
24
24
25
25
26+justBox size color attrs =
27+ el
28+ ([ width (px size)
29+ , height (px size)
30+ , Background.color color
31+ ]
32+ ++ attrs
33+ )
34+ none
35+
36+
37+littleBox name attrs =
38+ el
39+ ([ label name
40+ , width (px 5)
41+ , height (px 5)
42+ ]
43+ ++ attrs
44+ )
45+ none
46+
47+
26p attrs =
48p attrs =
27 paragraph
49 paragraph
28 ([ Background.color blue
50 ([ Background.color blue
@@ -389,5 +411,24 @@ view =
389 , nearby onRight "onRight" box
411 , nearby onRight "onRight" box
390 , nearby onLeft "onLeft" box
412 , nearby onLeft "onLeft" box
391 , nearby behindContent "behindContent" transparentBox
413 , nearby behindContent "behindContent" transparentBox
392− , text "all nearbys, all alignments"
414+ , layeredVisibility
415+ , overlappingChildren
416+ ]
417+
418+
419+layeredVisibility =
420+ el
421+ [ inFront (justBox 40 red [ isVisible ])
422+ ]
423+ (el [ inFront (justBox 30 green []) ]
424+ (justBox 50 blue [])
425+ )
426+
427+
428+overlappingChildren =
429+ row []
430+ [ el [ inFront (justBox 40 green []) ]
431+ (justBox 40 darkGrey [])
432+ , el [ onLeft (littleBox "overlapping" [ isVisible, Background.color red ]) ]
433+ (justBox 40 darkGrey [])
393 ]
434 ]
tests/Tests/Run.elm+4−5
@@ -1,4 +1,4 @@
1−port module Tests.Run exposing (..)
1+port module Tests.Run exposing (main)
2
2
3{-| -}
3{-| -}
4
4
@@ -16,13 +16,12 @@ import Tests.Transparency
16main : Testable.Runner.TestableProgram
16main : Testable.Runner.TestableProgram
17main =
17main =
18 Testable.Runner.program
18 Testable.Runner.program
19− [ --Tuple.pair "Basic Element" Tests.Basic.view
19+ [ Tuple.pair "Basic Element" Tests.Basic.view
20− Tuple.pair "Nearby" Tests.Nearby.view
20+ , Tuple.pair "Nearby" Tests.Nearby.view
21 , Tuple.pair "Element Alignment" Tests.ElementAlignment.view
21 , Tuple.pair "Element Alignment" Tests.ElementAlignment.view
22 , Tuple.pair "Transparency" Tests.Transparency.view
22 , Tuple.pair "Transparency" Tests.Transparency.view
23 , Tuple.pair "Column Alignment" Tests.ColumnAlignment.view
23 , Tuple.pair "Column Alignment" Tests.ColumnAlignment.view
24−
25− -- , Tuple.pair "Row Alignment" Tests.RowAlignment.view
24+ , Tuple.pair "Row Alignment" Tests.RowAlignment.view
26 , Tuple.pair "Column Spacing" Tests.ColumnSpacing.view
25 , Tuple.pair "Column Spacing" Tests.ColumnSpacing.view
27 , Tuple.pair "Row Spacing" Tests.RowSpacing.view
26 , Tuple.pair "Row Spacing" Tests.RowSpacing.view
28 ]
27 ]
tests/gather-styles.html+29−1
@@ -34,13 +34,41 @@
34 }
34 }
35 var style = getStyle(element);
35 var style = getStyle(element);
36 var bbox = getBoundingBox(element);
36 var bbox = getBoundingBox(element);
37+
38+ var visible = isVisible(id, bbox);
39+
40+
37− var result = { "bbox": bbox, "style": style, "id": id };
41+ var result = { "bbox": bbox, "style": style, "id": id, "isVisible": visible };
38 results.push(result);
42 results.push(result);
39
43
40 }
44 }
41 app.ports.styles.send(results);
45 app.ports.styles.send(results);
42 });
46 });
43
47
48+ function isVisible(id, bbox) {
49+ var current = document.getElementById(id);
50+ var result = 0;
51+ if (current == document.elementFromPoint(bbox['left'], bbox['top'])) {
52+ result++;
53+ }
54+ if (current == document.elementFromPoint(bbox['left'], bbox['bottom'] - 1)) {
55+ result++;
56+ }
57+ if (current == document.elementFromPoint(bbox['right'] - 1, bbox['top'])) {
58+ result++;
59+ }
60+ if (current == document.elementFromPoint(bbox['right'] - 1, bbox['bottom'] - 1)) {
61+ result++;
62+ }
63+
64+
65+ if (result == 4) {
66+ return true;
67+ } else {
68+ return false
69+ }
70+ }
71+
44 function getStyle(element) {
72 function getStyle(element) {
45 var props = []
73 var props = []
46 var style = window.getComputedStyle(element);
74 var style = window.getComputedStyle(element);
tests/src/Testable.elm+7−3
@@ -1,4 +1,4 @@
1−module Testable exposing (..)
1+module Testable exposing (Attr(..), BoundingBox, Element(..), Found, LayoutContext(..), Location(..), Style, Surroundings, addAttribute, applyLabels, compareFormattedColor, createAttributeTest, createTest, formatColor, formatColorWithAlpha, getElementId, getIds, getSpacing, idAttr, levelToString, render, renderAttribute, renderElement, runTests, toTest)
2
2
3{-| -}
3{-| -}
4
4
@@ -74,6 +74,7 @@ type alias Surroundings =
74type alias Found =
74type alias Found =
75 { bbox : BoundingBox
75 { bbox : BoundingBox
76 , style : Style
76 , style : Style
77+ , isVisible : Bool
77 }
78 }
78
79
79
80
@@ -312,14 +313,13 @@ createTest { siblings, parent, cache, level, element, location, parentSpacing }
312 |> Maybe.withDefault 0
313 |> Maybe.withDefault 0
313
314
314 id =
315 id =
315− -- Debug.log "create Test" <|
316 levelToString level
316 levelToString level
317
317
318 testChildren : Found -> List (Element msg) -> List Test
318 testChildren : Found -> List (Element msg) -> List Test
319 testChildren found children =
319 testChildren found children =
320 let
320 let
321 childrenFound =
321 childrenFound =
322− -- Should check taht this lookup doesn't fail.
322+ -- Should check that this lookup doesn't fail.
323 -- Thoug if it does, it'll fail when the element itself is tested
323 -- Thoug if it does, it'll fail when the element itself is tested
324 List.filterMap
324 List.filterMap
325 (\x ->
325 (\x ->
@@ -535,6 +535,7 @@ applyLabels attrs =
535 | label =
535 | label =
536 if newLabel == "" then
536 if newLabel == "" then
537 labeled.label
537 labeled.label
538+
538 else
539 else
539 newLabel ++ ", " ++ labeled.label
540 newLabel ++ ", " ++ labeled.label
540 }
541 }
@@ -666,6 +667,7 @@ formatColorWithAlpha (Internal.Rgba red green blue alpha) =
666 ++ (", " ++ String.fromInt (round (blue * 255)))
667 ++ (", " ++ String.fromInt (round (blue * 255)))
667 ++ ", 1"
668 ++ ", 1"
668 ++ ")"
669 ++ ")"
670+
669 else
671 else
670 ("rgba(" ++ String.fromInt (round (red * 255)))
672 ("rgba(" ++ String.fromInt (round (red * 255)))
671 ++ (", " ++ String.fromInt (round (green * 255)))
673 ++ (", " ++ String.fromInt (round (green * 255)))
@@ -680,6 +682,7 @@ formatColor (Internal.Rgba red green blue alpha) =
680 ++ (", " ++ String.fromInt (round (green * 255)))
682 ++ (", " ++ String.fromInt (round (green * 255)))
681 ++ (", " ++ String.fromInt (round (blue * 255)))
683 ++ (", " ++ String.fromInt (round (blue * 255)))
682 ++ ")"
684 ++ ")"
685+
683 else
686 else
684 ("rgb(" ++ String.fromInt (round (red * 255)))
687 ("rgb(" ++ String.fromInt (round (red * 255)))
685 ++ (", " ++ String.fromInt (round (green * 255)))
688 ++ (", " ++ String.fromInt (round (green * 255)))
@@ -693,6 +696,7 @@ getSpacing el =
693 getSpacingAttr attr found =
696 getSpacingAttr attr found =
694 if found /= Nothing then
697 if found /= Nothing then
695 found
698 found
699+
696 else
700 else
697 case attr of
701 case attr of
698 Spacing i ->
702 Spacing i ->
tests/src/Testable/Element.elm+82−1
@@ -1,4 +1,43 @@
1−module Testable.Element exposing (..)
1+module Testable.Element exposing
2+ ( Length(..)
3+ , above
4+ , alignBottom
5+ , alignLeft
6+ , alignRight
7+ , alignTop
8+ , alpha
9+ , behindContent
10+ , below
11+ , centerX
12+ , centerY
13+ , column
14+ , el
15+ , expectRoundedEquality
16+ , fill
17+ , fillPortion
18+ , height
19+ , heightHelper
20+ , inFront
21+ , isVisible
22+ , label
23+ , maximum
24+ , minimum
25+ , none
26+ , onLeft
27+ , onRight
28+ , padding
29+ , paddingXY
30+ , paragraph
31+ , px
32+ , row
33+ , shrink
34+ , spacing
35+ , text
36+ , textColumn
37+ , transparent
38+ , width
39+ , widthHelper
40+ )
2
41
3{-| This module should mirror the top level `Element` api, with one important distinction.
42{-| This module should mirror the top level `Element` api, with one important distinction.
4
43
@@ -15,6 +54,7 @@ In order to run the test:
15import Dict
54import Dict
16import Element
55import Element
17import Expect
56import Expect
57+import Html.Attributes
18import Testable
58import Testable
19
59
20
60
@@ -100,6 +140,7 @@ transparent on =
100 { label =
140 { label =
101 if on then
141 if on then
102 "transparent"
142 "transparent"
143+
103 else
144 else
104 "opaque"
145 "opaque"
105 , attr = Element.transparent on
146 , attr = Element.transparent on
@@ -114,6 +155,7 @@ transparent on =
114 value =
155 value =
115 if on then
156 if on then
116 "0"
157 "0"
158+
117 else
159 else
118 "1"
160 "1"
119 in
161 in
@@ -121,6 +163,18 @@ transparent on =
121 }
163 }
122
164
123
165
166+{-| -}
167+isVisible : Testable.Attr msg
168+isVisible =
169+ Testable.LabeledTest
170+ { label = "is-visible"
171+ , attr = Element.htmlAttribute (Html.Attributes.style "not" "applicable")
172+ , test =
173+ \context _ ->
174+ Expect.equal context.self.isVisible True
175+ }
176+
177+
124{-| -}
178{-| -}
125alpha : Float -> Testable.Attr msg
179alpha : Float -> Testable.Attr msg
126alpha a =
180alpha a =
@@ -265,6 +319,7 @@ widthHelper maybeMin maybeMax len =
265 \context _ ->
319 \context _ ->
266 if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
320 if List.member context.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
267 Expect.true "width fill doesn't apply to onright/onleft elements" True
321 Expect.true "width fill doesn't apply to onright/onleft elements" True
322+
268 else
323 else
269 let
324 let
270 parentAvailableWidth =
325 parentAvailableWidth =
@@ -329,6 +384,7 @@ widthHelper maybeMin maybeMax len =
329 -- TODO: The issue is that we have a hard time measuring `text` elements
384 -- TODO: The issue is that we have a hard time measuring `text` elements
330 -- So if a element has a text child, then it's width isn't going to show up in the system.
385 -- So if a element has a text child, then it's width isn't going to show up in the system.
331 expectRoundedEquality context.self.bbox.width context.self.bbox.width
386 expectRoundedEquality context.self.bbox.width context.self.bbox.width
387+
332 else
388 else
333 -- This fails if this element is actually a column
389 -- This fails if this element is actually a column
334 -- So we need to capture what this element is in order to do this calculation.
390 -- So we need to capture what this element is in order to do this calculation.
@@ -422,6 +478,7 @@ heightHelper maybeMin maybeMax len =
422 \context _ ->
478 \context _ ->
423 if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
479 if List.member context.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
424 Expect.true "height fill doesn't apply to above/below elements" True
480 Expect.true "height fill doesn't apply to above/below elements" True
481+
425 else
482 else
426 let
483 let
427 parentAvailableHeight =
484 parentAvailableHeight =
@@ -486,6 +543,7 @@ heightHelper maybeMin maybeMax len =
486 -- TODO: The issue is that we have a hard time measuring `text` elements
543 -- TODO: The issue is that we have a hard time measuring `text` elements
487 -- So if a element has a text child, then it's height isn't going to show up in the system.
544 -- So if a element has a text child, then it's height isn't going to show up in the system.
488 expectRoundedEquality context.self.bbox.height context.self.bbox.height
545 expectRoundedEquality context.self.bbox.height context.self.bbox.height
546+
489 else
547 else
490 -- This fails if this element is actually a column
548 -- This fails if this element is actually a column
491 -- So we need to capture what this element is in order to do this calculation.
549 -- So we need to capture what this element is in order to do this calculation.
@@ -529,10 +587,12 @@ spacing space =
529 in
587 in
530 [ if horizontal > 0 then
588 [ if horizontal > 0 then
531 horizontal
589 horizontal
590+
532 else
591 else
533 space
592 space
534 , if vertical > 0 then
593 , if vertical > 0 then
535 vertical
594 vertical
595+
536 else
596 else
537 space
597 space
538 ]
598 ]
@@ -548,6 +608,7 @@ spacing space =
548 (\x wrong ->
608 (\x wrong ->
549 if not (x >= space) then
609 if not (x >= space) then
550 x :: wrong
610 x :: wrong
611+
551 else
612 else
552 wrong
613 wrong
553 )
614 )
@@ -588,6 +649,7 @@ alignLeft =
588 \found _ ->
649 \found _ ->
589 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
650 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
590 Expect.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
651 Expect.true "alignLeft doesn't apply to elements that are onLeft or onRight" True
652+
591 else if
653 else if
592 List.member found.location
654 List.member found.location
593 [ Testable.IsNearby Testable.InFront
655 [ Testable.IsNearby Testable.InFront
@@ -599,10 +661,12 @@ alignLeft =
599 expectRoundedEquality
661 expectRoundedEquality
600 found.self.bbox.left
662 found.self.bbox.left
601 found.parent.bbox.left
663 found.parent.bbox.left
664+
602 else if List.length found.siblings == 0 then
665 else if List.length found.siblings == 0 then
603 expectRoundedEquality
666 expectRoundedEquality
604 found.self.bbox.left
667 found.self.bbox.left
605 (found.parent.bbox.left + found.parent.bbox.padding.left)
668 (found.parent.bbox.left + found.parent.bbox.padding.left)
669+
606 else
670 else
607 case found.location of
671 case found.location of
608 Testable.InRow ->
672 Testable.InRow ->
@@ -648,10 +712,12 @@ centerX =
648 in
712 in
649 if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
713 if List.member found.location [ Testable.IsNearby Testable.OnRight, Testable.IsNearby Testable.OnLeft ] then
650 Expect.true "centerX doesn't apply to elements that are onLeft or onRight" True
714 Expect.true "centerX doesn't apply to elements that are onLeft or onRight" True
715+
651 else if List.length found.siblings == 0 then
716 else if List.length found.siblings == 0 then
652 expectRoundedEquality
717 expectRoundedEquality
653 selfCenter
718 selfCenter
654 parentCenter
719 parentCenter
720+
655 else
721 else
656 case found.location of
722 case found.location of
657 Testable.InRow ->
723 Testable.InRow ->
@@ -702,6 +768,7 @@ alignRight =
702 \found _ ->
768 \found _ ->
703 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
769 if List.member found.location [ Testable.IsNearby Testable.OnLeft, Testable.IsNearby Testable.OnRight ] then
704 Expect.true "alignRight doesn't apply to elements that are onLeft or onRight" True
770 Expect.true "alignRight doesn't apply to elements that are onLeft or onRight" True
771+
705 else if
772 else if
706 List.member found.location
773 List.member found.location
707 [ Testable.IsNearby Testable.InFront
774 [ Testable.IsNearby Testable.InFront
@@ -713,10 +780,12 @@ alignRight =
713 expectRoundedEquality
780 expectRoundedEquality
714 found.self.bbox.right
781 found.self.bbox.right
715 found.parent.bbox.right
782 found.parent.bbox.right
783+
716 else if List.length found.siblings == 0 then
784 else if List.length found.siblings == 0 then
717 expectRoundedEquality
785 expectRoundedEquality
718 found.self.bbox.right
786 found.self.bbox.right
719 (found.parent.bbox.right + found.parent.bbox.padding.right)
787 (found.parent.bbox.right + found.parent.bbox.padding.right)
788+
720 else
789 else
721 case found.location of
790 case found.location of
722 Testable.InRow ->
791 Testable.InRow ->
@@ -753,6 +822,7 @@ alignTop =
753 \found _ ->
822 \found _ ->
754 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
823 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
755 Expect.true "alignTop doesn't apply to elements that are above or below" True
824 Expect.true "alignTop doesn't apply to elements that are above or below" True
825+
756 else if
826 else if
757 List.member found.location
827 List.member found.location
758 [ Testable.IsNearby Testable.InFront
828 [ Testable.IsNearby Testable.InFront
@@ -764,10 +834,12 @@ alignTop =
764 expectRoundedEquality
834 expectRoundedEquality
765 found.self.bbox.top
835 found.self.bbox.top
766 found.parent.bbox.top
836 found.parent.bbox.top
837+
767 else if List.length found.siblings == 0 then
838 else if List.length found.siblings == 0 then
768 expectRoundedEquality
839 expectRoundedEquality
769 found.self.bbox.top
840 found.self.bbox.top
770 (found.parent.bbox.top + found.parent.bbox.padding.top)
841 (found.parent.bbox.top + found.parent.bbox.padding.top)
842+
771 else
843 else
772 case found.location of
844 case found.location of
773 Testable.InColumn ->
845 Testable.InColumn ->
@@ -804,6 +876,7 @@ alignBottom =
804 \found _ ->
876 \found _ ->
805 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
877 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
806 Expect.true "alignBottom doesn't apply to elements that are above or below" True
878 Expect.true "alignBottom doesn't apply to elements that are above or below" True
879+
807 else if
880 else if
808 List.member found.location
881 List.member found.location
809 [ Testable.IsNearby Testable.InFront
882 [ Testable.IsNearby Testable.InFront
@@ -815,10 +888,12 @@ alignBottom =
815 expectRoundedEquality
888 expectRoundedEquality
816 found.self.bbox.bottom
889 found.self.bbox.bottom
817 found.parent.bbox.bottom
890 found.parent.bbox.bottom
891+
818 else if List.length found.siblings == 0 then
892 else if List.length found.siblings == 0 then
819 expectRoundedEquality
893 expectRoundedEquality
820 found.self.bbox.bottom
894 found.self.bbox.bottom
821 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
895 (found.parent.bbox.bottom + found.parent.bbox.padding.bottom)
896+
822 else
897 else
823 case found.location of
898 case found.location of
824 Testable.InColumn ->
899 Testable.InColumn ->
@@ -867,10 +942,12 @@ centerY =
867 in
942 in
868 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
943 if List.member found.location [ Testable.IsNearby Testable.Above, Testable.IsNearby Testable.Below ] then
869 Expect.true "centerY doesn't apply to elements that are above or below" True
944 Expect.true "centerY doesn't apply to elements that are above or below" True
945+
870 else if List.length found.siblings == 0 then
946 else if List.length found.siblings == 0 then
871 expectRoundedEquality
947 expectRoundedEquality
872 selfCenter
948 selfCenter
873 parentCenter
949 parentCenter
950+
874 else
951 else
875 case found.location of
952 case found.location of
876 Testable.InColumn ->
953 Testable.InColumn ->
@@ -978,6 +1055,7 @@ inFront element =
978 [ (found.self.bbox.right <= found.parent.bbox.right)
1055 [ (found.self.bbox.right <= found.parent.bbox.right)
979 || (found.self.bbox.left >= found.parent.bbox.left)
1056 || (found.self.bbox.left >= found.parent.bbox.left)
980 ]
1057 ]
1058+
981 else
1059 else
982 [ found.self.bbox.right <= found.parent.bbox.right
1060 [ found.self.bbox.right <= found.parent.bbox.right
983 , found.self.bbox.left >= found.parent.bbox.left
1061 , found.self.bbox.left >= found.parent.bbox.left
@@ -988,6 +1066,7 @@ inFront element =
988 [ (found.self.bbox.top >= found.parent.bbox.top)
1066 [ (found.self.bbox.top >= found.parent.bbox.top)
989 || (found.self.bbox.bottom <= found.parent.bbox.bottom)
1067 || (found.self.bbox.bottom <= found.parent.bbox.bottom)
990 ]
1068 ]
1069+
991 else
1070 else
992 [ found.self.bbox.top >= found.parent.bbox.top
1071 [ found.self.bbox.top >= found.parent.bbox.top
993 , found.self.bbox.bottom <= found.parent.bbox.bottom
1072 , found.self.bbox.bottom <= found.parent.bbox.bottom
@@ -1019,6 +1098,7 @@ behindContent element =
1019 [ (found.self.bbox.right <= found.parent.bbox.right)
1098 [ (found.self.bbox.right <= found.parent.bbox.right)
1020 || (found.self.bbox.left >= found.parent.bbox.left)
1099 || (found.self.bbox.left >= found.parent.bbox.left)
1021 ]
1100 ]
1101+
1022 else
1102 else
1023 [ found.self.bbox.right <= found.parent.bbox.right
1103 [ found.self.bbox.right <= found.parent.bbox.right
1024 , found.self.bbox.left >= found.parent.bbox.left
1104 , found.self.bbox.left >= found.parent.bbox.left
@@ -1029,6 +1109,7 @@ behindContent element =
1029 [ (found.self.bbox.top >= found.parent.bbox.top)
1109 [ (found.self.bbox.top >= found.parent.bbox.top)
1030 || (found.self.bbox.bottom <= found.parent.bbox.bottom)
1110 || (found.self.bbox.bottom <= found.parent.bbox.bottom)
1031 ]
1111 ]
1112+
1032 else
1113 else
1033 [ found.self.bbox.top >= found.parent.bbox.top
1114 [ found.self.bbox.top >= found.parent.bbox.top
1034 , found.self.bbox.bottom <= found.parent.bbox.bottom
1115 , found.self.bbox.bottom <= found.parent.bbox.bottom
tests/src/Testable/Element/Background.elm+1−1
@@ -22,6 +22,6 @@ color clr =
22 |> Dict.get "background-color"
22 |> Dict.get "background-color"
23 |> Maybe.withDefault "notfound"
23 |> Maybe.withDefault "notfound"
24 in
24 in
25− Expect.true ("Color Match - " ++ (Testable.formatColor clr ++ " vs " ++ selfBackgroundColor))
25+ Expect.true ("Expected color: " ++ (Testable.formatColor clr ++ " vs found:" ++ selfBackgroundColor))
26 (Testable.compareFormattedColor clr selfBackgroundColor)
26 (Testable.compareFormattedColor clr selfBackgroundColor)
27 }
27 }
tests/src/Testable/Runner.elm+17−2
@@ -141,6 +141,7 @@ type Msg
141 (List
141 (List
142 { id : String
142 { id : String
143 , bbox : Testable.BoundingBox
143 , bbox : Testable.BoundingBox
144+ , isVisible : Bool
144 , style : List ( String, String )
145 , style : List ( String, String )
145 }
146 }
146 )
147 )
@@ -180,7 +181,12 @@ update msg model =
180 Just ( label, current ) ->
181 Just ( label, current ) ->
181 let
182 let
182 toTuple box =
183 toTuple box =
184+ ( box.id
183− ( box.id, { style = Dict.fromList box.style, bbox = box.bbox } )
185+ , { style = Dict.fromList box.style
186+ , bbox = box.bbox
187+ , isVisible = box.isVisible
188+ }
189+ )
184
190
185 foundData =
191 foundData =
186 boxes
192 boxes
@@ -443,4 +449,13 @@ port test : String -> Cmd msg
443port analyze : List String -> Cmd msg
449port analyze : List String -> Cmd msg
444
450
445
451
452+port styles :
453+ (List
454+ { id : String
446−port styles : (List { id : String, bbox : Testable.BoundingBox, style : List ( String, String ) } -> msg) -> Sub msg
455+ , bbox : Testable.BoundingBox
456+ , style : List ( String, String )
457+ , isVisible : Bool
458+ }
459+ -> msg
460+ )
461+ -> Sub msg