github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/tests/TagTests.elm (about) 1 module TagTests exposing (all, tag, white) 2 3 import ColorValues 4 import Dashboard.Group.Tag as Tag 5 import Expect exposing (Expectation) 6 import Fuzz 7 import Test exposing (..) 8 import Test.Html.Query as Query 9 import Test.Html.Selector exposing (style) 10 11 12 tag : Fuzz.Fuzzer Tag.Tag 13 tag = 14 Fuzz.frequency 15 [ ( 1, Fuzz.constant Tag.Owner ) 16 , ( 1, Fuzz.constant Tag.Member ) 17 , ( 1, Fuzz.constant Tag.PipelineOperator ) 18 , ( 1, Fuzz.constant Tag.Viewer ) 19 ] 20 21 22 white : String 23 white = 24 "#ffffff" 25 26 27 all : Test 28 all = 29 describe "dashboard team role pill" <| 30 let 31 hasStyle : List ( String, String ) -> Tag.Tag -> Expectation 32 hasStyle styles = 33 Tag.view False 34 >> Query.fromHtml 35 >> Query.has (List.map (\( k, v ) -> style k v) styles) 36 in 37 [ fuzz tag "has a white border" <| 38 hasStyle [ ( "border", "1px solid " ++ ColorValues.white ) ] 39 , fuzz tag "is an inline-block" <| 40 hasStyle [ ( "display", "inline-block" ) ] 41 , fuzz tag "has very small font" <| 42 hasStyle [ ( "font-size", "0.7em" ) ] 43 , fuzz tag "letters are spaced apart" <| 44 hasStyle [ ( "letter-spacing", "0.2em" ) ] 45 , fuzz tag "has a bit of padding above and below" <| 46 hasStyle 47 [ ( "padding", "0.5em" ) 48 , ( "line-height", "0.9em" ) 49 ] 50 , fuzz tag "text is horizontally centered in the white box" <| 51 hasStyle [ ( "text-align", "center" ) ] 52 ]