github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/tests/PauseToggleTests.elm (about) 1 module PauseToggleTests exposing (all) 2 3 import ColorValues 4 import Data 5 import Dict 6 import Message.Message exposing (DomID(..), PipelinesSection(..)) 7 import Test exposing (Test, describe, test) 8 import Test.Html.Query as Query 9 import Test.Html.Selector exposing (containing, style, tag, text) 10 import UserState exposing (UserState(..)) 11 import Views.PauseToggle as PauseToggle 12 import Views.Styles as Styles 13 14 15 all : Test 16 all = 17 describe "pause toggle" 18 [ describe "when user is unauthorized" <| 19 let 20 pipeline = 21 Data.pipelineId 22 23 userState = 24 UserStateLoggedIn 25 { id = "test" 26 , userName = "test" 27 , name = "test" 28 , email = "test" 29 , isAdmin = False 30 , teams = Dict.fromList [ ( "team", [ "viewer" ] ) ] 31 } 32 in 33 [ test "has very low opacity" <| 34 \_ -> 35 PauseToggle.view 36 { isPaused = False 37 , pipeline = pipeline 38 , isToggleHovered = False 39 , isToggleLoading = False 40 , margin = "" 41 , userState = userState 42 , tooltipPosition = Styles.Above 43 , domID = PipelineCardPauseToggle AllPipelinesSection pipeline 44 } 45 |> Query.fromHtml 46 |> Query.has [ style "opacity" "0.2" ] 47 , test "has tooltip above" <| 48 \_ -> 49 PauseToggle.view 50 { isPaused = False 51 , pipeline = pipeline 52 , isToggleHovered = True 53 , isToggleLoading = False 54 , margin = "" 55 , userState = userState 56 , tooltipPosition = Styles.Above 57 , domID = PipelineCardPauseToggle AllPipelinesSection pipeline 58 } 59 |> Query.fromHtml 60 |> Query.has 61 [ style "position" "relative" 62 , containing 63 [ tag "div" 64 , containing [ text "not authorized" ] 65 , style "background-color" ColorValues.grey20 66 , style "position" "absolute" 67 , style "bottom" "100%" 68 , style "white-space" "nowrap" 69 , style "padding" "2.5px" 70 , style "margin-bottom" "5px" 71 , style "right" "-150%" 72 , style "z-index" "1" 73 ] 74 ] 75 , test "has tooltip below" <| 76 \_ -> 77 PauseToggle.view 78 { isPaused = False 79 , pipeline = pipeline 80 , isToggleHovered = True 81 , isToggleLoading = False 82 , margin = "" 83 , userState = userState 84 , tooltipPosition = Styles.Below 85 , domID = PipelineCardPauseToggle AllPipelinesSection pipeline 86 } 87 |> Query.fromHtml 88 |> Query.has 89 [ style "position" "relative" 90 , containing 91 [ tag "div" 92 , containing [ text "not authorized" ] 93 , style "background-color" ColorValues.grey20 94 , style "position" "absolute" 95 , style "top" "100%" 96 , style "white-space" "nowrap" 97 , style "padding" "2.5px" 98 , style "margin-bottom" "5px" 99 , style "right" "-150%" 100 , style "z-index" "1" 101 ] 102 ] 103 ] 104 ]