github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/tests/AssetsTests.elm (about)

     1  module AssetsTests exposing (backgroundImageTests, toStringTests)
     2  
     3  import Assets
     4      exposing
     5          ( Asset(..)
     6          , CircleOutlineIcon(..)
     7          , ComponentType(..)
     8          , backgroundImage
     9          , toString
    10          )
    11  import Concourse.BuildStatus exposing (BuildStatus(..))
    12  import Concourse.Cli exposing (Cli(..))
    13  import Concourse.PipelineStatus exposing (PipelineStatus(..), StatusDetails(..))
    14  import Expect
    15  import Test exposing (Test, describe, test)
    16  
    17  
    18  toStringTests : Test
    19  toStringTests =
    20      describe "Assets"
    21          [ describe "CliIcon"
    22              [ test "OSX" <|
    23                  \_ ->
    24                      CliIcon OSX
    25                          |> toString
    26                          |> Expect.equal "/public/images/apple-logo.svg"
    27              , test "Windows" <|
    28                  \_ ->
    29                      CliIcon Windows
    30                          |> toString
    31                          |> Expect.equal "/public/images/windows-logo.svg"
    32              , test "Linux" <|
    33                  \_ ->
    34                      CliIcon Linux
    35                          |> toString
    36                          |> Expect.equal "/public/images/linux-logo.svg"
    37              ]
    38          , test "ChevronLeft" <|
    39              \_ ->
    40                  ChevronLeft
    41                      |> toString
    42                      |> Expect.equal "/public/images/baseline-chevron-left.svg"
    43          , test "ChevronRight" <|
    44              \_ ->
    45                  ChevronRight
    46                      |> toString
    47                      |> Expect.equal "/public/images/baseline-chevron-right.svg"
    48          , describe "ToggleSwitch"
    49              [ test "On" <|
    50                  \_ ->
    51                      ToggleSwitch True
    52                          |> toString
    53                          |> Expect.equal "/public/images/ic-toggle-on.svg"
    54              , test "Off" <|
    55                  \_ ->
    56                      ToggleSwitch False
    57                          |> toString
    58                          |> Expect.equal "/public/images/ic-toggle-off.svg"
    59              ]
    60          , describe "VisibilityToggleIcon"
    61              [ test "Visible" <|
    62                  \_ ->
    63                      VisibilityToggleIcon True
    64                          |> toString
    65                          |> Expect.equal "/public/images/baseline-visibility.svg"
    66              , test "Not Visible" <|
    67                  \_ ->
    68                      VisibilityToggleIcon False
    69                          |> toString
    70                          |> Expect.equal "/public/images/baseline-visibility-off.svg"
    71              ]
    72          , describe "BuildFavicon"
    73              [ test "Nothing" <|
    74                  \_ ->
    75                      BuildFavicon Nothing
    76                          |> toString
    77                          |> Expect.equal "/public/images/favicon.png"
    78              , test "Pending" <|
    79                  \_ ->
    80                      BuildFavicon (Just BuildStatusPending)
    81                          |> toString
    82                          |> Expect.equal "/public/images/favicon-pending.png"
    83              , test "Started" <|
    84                  \_ ->
    85                      BuildFavicon (Just BuildStatusStarted)
    86                          |> toString
    87                          |> Expect.equal "/public/images/favicon-started.png"
    88              , test "Succeeded" <|
    89                  \_ ->
    90                      BuildFavicon (Just BuildStatusSucceeded)
    91                          |> toString
    92                          |> Expect.equal "/public/images/favicon-succeeded.png"
    93              , test "Failed" <|
    94                  \_ ->
    95                      BuildFavicon (Just BuildStatusFailed)
    96                          |> toString
    97                          |> Expect.equal "/public/images/favicon-failed.png"
    98              , test "Errored" <|
    99                  \_ ->
   100                      BuildFavicon (Just BuildStatusErrored)
   101                          |> toString
   102                          |> Expect.equal "/public/images/favicon-errored.png"
   103              , test "Aborted" <|
   104                  \_ ->
   105                      BuildFavicon (Just BuildStatusAborted)
   106                          |> toString
   107                          |> Expect.equal "/public/images/favicon-aborted.png"
   108              ]
   109          , test "PinIconWhite" <|
   110              \_ ->
   111                  PinIconWhite
   112                      |> toString
   113                      |> Expect.equal "/public/images/pin-ic-white.svg"
   114          , test "PinIconGrey" <|
   115              \_ ->
   116                  PinIconGrey
   117                      |> toString
   118                      |> Expect.equal "/public/images/pin-ic-grey.svg"
   119          , test "CheckmarkIcon" <|
   120              \_ ->
   121                  CheckmarkIcon
   122                      |> toString
   123                      |> Expect.equal "/public/images/checkmark-ic.svg"
   124          , test "ArchivedPipelineIcon" <|
   125              \_ ->
   126                  ArchivedPipelineIcon
   127                      |> toString
   128                      |> Expect.equal "/public/images/ic-archived-pipeline.svg"
   129          , test "PassportOfficerIcon" <|
   130              \_ ->
   131                  PassportOfficerIcon
   132                      |> toString
   133                      |> Expect.equal "/public/images/passport-officer-ic.svg"
   134          , test "ConcourseLogoWhite" <|
   135              \_ ->
   136                  ConcourseLogoWhite
   137                      |> toString
   138                      |> Expect.equal "/public/images/concourse-logo-white.svg"
   139          , describe "CircleOutlineIcon"
   140              [ test "Play" <|
   141                  \_ ->
   142                      CircleOutlineIcon PlayCircleIcon
   143                          |> toString
   144                          |> Expect.equal "/public/images/ic-play-circle-outline-white.svg"
   145              , test "Pause" <|
   146                  \_ ->
   147                      CircleOutlineIcon PauseCircleIcon
   148                          |> toString
   149                          |> Expect.equal "/public/images/ic-pause-circle-outline-white.svg"
   150              , test "Add" <|
   151                  \_ ->
   152                      CircleOutlineIcon AddCircleIcon
   153                          |> toString
   154                          |> Expect.equal "/public/images/ic-add-circle-outline-white.svg"
   155              , test "Abort" <|
   156                  \_ ->
   157                      CircleOutlineIcon AbortCircleIcon
   158                          |> toString
   159                          |> Expect.equal "/public/images/ic-abort-circle-outline-white.svg"
   160              ]
   161          , test "CogsIcon" <|
   162              \_ ->
   163                  CogsIcon
   164                      |> toString
   165                      |> Expect.equal "/public/images/ic-cogs.svg"
   166          , test "RunningLegend" <|
   167              \_ ->
   168                  RunningLegend
   169                      |> toString
   170                      |> Expect.equal "/public/images/ic-running-legend.svg"
   171          , test "NotBlockingCheckIcon" <|
   172              \_ ->
   173                  NotBlockingCheckIcon
   174                      |> toString
   175                      |> Expect.equal "/public/images/ic-not-blocking-check.svg"
   176          , test "RerunIcon" <|
   177              \_ ->
   178                  RerunIcon
   179                      |> toString
   180                      |> Expect.equal "/public/images/ic-rerun.svg"
   181          , test "PendingIcon" <|
   182              \_ ->
   183                  PendingIcon
   184                      |> toString
   185                      |> Expect.equal "/public/images/ic-pending.svg"
   186          , test "InterruptedIcon" <|
   187              \_ ->
   188                  InterruptedIcon
   189                      |> toString
   190                      |> Expect.equal "/public/images/ic-interrupted.svg"
   191          , test "CancelledIcon" <|
   192              \_ ->
   193                  CancelledIcon
   194                      |> toString
   195                      |> Expect.equal "/public/images/ic-cancelled.svg"
   196          , test "SuccessCheckIcon" <|
   197              \_ ->
   198                  SuccessCheckIcon
   199                      |> toString
   200                      |> Expect.equal "/public/images/ic-success-check.svg"
   201          , test "FailureTimesIcon" <|
   202              \_ ->
   203                  FailureTimesIcon
   204                      |> toString
   205                      |> Expect.equal "/public/images/ic-failure-times.svg"
   206          , test "ExclamationTriangleIcon" <|
   207              \_ ->
   208                  ExclamationTriangleIcon
   209                      |> toString
   210                      |> Expect.equal "/public/images/ic-exclamation-triangle.svg"
   211          , describe "PipelineStatusIcon"
   212              [ test "Paused" <|
   213                  \_ ->
   214                      PipelineStatusPaused
   215                          |> PipelineStatusIcon
   216                          |> toString
   217                          |> Expect.equal "/public/images/ic-pause-blue.svg"
   218              , test "Pending" <|
   219                  \_ ->
   220                      PipelineStatusPending True
   221                          |> PipelineStatusIcon
   222                          |> toString
   223                          |> Expect.equal "/public/images/ic-pending-grey.svg"
   224              , test "Succeeded" <|
   225                  \_ ->
   226                      PipelineStatusSucceeded Running
   227                          |> PipelineStatusIcon
   228                          |> toString
   229                          |> Expect.equal "/public/images/ic-running-green.svg"
   230              , test "Failed" <|
   231                  \_ ->
   232                      PipelineStatusFailed Running
   233                          |> PipelineStatusIcon
   234                          |> toString
   235                          |> Expect.equal "/public/images/ic-failing-red.svg"
   236              , test "Aborted" <|
   237                  \_ ->
   238                      PipelineStatusAborted Running
   239                          |> PipelineStatusIcon
   240                          |> toString
   241                          |> Expect.equal "/public/images/ic-aborted-brown.svg"
   242              , test "Errored" <|
   243                  \_ ->
   244                      PipelineStatusErrored Running
   245                          |> PipelineStatusIcon
   246                          |> toString
   247                          |> Expect.equal "/public/images/ic-error-orange.svg"
   248              ]
   249          , test "PipelineStatusIconStale" <|
   250              \_ ->
   251                  PipelineStatusIconStale
   252                      |> toString
   253                      |> Expect.equal "/public/images/ic-cached-grey.svg"
   254          , test "ClippyIcon" <|
   255              \_ ->
   256                  ClippyIcon
   257                      |> toString
   258                      |> Expect.equal "/public/images/clippy.svg"
   259          , test "UpArrow" <|
   260              \_ ->
   261                  UpArrow
   262                      |> toString
   263                      |> Expect.equal "/public/images/ic-arrow-upward.svg"
   264          , test "DownArrow" <|
   265              \_ ->
   266                  DownArrow
   267                      |> toString
   268                      |> Expect.equal "/public/images/ic-arrow-downward.svg"
   269          , test "RefreshIcon" <|
   270              \_ ->
   271                  RefreshIcon
   272                      |> toString
   273                      |> Expect.equal "/public/images/baseline-refresh.svg"
   274          , test "MessageIcon" <|
   275              \_ ->
   276                  MessageIcon
   277                      |> toString
   278                      |> Expect.equal "/public/images/baseline-message.svg"
   279          , test "HamburgerMenuIcon" <|
   280              \_ ->
   281                  HamburgerMenuIcon
   282                      |> toString
   283                      |> Expect.equal "/public/images/baseline-menu.svg"
   284          , test "PeopleIcon" <|
   285              \_ ->
   286                  PeopleIcon
   287                      |> toString
   288                      |> Expect.equal "/public/images/baseline-people.svg"
   289          , test "PlusIcon" <|
   290              \_ ->
   291                  PlusIcon
   292                      |> toString
   293                      |> Expect.equal "/public/images/ic-plus.svg"
   294          , test "MinusIcon" <|
   295              \_ ->
   296                  MinusIcon
   297                      |> toString
   298                      |> Expect.equal "/public/images/ic-minus.svg"
   299          , test "PlayIcon" <|
   300              \_ ->
   301                  PlayIcon
   302                      |> toString
   303                      |> Expect.equal "/public/images/ic-play-white.svg"
   304          , test "PauseIcon" <|
   305              \_ ->
   306                  PauseIcon
   307                      |> toString
   308                      |> Expect.equal "/public/images/ic-pause-white.svg"
   309          , test "SearchIconWhite" <|
   310              \_ ->
   311                  SearchIconWhite
   312                      |> toString
   313                      |> Expect.equal "/public/images/ic-search-white.svg"
   314          , test "SearchIconGrey" <|
   315              \_ ->
   316                  SearchIconGrey
   317                      |> toString
   318                      |> Expect.equal "/public/images/ic-search-grey.svg"
   319          , test "CloseIcon" <|
   320              \_ ->
   321                  CloseIcon
   322                      |> toString
   323                      |> Expect.equal "/public/images/ic-close-white.svg"
   324          , test "PencilIcon" <|
   325              \_ ->
   326                  PencilIcon
   327                      |> toString
   328                      |> Expect.equal "/public/images/pencil-white.svg"
   329          ]
   330  
   331  
   332  backgroundImageTests : Test
   333  backgroundImageTests =
   334      describe "backgroundImage"
   335          [ test "Just" <|
   336              \_ ->
   337                  CliIcon OSX
   338                      |> Just
   339                      |> Assets.backgroundImage
   340                      |> Expect.equal "url(/public/images/apple-logo.svg)"
   341          , test "Nothing" <|
   342              \_ ->
   343                  Nothing
   344                      |> Assets.backgroundImage
   345                      |> Expect.equal "none"
   346          ]