This commit is contained in:
Jeroen Engels 2024-05-07 23:12:02 +02:00
parent db85181f6a
commit 6a9fe48b1f

View File

@ -34,6 +34,27 @@ import Html.Attributes as Attr
view model = view model =
Html.span [ Attr.class "unknown" ] [] Html.span [ Attr.class "unknown" ] []
"""
|> Review.Test.runWithProjectData projectWithCssClasses
(cssFiles [ FilePattern.include "*.css" ] |> rule)
|> Review.Test.expectErrorsForExtraFile "some-file.css"
[ Review.Test.error
{ message = "Found unused CSS classes"
, details =
[ "This file declared the usage of some CSS classes for which I could not any usage in the Elm codebase. Please check that no typo was made in the name of the classes, and remove them if they still seem unused."
, "Here are the classes that seem unused: unused"
]
, under = "-- First line"
}
]
, test "should not report an error when all CSS classes are used" <|
\() ->
"""module A exposing (..)
import Html
import Html.Attributes as Attr
view model =
Html.span [ Attr.class "unused" ] []
""" """
|> Review.Test.runWithProjectData projectWithCssClasses |> Review.Test.runWithProjectData projectWithCssClasses
(cssFiles [ FilePattern.include "*.css" ] |> rule) (cssFiles [ FilePattern.include "*.css" ] |> rule)