git.iko.soy/typeable/elm-ui
on master help sign in
add Testable.Border
commit7719c06beff8fbf1bb441725acc23b834193ad3a authorElm UI Automation <automation@elm-ui.com> dateMon 27 Apr 2020, 21:01 (7 years ago) parent6653289
7 files changed+107−27
tests-rendering/cases/elm.json+20−23 tests-rendering/cases/open/InFrontSize.elm+32 tests-rendering/elm.json+3−3 tests-rendering/make.sh+2 tests-rendering/src/Testable/Element.elm+29 tests-rendering/src/Testable/Element/Border.elm+20 tests-rendering/src/Testable/Runner.elm+1−1
tests-rendering/cases/elm.json+20−23
@@ -1,26 +1,23 @@
11{
2− "type": "application",
3− "source-directories": [
4− "open",
5− "../src/"
6− ],
7− "elm-version": "0.19.0",
8− "dependencies": {
9− "direct": {
10− "elm/browser": "1.0.0",
11− "elm/core": "1.0.0",
12− "elm/html": "1.0.0",
13− "elm/json": "1.0.0",
14− "elm/virtual-dom": "1.0.0",
15− "ohanhi/lorem": "1.0.2"
16− },
17− "indirect": {
18− "elm/time": "1.0.0",
19− "elm/url": "1.0.0"
20− }
2+ "type": "application",
3+ "source-directories": ["open", "../src/"],
4+ "elm-version": "0.19.1",
5+ "dependencies": {
6+ "direct": {
7+ "elm/browser": "1.0.0",
8+ "elm/core": "1.0.0",
9+ "elm/html": "1.0.0",
10+ "elm/json": "1.0.0",
11+ "elm/virtual-dom": "1.0.0",
12+ "ohanhi/lorem": "1.0.2"
2113 },
22− "test-dependencies": {
23− "direct": {},
24− "indirect": {}
14+ "indirect": {
15+ "elm/time": "1.0.0",
16+ "elm/url": "1.0.0"
2517 }
26−}
18+ },
19+ "test-dependencies": {
20+ "direct": {},
21+ "indirect": {}
22+ }
23+}
tests-rendering/cases/open/InFrontSize.elmnew file+32
@@ -0,0 +1,32 @@
1+module InFrontSize exposing (main)
2+
3+import Testable.Element exposing (..)
4+import Testable.Element.Background as Background
5+import Testable.Element.Border as Border
6+
7+
8+main =
9+ layout []
10+ (el
11+ [ width (px 100)
12+ , height (px 100)
13+ , centerX
14+ , centerY
15+ , Background.color (rgb 0.1 0.1 0.1)
16+ , Border.width 20
17+ , Border.color (rgb 0.5 1 1)
18+
19+ -- the following element should cover the parent's border
20+ , inFront
21+ (el
22+ [ width fill
23+ , height fill
24+ , Background.color (rgb 0.1 0.5 0.9)
25+
26+ -- , moveUp 40
27+ ]
28+ none
29+ )
30+ ]
31+ none
32+ )
tests-rendering/elm.json+3−3
@@ -7,14 +7,14 @@
77 "elm-version": "0.19.1",
88 "dependencies": {
99 "direct": {
10− "elm/browser": "1.0.0",
10+ "elm/browser": "1.0.2",
1111 "elm/core": "1.0.0",
1212 "elm/html": "1.0.0",
1313 "elm/json": "1.0.0",
1414 "elm/parser": "1.1.0",
1515 "elm/random": "1.0.0",
1616 "elm/time": "1.0.0",
17− "elm/virtual-dom": "1.0.0",
17+ "elm/virtual-dom": "1.0.2",
1818 "elm-explorations/test": "1.1.0"
1919 },
2020 "indirect": {
@@ -25,4 +25,4 @@
2525 "direct": {},
2626 "indirect": {}
2727 }
28−}
28+}
tests-rendering/make.shnew file+2
@@ -0,0 +1,2 @@
1+
2+elm-live cases/open/InFrontSize.elm --open --dir=view -- --output=view/elm.js --debug
tests-rendering/src/Testable/Element.elm+29
@@ -19,8 +19,11 @@ module Testable.Element exposing
1919 , inFront
2020 , isVisible
2121 , label
22+ , layout
2223 , maximum
2324 , minimum
25+ , moveDown
26+ , moveUp
2427 , none
2528 , onLeft
2629 , onRight
@@ -28,6 +31,8 @@ module Testable.Element exposing
2831 , paddingXY
2932 , paragraph
3033 , px
34+ , rgb
35+ , rgba
3136 , row
3237 , shrink
3338 , spacing
@@ -54,6 +59,14 @@ import Element
5459import Expect
5560import Html.Attributes
5661import Testable
62+import Testable.Runner
63+
64+
65+layout : List (Testable.Attr msg) -> Testable.Element Testable.Runner.Msg -> Testable.Runner.TestableProgram
66+layout attrs elem =
67+ Testable.Runner.program
68+ [ ( "Open Case", elem )
69+ ]
5770
5871
5972text : String -> Testable.Element msg
@@ -91,6 +104,14 @@ textColumn =
91104 Testable.TextColumn
92105
93106
107+moveUp x =
108+ Testable.Attr (Element.moveUp x)
109+
110+
111+moveDown x =
112+ Testable.Attr (Element.moveDown x)
113+
114+
94115type Length
95116 = Px Int
96117 | Fill Int
@@ -107,6 +128,14 @@ maximum =
107128 Maximum
108129
109130
131+rgb =
132+ Element.rgb
133+
134+
135+rgba =
136+ Element.rgba
137+
138+
110139px : Int -> Length
111140px =
112141 Px
tests-rendering/src/Testable/Element/Border.elmnew file+20
@@ -0,0 +1,20 @@
1+module Testable.Element.Border exposing (..)
2+
3+{-| -}
4+
5+import Dict
6+import Element exposing (Color)
7+import Element.Border as Border
8+import Element.Font as Font
9+import Expect
10+import Testable
11+
12+
13+color : Color -> Testable.Attr msg
14+color clr =
15+ Testable.Attr (Border.color clr)
16+
17+
18+width : Int -> Testable.Attr msg
19+width i =
20+ Testable.Attr (Border.width i)
tests-rendering/src/Testable/Runner.elm+1−1
@@ -1,4 +1,4 @@
1−port module Testable.Runner exposing (TestableProgram, program, show)
1+port module Testable.Runner exposing (Msg, TestableProgram, program, show)
22
33{-| -}
44