git.iko.soy/typeable/elm-ui
on master help sign in
start Testable.Generator sketch
0dd85aeElm UI Automation
tests-rendering/src/Testable/Generator.elmnew file+64
@@ -0,0 +1,64 @@
1+module Testable.Generator exposing (..)
2+
3+{-| -}
4+
5+import Testable
6+import Testable.Element exposing (..)
7+import Testable.Runner
8+
9+
10+{-| Given a list of attributes, generate every context this list of attributes could be in.
11+
12+So, this means,
13+
14+ - every element type
15+ - in every element type
16+
17+-}
18+element : String -> List (Testable.Attr msg) -> List ( String, Testable.Element msg )
19+element label attrs =
20+ -- List.map
21+ -- (\c ->
22+ -- ( label, el attrs c )
23+ -- )
24+ -- content
25+ mapEveryCombo
26+ (\makeLayout child ->
27+ ( label, makeLayout attrs child )
28+ )
29+ layouts
30+ contents
31+
32+
33+mapEveryCombo fn listOne listTwo =
34+ List.concatMap
35+ (\one ->
36+ List.map
37+ (\two ->
38+ fn one two
39+ )
40+ listTwo
41+ )
42+ listOne
43+
44+
45+layouts =
46+ [ \attrs child ->
47+ el attrs child
48+ , \attrs child ->
49+ row attrs [ child ]
50+ , \attrs child ->
51+ column attrs [ child ]
52+ , \attrs child ->
53+ paragraph attrs [ child ]
54+ , \attrs child ->
55+ textColumn attrs [ child ]
56+ ]
57+
58+
59+contents =
60+ [ none
61+ , text "short and small"
62+ , text "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc."
63+ , el [ width (px 50), height (px 50) ] none
64+ ]