git.iko.soy/typeable/elm-ui
on master help sign in
add exception for exact height in columns
3b1f4b6Matthew Griffith
src/Internal/Model.elm+2−2
@@ -1055,7 +1055,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1055 name =
1055 name =
1056 "height-px-" ++ val
1056 "height-px-" ++ val
1057 in
1057 in
1058− gatherAttrRecursive (name ++ " " ++ classes)
1058+ gatherAttrRecursive (Internal.Style.classes.heightExact ++ " " ++ name ++ " " ++ classes)
1059 node
1059 node
1060 (Flag.add Flag.height has)
1060 (Flag.add Flag.height has)
1061 transform
1061 transform
@@ -1443,7 +1443,7 @@ renderHeight h =
1443 "height-px-" ++ val
1443 "height-px-" ++ val
1444 in
1444 in
1445 ( Flag.none
1445 ( Flag.none
1446− , name
1446+ , Internal.Style.classes.heightExact ++ " " ++ name
1447 , [ Single name "height" (val ++ "px") ]
1447 , [ Single name "height" (val ++ "px") ]
1448 )
1448 )
1449
1449
src/Internal/Style.elm+8−2
@@ -148,6 +148,7 @@ classes =
148 , widthFillPortion = "wfp"
148 , widthFillPortion = "wfp"
149 , heightFill = "hf"
149 , heightFill = "hf"
150 , heightContent = "hc"
150 , heightContent = "hc"
151+ , heightExact = "he"
151 , heightFillPortion = "hfp"
152 , heightFillPortion = "hfp"
152 , seButton = "sbt"
153 , seButton = "sbt"
153
154
@@ -1344,9 +1345,14 @@ baseSheet =
1344 , Descriptor (dot classes.column)
1345 , Descriptor (dot classes.column)
1345 [ Prop "display" "flex"
1346 [ Prop "display" "flex"
1346 , Prop "flex-direction" "column"
1347 , Prop "flex-direction" "column"
1348+
1349+ -- This should resolve this
1350+ -- https://github.com/mdgriffith/elm-ui/pull/43
1351+ -- But things break
1352+ -- TODO: why do they break??
1347 , Child (dot classes.any)
1353 , Child (dot classes.any)
1348 [ Prop "flex-basis" "0%"
1354 [ Prop "flex-basis" "0%"
1349− , Descriptor (dot classes.widthExact)
1355+ , Descriptor (dot classes.heightExact)
1350 [ Prop "flex-basis" "auto"
1356 [ Prop "flex-basis" "auto"
1351 ]
1357 ]
1352 ]
1358 ]
@@ -1364,7 +1370,7 @@ baseSheet =
1364 Prop "width" "100%"
1370 Prop "width" "100%"
1365 ]
1371 ]
1366
1372
1367− -- TODO:: THIs might be necessary, maybe it should move to widthFill?
1373+ -- TODO:: This might be necessary, maybe it should move to widthFill?
1368 -- , Child (dot classes.widthFill)
1374 -- , Child (dot classes.widthFill)
1369 -- [ Prop "align-self" "stretch"
1375 -- [ Prop "align-self" "stretch"
1370 -- , Descriptor (dot classes.alignedHorizontally)
1376 -- , Descriptor (dot classes.alignedHorizontally)
tests/src/Testable/Element.elm+15−10
@@ -16,7 +16,6 @@ module Testable.Element exposing
16 , fill
16 , fill
17 , fillPortion
17 , fillPortion
18 , height
18 , height
19− , heightHelper
20 , inFront
19 , inFront
21 , isVisible
20 , isVisible
22 , label
21 , label
@@ -36,7 +35,6 @@ module Testable.Element exposing
36 , textColumn
35 , textColumn
37 , transparent
36 , transparent
38 , width
37 , width
39− , widthHelper
40 )
38 )
41
39
42{-| This module should mirror the top level `Element` api, with one important distinction.
40{-| This module should mirror the top level `Element` api, with one important distinction.
@@ -300,10 +298,12 @@ widthHelper maybeMin maybeMax len =
300 )
298 )
301 , test =
299 , test =
302 \found _ ->
300 \found _ ->
303− Expect.true "exact width is exact"
301+ Expect.all
302+ [ \_ ->
304− ((floor found.self.bbox.width == val)
303+ Expect.true "exact width is exact" (floor found.self.bbox.width == val)
305− && minMaxTest (floor found.self.bbox.width)
304+ , \_ -> Expect.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
305+ ]
306− )
306+ ()
307 }
307 }
308
308
309 Fill portion ->
309 Fill portion ->
@@ -459,10 +459,15 @@ heightHelper maybeMin maybeMax len =
459 )
459 )
460 , test =
460 , test =
461 \found _ ->
461 \found _ ->
462+ Expect.all
463+ [ \_ ->
462− Expect.true "exact height is exact"
464+ Expect.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
463− ((floor found.self.bbox.height == val)
465+ (floor found.self.bbox.height == val)
466+ , \_ ->
467+ Expect.true "min/max holds true"
464− && minMaxTest (floor found.self.bbox.height)
468+ (minMaxTest (floor found.self.bbox.height))
469+ ]
465− )
470+ ()
466 }
471 }
467
472
468 Fill portion ->
473 Fill portion ->