add exception for exact height in columns

This commit is contained in:
Matthew Griffith 2019-07-06 10:29:13 -04:00
parent 563e86266a
commit 3b1f4b6a6b
3 changed files with 25 additions and 14 deletions

View File

@ -1055,7 +1055,7 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
name = name =
"height-px-" ++ val "height-px-" ++ val
in in
gatherAttrRecursive (name ++ " " ++ classes) gatherAttrRecursive (Internal.Style.classes.heightExact ++ " " ++ name ++ " " ++ classes)
node node
(Flag.add Flag.height has) (Flag.add Flag.height has)
transform transform
@ -1443,7 +1443,7 @@ renderHeight h =
"height-px-" ++ val "height-px-" ++ val
in in
( Flag.none ( Flag.none
, name , Internal.Style.classes.heightExact ++ " " ++ name
, [ Single name "height" (val ++ "px") ] , [ Single name "height" (val ++ "px") ]
) )

View File

@ -148,6 +148,7 @@ classes =
, widthFillPortion = "wfp" , widthFillPortion = "wfp"
, heightFill = "hf" , heightFill = "hf"
, heightContent = "hc" , heightContent = "hc"
, heightExact = "he"
, heightFillPortion = "hfp" , heightFillPortion = "hfp"
, seButton = "sbt" , seButton = "sbt"
@ -1344,9 +1345,14 @@ baseSheet =
, Descriptor (dot classes.column) , Descriptor (dot classes.column)
[ Prop "display" "flex" [ Prop "display" "flex"
, Prop "flex-direction" "column" , Prop "flex-direction" "column"
-- This should resolve this
-- https://github.com/mdgriffith/elm-ui/pull/43
-- But things break
-- TODO: why do they break??
, Child (dot classes.any) , Child (dot classes.any)
[ Prop "flex-basis" "0%" [ Prop "flex-basis" "0%"
, Descriptor (dot classes.widthExact) , Descriptor (dot classes.heightExact)
[ Prop "flex-basis" "auto" [ Prop "flex-basis" "auto"
] ]
] ]
@ -1364,7 +1370,7 @@ baseSheet =
Prop "width" "100%" Prop "width" "100%"
] ]
-- TODO:: THIs might be necessary, maybe it should move to widthFill? -- TODO:: This might be necessary, maybe it should move to widthFill?
-- , Child (dot classes.widthFill) -- , Child (dot classes.widthFill)
-- [ Prop "align-self" "stretch" -- [ Prop "align-self" "stretch"
-- , Descriptor (dot classes.alignedHorizontally) -- , Descriptor (dot classes.alignedHorizontally)

View File

@ -16,7 +16,6 @@ module Testable.Element exposing
, fill , fill
, fillPortion , fillPortion
, height , height
, heightHelper
, inFront , inFront
, isVisible , isVisible
, label , label
@ -36,7 +35,6 @@ module Testable.Element exposing
, textColumn , textColumn
, transparent , transparent
, width , width
, widthHelper
) )
{-| This module should mirror the top level `Element` api, with one important distinction. {-| This module should mirror the top level `Element` api, with one important distinction.
@ -300,10 +298,12 @@ widthHelper maybeMin maybeMax len =
) )
, test = , test =
\found _ -> \found _ ->
Expect.true "exact width is exact" Expect.all
((floor found.self.bbox.width == val) [ \_ ->
&& minMaxTest (floor found.self.bbox.width) Expect.true "exact width is exact" (floor found.self.bbox.width == val)
) , \_ -> Expect.true "min/max is upheld" (minMaxTest (floor found.self.bbox.width))
]
()
} }
Fill portion -> Fill portion ->
@ -459,10 +459,15 @@ heightHelper maybeMin maybeMax len =
) )
, test = , test =
\found _ -> \found _ ->
Expect.true "exact height is exact" Expect.all
((floor found.self.bbox.height == val) [ \_ ->
&& minMaxTest (floor found.self.bbox.height) Expect.true ("exact height is exact: " ++ String.fromInt (floor found.self.bbox.height) ++ "," ++ String.fromInt val)
) (floor found.self.bbox.height == val)
, \_ ->
Expect.true "min/max holds true"
(minMaxTest (floor found.self.bbox.height))
]
()
} }
Fill portion -> Fill portion ->