git.iko.soy/typeable/elm-ui
on master help sign in
add exception for exact height in columns
commit3b1f4b6a6b61493b4a7f369d2e4398df2fffe0d5 authorMatthew Griffith <mdg.griffith@gmail.com> dateSat 6 Jul 2019, 10:29 (7 years ago) parent563e862
3 files changed+25−14
src/Internal/Model.elm+2−2 src/Internal/Style.elm+8−2 tests/src/Testable/Element.elm+15−10
src/Internal/Model.elm+2−2
@@ -1055,7 +1055,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
10551055 name =
10561056 "height-px-" ++ val
10571057 in
1058− gatherAttrRecursive (name ++ " " ++ classes)
1058+ gatherAttrRecursive (Internal.Style.classes.heightExact ++ " " ++ name ++ " " ++ classes)
10591059 node
10601060 (Flag.add Flag.height has)
10611061 transform
@@ -1443,7 +1443,7 @@ renderHeight h =
14431443 "height-px-" ++ val
14441444 in
14451445 ( Flag.none
1446− , name
1446+ , Internal.Style.classes.heightExact ++ " " ++ name
14471447 , [ Single name "height" (val ++ "px") ]
14481448 )
14491449
src/Internal/Style.elm+8−2
@@ -148,6 +148,7 @@ classes =
148148 , widthFillPortion = "wfp"
149149 , heightFill = "hf"
150150 , heightContent = "hc"
151+ , heightExact = "he"
151152 , heightFillPortion = "hfp"
152153 , seButton = "sbt"
153154
@@ -1344,9 +1345,14 @@ baseSheet =
13441345 , Descriptor (dot classes.column)
13451346 [ Prop "display" "flex"
13461347 , 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??
13471353 , Child (dot classes.any)
13481354 [ Prop "flex-basis" "0%"
1349− , Descriptor (dot classes.widthExact)
1355+ , Descriptor (dot classes.heightExact)
13501356 [ Prop "flex-basis" "auto"
13511357 ]
13521358 ]
@@ -1364,7 +1370,7 @@ baseSheet =
13641370 Prop "width" "100%"
13651371 ]
13661372
1367− -- TODO:: THIs might be necessary, maybe it should move to widthFill?
1373+ -- TODO:: This might be necessary, maybe it should move to widthFill?
13681374 -- , Child (dot classes.widthFill)
13691375 -- [ Prop "align-self" "stretch"
13701376 -- , Descriptor (dot classes.alignedHorizontally)
tests/src/Testable/Element.elm+15−10
@@ -16,7 +16,6 @@ module Testable.Element exposing
1616 , fill
1717 , fillPortion
1818 , height
19− , heightHelper
2019 , inFront
2120 , isVisible
2221 , label
@@ -36,7 +35,6 @@ module Testable.Element exposing
3635 , textColumn
3736 , transparent
3837 , width
39− , widthHelper
4038 )
4139
4240{-| This module should mirror the top level `Element` api, with one important distinction.
@@ -300,10 +298,12 @@ widthHelper maybeMin maybeMax len =
300298 )
301299 , test =
302300 \found _ ->
303− Expect.true "exact width is exact"
304− ((floor found.self.bbox.width == val)
305− && minMaxTest (floor found.self.bbox.width)
306− )
301+ Expect.all
302+ [ \_ ->
303+ Expect.true "exact width is exact" (floor found.self.bbox.width == val)
304+ , \_ -> Expect.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
305+ ]
306+ ()
307307 }
308308
309309 Fill portion ->
@@ -459,10 +459,15 @@ heightHelper maybeMin maybeMax len =
459459 )
460460 , test =
461461 \found _ ->
462− Expect.true "exact height is exact"
463− ((floor found.self.bbox.height == val)
464− && minMaxTest (floor found.self.bbox.height)
465− )
462+ Expect.all
463+ [ \_ ->
464+ Expect.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
465+ (floor found.self.bbox.height == val)
466+ , \_ ->
467+ Expect.true "min/max holds true"
468+ (minMaxTest (floor found.self.bbox.height))
469+ ]
470+ ()
466471 }
467472
468473 Fill portion ->