github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/tests/DashboardTooltipTests.elm (about) 1 module DashboardTooltipTests exposing (all) 2 3 import Dashboard.Dashboard as Dashboard 4 import Data 5 import Dict 6 import Expect 7 import HoverState exposing (HoverState(..)) 8 import Html 9 import Message.Message exposing (DomID(..), PipelinesSection(..)) 10 import Test exposing (Test, describe, test) 11 import Test.Html.Query as Query 12 import Test.Html.Selector exposing (text) 13 14 15 all : Test 16 all = 17 describe "tooltip" 18 [ test "says 'hide' when an exposed pipeline is hovered" <| 19 \_ -> 20 Dashboard.tooltip 21 { pipelines = 22 Just <| 23 Dict.fromList 24 [ ( "team", [ Data.dashboardPipeline 0 True ] ) ] 25 } 26 { hovered = 27 Tooltip 28 (VisibilityButton AllPipelinesSection Data.pipelineId) 29 Data.elementPosition 30 } 31 |> Maybe.map .body 32 |> Maybe.withDefault (Html.text "") 33 |> Query.fromHtml 34 |> Query.has [ text "hide" ] 35 , test "says 'expose' when a hidden pipeline is hovered" <| 36 \_ -> 37 Dashboard.tooltip 38 { pipelines = 39 Just <| 40 Dict.fromList 41 [ ( "team", [ Data.dashboardPipeline 0 False ] ) ] 42 } 43 { hovered = 44 Tooltip 45 (VisibilityButton AllPipelinesSection Data.pipelineId) 46 Data.elementPosition 47 } 48 |> Maybe.map .body 49 |> Maybe.withDefault (Html.text "") 50 |> Query.fromHtml 51 |> Query.has [ text "expose" ] 52 , test "says 'disabled' when a pipeline with jobs disabled is hovered" <| 53 \_ -> 54 let 55 p = 56 Data.dashboardPipeline 0 True 57 in 58 Dashboard.tooltip 59 { pipelines = 60 Just <| 61 Dict.fromList 62 [ ( "team", [ { p | jobsDisabled = True } ] ) ] 63 } 64 { hovered = 65 Tooltip 66 (PipelineStatusIcon AllPipelinesSection Data.pipelineId) 67 Data.elementPosition 68 } 69 |> Maybe.map .body 70 |> Maybe.withDefault (Html.text "") 71 |> Query.fromHtml 72 |> Query.has [ text "disabled" ] 73 ]