Merge pull request #224 from alexkorban/issue223

Add test for issue 223
This commit is contained in:
Matthew Griffith 2020-05-28 23:33:43 -04:00 committed by GitHub
commit 105c1b8251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,46 @@
module NearbyElementBordersOverlap exposing (view)
{-| Elements placed with onLeft, onRight, above & below overlap main element's border
# inFront elements with width fill are contained within the parent's border
<https://github.com/mdgriffith/elm-ui/issues/223>
In addition to the overlap, it affects layout in unexpected ways: eg if the elements
are the same height, onLeft and onRight elements will be vertically offset
from the main element.
-}
import Testable.Element exposing (..)
import Testable.Element.Border as Border
blue =
rgb 0 0 1
green =
rgb 0 1 0
grey =
rgb 0.5 0.5 0.5
view =
layout [ width fill, height fill ] <|
el
[ centerX
, centerY
, Border.width 10
, Border.color green
, padding 50
, above <| el [ Border.color grey, Border.width 10 ] <| text "above"
, below <| el [ Border.color grey, Border.width 10 ] <| text "below"
, onRight <| el [ Border.color blue, Border.width 10 ] <| text "onRight"
, onLeft <| el [ Border.color blue, Border.width 10 ] <| text "onLeft"
]
<|
text "Centre"