elm-ui/tests/ClassNames.elm

173 lines
4.5 KiB
Elm
Raw Normal View History

2018-12-29 19:46:16 +03:00
module ClassNames exposing (suite)
2018-08-29 02:41:08 +03:00
2018-12-29 19:46:16 +03:00
{-| -}
import Expect
import Html exposing (Html)
2018-08-29 02:41:08 +03:00
import Internal.Style
import Test exposing (Test)
2018-12-29 19:46:16 +03:00
suite : Test
2018-12-29 19:46:16 +03:00
suite =
Test.describe "Classname Collisions"
[ Test.test "No duplicates" <|
\_ ->
Expect.equal [] onlyDuplicates
]
2018-08-29 02:41:08 +03:00
main : Html msg
2018-08-29 02:41:08 +03:00
main =
Html.div []
[ Html.text "The following names collide"
, Html.div []
(List.map viewPair onlyDuplicates)
]
viewPair : ( String, String ) -> Html msg
2018-08-29 02:41:08 +03:00
viewPair ( name, description ) =
Html.div []
[ Html.text name
, Html.text ": "
, Html.text description
]
onlyDuplicates =
List.filter findDuplicates allClassNames
findDuplicates ( name, description ) =
List.any
(\( checkName, checkDescription ) ->
checkName == name && description /= checkDescription
)
allClassNames
allClassNames =
List.map (Tuple.mapFirst (\fn -> fn Internal.Style.classes)) allClassNameFns
allClassNameFns =
[ ( .root, "root" )
, ( .any, "any" )
, ( .single, "single" )
, ( .row, "row" )
, ( .column, "column" )
, ( .page, "page" )
, ( .paragraph, "paragraph" )
, ( .text, "text" )
, ( .grid, "grid" )
, ( .imageContainer, "imageContainer" )
-- widhts/heights
, ( .widthFill, "widthFill" )
, ( .widthContent, "widthContent" )
, ( .widthExact, "widthExact" )
, ( .widthFillPortion, "widthFillPortion" )
, ( .heightFill, "heightFill" )
, ( .heightContent, "heightContent" )
, ( .heightFillPortion, "heightFillPortion" )
, ( .seButton, "seButton" )
-- nearby elements
, ( .above, "above" )
, ( .below, "below" )
, ( .onRight, "onRight" )
, ( .onLeft, "onLeft" )
, ( .inFront, "inFront" )
, ( .behind, "behind" )
-- alignments
, ( .alignTop, "alignTop" )
, ( .alignBottom, "alignBottom" )
, ( .alignRight, "alignRight" )
, ( .alignLeft, "alignLeft" )
, ( .alignCenterX, "alignCenterX" )
, ( .alignCenterY, "alignCenterY" )
, ( .alignedHorizontally, "alignedHorizontally" )
, ( .alignedVertically, "alignedVertically" )
-- space evenly
, ( .spaceEvenly, "spaceEvenly" )
, ( .container, "container" )
, ( .alignContainerRight, "alignContainerRight" )
, ( .alignContainerBottom, "alignContainerBottom" )
, ( .alignContainerCenterX, "alignContainerCenterX" )
, ( .alignContainerCenterY, "alignContainerCenterY" )
-- content alignments
, ( .contentTop, "contentTop" )
, ( .contentBottom, "contentBottom" )
, ( .contentRight, "contentRight" )
, ( .contentLeft, "contentLeft" )
, ( .contentCenterX, "contentCenterX" )
, ( .contentCenterY, "contentCenterY" )
-- selection
, ( .noTextSelection, "noTextSelection" )
, ( .cursorPointer, "cursorPointer" )
, ( .cursorText, "cursorText" )
-- pointer events
, ( .passPointerEvents, "passPointerEvents" )
, ( .capturePointerEvents, "capturePointerEvents" )
, ( .transparent, "transparent" )
, ( .opaque, "opaque" )
, ( .overflowHidden, "overflowHidden" )
-- special state classes
, ( .hover, "hover" )
-- , ( .hoverOpaque, "hoverOpaque" )
, ( .focus, "focus" )
-- , ( .focusOpaque, "focusOpaque" )
, ( .active, "active" )
-- , ( .activeOpaque, "activeOpaque" )
--scrollbars
, ( .scrollbars, "scrollbars" )
, ( .scrollbarsX, "scrollbarsX" )
, ( .scrollbarsY, "scrollbarsY" )
, ( .clip, "clip" )
, ( .clipX, "clipX" )
, ( .clipY, "clipY" )
-- borders
, ( .borderNone, "borderNone" )
, ( .borderDashed, "borderDashed" )
, ( .borderDotted, "borderDotted" )
, ( .borderSolid, "borderSolid" )
-- text weight
, ( .textThin, "textThin" )
, ( .textExtraLight, "textExtraLight" )
, ( .textLight, "textLight" )
, ( .textNormalWeight, "textNormalWeight" )
, ( .textMedium, "textMedium" )
, ( .textSemiBold, "textSemiBold" )
, ( .bold, "bold" )
, ( .textExtraBold, "textExtraBold" )
, ( .textHeavy, "textHeavy" )
, ( .italic, "italic" )
, ( .strike, "strike" )
, ( .underline, "underline" )
, ( .textUnitalicized, "textUnitalicized" )
-- text alignment
, ( .textJustify, "textJustify" )
, ( .textJustifyAll, "textJustifyAll" )
, ( .textCenter, "textCenter" )
, ( .textRight, "textRight" )
, ( .textLeft, "textLeft" )
, ( .transition, "transition" )
-- inputText
, ( .inputText, "inputText" )
, ( .inputMultiline, "inputMultiline" )
]