git.iko.soy/typeable/elm-ui
on master help sign in
Reorganize tests for easier running.
commit47658084581dc37eca64ffd4ce685350ced92e5f authorMatthew Griffith <mdg.griffith@gmail.com> dateSat 29 Dec 2018, 11:46 (8 years ago) parent7e0d0b4
22 files changed+68−41
tests/Tests/Manual/AlignedForm.elm → cases/Manual/AlignedForm.elm tests/Tests/Manual/All.elm → cases/Manual/All.elm tests/Tests/Manual/LazyPerformance.elm → cases/Manual/LazyPerformance.elm tests/Tests/Manual/OtherScrollbars.elm → cases/Manual/OtherScrollbars.elm tests/Tests/Manual/Overflow.elm → cases/Manual/Overflow.elm tests/Tests/Manual/Scrollbars.elm → cases/Manual/Scrollbars.elm tests/Tests/Manual/ScrollbarsPls.elm → cases/Manual/ScrollbarsPls.elm tests/Tests/Manual/TextLayout.elm → cases/Manual/TextLayout.elm tests/cases/resolved/Adjusted.elm → cases/resolved/Adjusted.elm tests/cases/resolved/BehindContent.elm → cases/resolved/BehindContent.elm tests/cases/resolved/OtherOtherZindex.elm → cases/resolved/OtherOtherZindex.elm tests/cases/resolved/OtherZIndex.elm → cases/resolved/OtherZIndex.elm tests/cases/resolved/ReversedTableOrder.elm → cases/resolved/ReversedTableOrder.elm tests/cases/resolved/ZIndex.elm → cases/resolved/ZIndex.elm tests/cases/resolved/elm.json → cases/resolved/elm.json src/Element.elm+1−1 tests/README.md+25 tests/Tests/Table.elm → tests/Tests/Table.elm.todo+3−3 tests/Tests/WidthHeight.elm+1−1 tests/src/Testable/FuzzMain.elm → tests/src/Testable/FuzzMain.elm.old+5−2 tests/suite/ClassNames.elm+13−1 tests/suite/Flags.elm+20−33
tests/Tests/Manual/AlignedForm.elm → cases/Manual/AlignedForm.elmrenamed

The content is the same.

tests/Tests/Manual/All.elm → cases/Manual/All.elmrenamed

The content is the same.

tests/Tests/Manual/LazyPerformance.elm → cases/Manual/LazyPerformance.elmrenamed

The content is the same.

tests/Tests/Manual/OtherScrollbars.elm → cases/Manual/OtherScrollbars.elmrenamed

The content is the same.

tests/Tests/Manual/Overflow.elm → cases/Manual/Overflow.elmrenamed

The content is the same.

tests/Tests/Manual/Scrollbars.elm → cases/Manual/Scrollbars.elmrenamed

The content is the same.

tests/Tests/Manual/ScrollbarsPls.elm → cases/Manual/ScrollbarsPls.elmrenamed

The content is the same.

tests/Tests/Manual/TextLayout.elm → cases/Manual/TextLayout.elmrenamed

The content is the same.

tests/cases/resolved/Adjusted.elm → cases/resolved/Adjusted.elmrenamed

The content is the same.

tests/cases/resolved/BehindContent.elm → cases/resolved/BehindContent.elmrenamed

The content is the same.

tests/cases/resolved/OtherOtherZindex.elm → cases/resolved/OtherOtherZindex.elmrenamed

The content is the same.

tests/cases/resolved/OtherZIndex.elm → cases/resolved/OtherZIndex.elmrenamed

The content is the same.

tests/cases/resolved/ReversedTableOrder.elm → cases/resolved/ReversedTableOrder.elmrenamed

The content is the same.

tests/cases/resolved/ZIndex.elm → cases/resolved/ZIndex.elmrenamed

The content is the same.

tests/cases/resolved/elm.json → cases/resolved/elm.jsonrenamed

The content is the same.

src/Element.elm+1−1
@@ -299,7 +299,7 @@ fromRgb255 clr =
299299 clr.alpha
300300
301301
302−{-| Deconstruct a `Color` into it's rgb channels.
302+{-| Deconstruct a `Color` into its rgb channels.
303303-}
304304toRgb :
305305 Color
tests/README.mdnew file+25
@@ -0,0 +1,25 @@
1+# Elm UI Test Suite
2+
3+There are two types of tests for Elm UI. The normal kind, which are located in `tests/suite/`
4+
5+These can be run using [`elm-test`](https://github.com/elm-explorations/test) and can be run via
6+
7+```bash
8+elm-test
9+```
10+
11+at the `elm-ui` root.
12+
13+# Layout Testing
14+
15+`elm-ui` also needs to ensure that all layouts work as expected on all browsers.
16+
17+In order to do this, we need a different testing environment.
18+
19+So, the tests in `elm-ui/tests/Tests` will render output, then harvest bounding boxes form the browser, and run the test on the resulting data.
20+
21+In order to run the test locally, compile
22+
23+`elm make Tests/Run.elm --output elm.js`
24+
25+and then open `gather-styles.html`
tests/Tests/Table.elm → tests/Tests/Table.elm.todorenamed+3−3
@@ -1,12 +1,12 @@
1−module Tests.Table exposing (..)
1+module Tests.Table exposing (box, container, main, view)
22
3−import Tests.Palette as Palette exposing (..)
43import Html
54import Testable
65import Testable.Element as Element exposing (..)
76import Testable.Element.Background as Background
87import Testable.Element.Font as Font
98import Testable.Runner
9+import Tests.Palette as Palette exposing (..)
1010
1111
1212{-| -}
@@ -104,7 +104,7 @@ view =
104104 el [ Font.color white ] <|
105105 text "Index"
106106 , view =
107− \i row -> el [ Background.color lightGrey, width fill ] <| text (toString i)
107+ \i row -> el [ Background.color lightGrey, width fill ] <| text (String.fromInt i)
108108 }
109109 , { header =
110110 el [ Font.color white ] <|
tests/Tests/WidthHeight.elm+1−1
@@ -1,4 +1,4 @@
1−module Tests.Basic exposing (view)
1+module Tests.WidthHeight exposing (view)
22
33{-| -}
44
tests/src/Testable/FuzzMain.elm → tests/src/Testable/FuzzMain.elm.oldrenamed+5−2
@@ -1,4 +1,4 @@
1−port module Main exposing (..)
1+port module FuzzMain exposing (Model, Msg(..), PossibleAttributes, Stage(..), Testable, TestableElement(..), allIndividualTestables, allPossibilities, analyze, attr, availableAttributes, content, createContainer, createElement, generateTest, generateTests, heightFill, heightPx, heights, init, layout, main, possibleToList, runTest, styles, subscriptions, testableLayout, tests, update, view, viewResult, widthFill, widthPx, widths)
22
33{-| -}
44
@@ -26,7 +26,8 @@ init : ( Model Msg, Cmd Msg )
2626init =
2727 ( { current = Nothing
2828 , upcoming =
29− Tests.tests
29+ -- Tests.tests
30+ []
3031
3132 -- generateTests (Random.initialSeed 227852860) 1
3233 , finished = []
@@ -93,6 +94,7 @@ generateTests : Random.Seed -> Int -> List (Testable msg)
9394generateTests seed num =
9495 if num <= 0 then
9596 []
97+
9698 else
9799 let
98100 ( testable, newSeed ) =
@@ -225,6 +227,7 @@ view model =
225227 -- , Background.color Color.grey
226228 ]
227229 (List.map viewResult model.finished)
230+
228231 else
229232 Html.text "running?"
230233
tests/suite/ClassNames.elm+13−1
@@ -1,8 +1,20 @@
1−module Main exposing (..)
1+module ClassNames exposing (suite)
22
3+{-| -}
4+
5+import Expect
36import Html
47import Internal.Flag as Flag
58import Internal.Style
9+import Test
10+
11+
12+suite =
13+ Test.describe "Classname Collisions"
14+ [ Test.test "No duplicates" <|
15+ \_ ->
16+ Expect.equal [] onlyDuplicates
17+ ]
618
719
820main =
tests/suite/Flags.elm+20−33
@@ -1,49 +1,36 @@
1−module Main exposing (allFlags, doesntInvalidateOthers, invalidateSelf, main)
1+module Flags exposing (suite)
22
3+{-| -}
4+
5+import Expect
36import Html
47import Internal.Flag as Flag
8+import Test
59
610
7−main =
8− Html.div []
9− [ Html.text "Verify All Flags invalidate themselves"
10− , Html.div []
11− (List.indexedMap invalidateSelf allFlags)
12− , Html.text "Verify All Flags don't interfere with other flags"
13− , Html.div []
14− (List.indexedMap doesntInvalidateOthers allFlags)
11+suite =
12+ Test.describe "Flag Operations"
13+ [ Test.test "All Flags Invalidate Themselves" <|
14+ \_ ->
15+ Expect.equal True (List.all (\flag -> Flag.present flag (Flag.add flag Flag.none)) allFlags)
16+ , Test.test "All Flags don't interfere with each other" <|
17+ \_ ->
18+ Expect.equal True (List.all (doesntInvalidateOthers allFlags) allFlags)
1519 ]
1620
1721
18−invalidateSelf i flag =
19− if Flag.present flag (Flag.add flag Flag.none) then
20− Html.text ""
21−
22− else
23− Html.div [] [ Html.text (toString (Flag.value flag) ++ " at index " ++ toString i ++ " does not invalidate itself") ]
24−
25−
26−doesntInvalidateOthers i flag =
22+doesntInvalidateOthers others flag =
2723 let
2824 withFlag =
2925 Flag.none
3026 |> Flag.add flag
31−
32− passing =
33− List.all identity <|
34− List.indexedMap
35− (\j otherFlag ->
36− Flag.present otherFlag (Flag.add otherFlag withFlag)
37− )
38− allFlags
3927 in
40− if passing then
41− Html.text ""
42−
43− else
44− Html.div []
45− [ Html.text (toString (Flag.value flag) ++ " at index " ++ toString i ++ " invalidates other flags!")
46− ]
28+ List.all identity <|
29+ List.map
30+ (\otherFlag ->
31+ Flag.present otherFlag (Flag.add otherFlag withFlag)
32+ )
33+ others
4734
4835
4936allFlags =