mirror of
https://github.com/Orasund/elm-ui-widgets.git
synced 2024-09-11 14:35:37 +03:00
Added Tests
This commit is contained in:
parent
1933b81b59
commit
777d29cf9f
13
elm.json
13
elm.json
@ -6,10 +6,10 @@
|
|||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"exposed-modules": [
|
"exposed-modules": [
|
||||||
"Widget",
|
"Widget",
|
||||||
"Widget.Style.Material",
|
"Widget.Material",
|
||||||
"Widget.Style.Material.Typography",
|
"Widget.Material.Typography",
|
||||||
"Widget.Style.Material.Color",
|
"Widget.Material.Color",
|
||||||
"Widget.Style.Customize",
|
"Widget.Customize",
|
||||||
"Widget.Layout",
|
"Widget.Layout",
|
||||||
"Widget.ScrollingNav",
|
"Widget.ScrollingNav",
|
||||||
"Widget.Snackbar",
|
"Widget.Snackbar",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"Orasund/elm-ui-framework": "1.6.1 <= v < 2.0.0",
|
"Orasund/elm-ui-framework": "1.6.1 <= v < 2.0.0",
|
||||||
"avh4/elm-color": "1.0.0 <= v < 2.0.0",
|
"avh4/elm-color": "1.0.0 <= v < 2.0.0",
|
||||||
"elm/browser": "1.0.2 <= v < 2.0.0",
|
"elm/browser": "1.0.2 <= v < 2.0.0",
|
||||||
"elm/core": "1.0.0 <= v < 2.0.0",
|
"elm/core": "1.0.2 <= v < 2.0.0",
|
||||||
"elm/html": "1.0.0 <= v < 2.0.0",
|
"elm/html": "1.0.0 <= v < 2.0.0",
|
||||||
"elm/svg": "1.0.1 <= v < 2.0.0",
|
"elm/svg": "1.0.1 <= v < 2.0.0",
|
||||||
"elm/time": "1.0.0 <= v < 2.0.0",
|
"elm/time": "1.0.0 <= v < 2.0.0",
|
||||||
@ -31,6 +31,7 @@
|
|||||||
"wernerdegroot/listzipper": "4.0.0 <= v < 5.0.0"
|
"wernerdegroot/listzipper": "4.0.0 <= v < 5.0.0"
|
||||||
},
|
},
|
||||||
"test-dependencies": {
|
"test-dependencies": {
|
||||||
"elm-explorations/test": "1.2.1 <= v < 2.0.0"
|
"elm-explorations/test": "1.2.1 <= v < 2.0.0",
|
||||||
|
"icidasset/elm-material-icons": "5.0.0 <= v < 6.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
4
example/tests/elm-verify-examples.json
Normal file
4
example/tests/elm-verify-examples.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"root": "../src",
|
||||||
|
"tests": []
|
||||||
|
}
|
174
src/Widget.elm
174
src/Widget.elm
@ -231,16 +231,20 @@ type alias TextButton msg =
|
|||||||
|
|
||||||
{-| A button containing only an icon, the text is used for screenreaders.
|
{-| A button containing only an icon, the text is used for screenreaders.
|
||||||
|
|
||||||
import Widget.Style.Material as Material
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Widget.Icon as Icon
|
||||||
|
|
||||||
type Msg
|
type Msg
|
||||||
= Like
|
= Like
|
||||||
|
|
||||||
iconButton (Material.iconButton Material.defaultPalette)
|
iconButton (Material.iconButton Material.defaultPalette)
|
||||||
{ text = Like
|
{ text = "Like"
|
||||||
, icon = MaterialIcons.hearth |> Icon.elmMaterialIcons Color
|
, icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color
|
||||||
, onPress = Just Like
|
, onPress = Just Like
|
||||||
}
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
iconButton :
|
iconButton :
|
||||||
@ -261,6 +265,19 @@ iconButton =
|
|||||||
|
|
||||||
|
|
||||||
{-| A button with just text and not icon.
|
{-| A button with just text and not icon.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Like
|
||||||
|
|
||||||
|
textButton (Material.textButton Material.defaultPalette)
|
||||||
|
{ text = "Like"
|
||||||
|
, onPress = Just Like
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
textButton :
|
textButton :
|
||||||
ButtonStyle msg
|
ButtonStyle msg
|
||||||
@ -283,6 +300,22 @@ textButton style { text, onPress } =
|
|||||||
|
|
||||||
|
|
||||||
{-| A button containing a text and an icon.
|
{-| A button containing a text and an icon.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Widget.Icon as Icon
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
|
||||||
|
button (Material.containedButton Material.defaultPalette)
|
||||||
|
{ text = "Submit"
|
||||||
|
, icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color
|
||||||
|
, onPress = Just Submit
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
button :
|
button :
|
||||||
ButtonStyle msg
|
ButtonStyle msg
|
||||||
@ -341,6 +374,20 @@ type alias Switch msg =
|
|||||||
|
|
||||||
|
|
||||||
{-| A boolean switch
|
{-| A boolean switch
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Activate
|
||||||
|
|
||||||
|
switch (Material.switch Material.defaultPalette)
|
||||||
|
{ description = "Activate Dark Mode"
|
||||||
|
, onPress = Just Activate
|
||||||
|
, active = False
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
switch :
|
switch :
|
||||||
SwitchStyle msg
|
SwitchStyle msg
|
||||||
@ -402,6 +449,32 @@ type alias MultiSelect msg =
|
|||||||
|
|
||||||
|
|
||||||
{-| A simple button that can be selected.
|
{-| A simple button that can be selected.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Element
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
{ selected = Just 1
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.select
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
selectButton :
|
selectButton :
|
||||||
ButtonStyle msg
|
ButtonStyle msg
|
||||||
@ -412,6 +485,32 @@ selectButton =
|
|||||||
|
|
||||||
|
|
||||||
{-| Selects one out of multiple options. This can be used for radio buttons or Menus.
|
{-| Selects one out of multiple options. This can be used for radio buttons or Menus.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Element
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
{ selected = Just 1
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.select
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
select :
|
select :
|
||||||
Select msg
|
Select msg
|
||||||
@ -421,6 +520,33 @@ select =
|
|||||||
|
|
||||||
|
|
||||||
{-| Selects multible options. This can be used for checkboxes.
|
{-| Selects multible options. This can be used for checkboxes.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Set
|
||||||
|
import Element
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
{ selected = [1,2] |> Set.fromList
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.multiSelect
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
multiSelect :
|
multiSelect :
|
||||||
MultiSelect msg
|
MultiSelect msg
|
||||||
@ -468,6 +594,22 @@ type alias Dialog msg =
|
|||||||
|
|
||||||
{-| A modal.
|
{-| A modal.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Element
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
| Close
|
||||||
|
|
||||||
|
Element.layout
|
||||||
|
(modal
|
||||||
|
{ onDismiss = Just Close
|
||||||
|
, content =
|
||||||
|
Element.text "Click outside this window to close it."
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
Technical Remark:
|
Technical Remark:
|
||||||
|
|
||||||
- To stop the screen from scrolling, set the height of the layout to the height of the screen.
|
- To stop the screen from scrolling, set the height of the layout to the height of the screen.
|
||||||
@ -479,6 +621,32 @@ modal =
|
|||||||
|
|
||||||
|
|
||||||
{-| A Dialog Window.
|
{-| A Dialog Window.
|
||||||
|
|
||||||
|
import Widget.Material as Material
|
||||||
|
import Element
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
| Close
|
||||||
|
|
||||||
|
Element.layout
|
||||||
|
(dialog (Material.alertDialog Material.defaultPalette)
|
||||||
|
{ title = Just "Accept"
|
||||||
|
, text = "Are you sure?"
|
||||||
|
, accept =
|
||||||
|
{ text = "Accept"
|
||||||
|
, onPress = Just Submit
|
||||||
|
}
|
||||||
|
|> Just
|
||||||
|
, dismiss =
|
||||||
|
{ text = "Cancel"
|
||||||
|
, onPress = Just Close
|
||||||
|
}
|
||||||
|
|> Just
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> always "Ignore this line" --> "Ignore this line"
|
||||||
|
|
||||||
-}
|
-}
|
||||||
dialog :
|
dialog :
|
||||||
DialogStyle msg
|
DialogStyle msg
|
||||||
|
37
tests/VerifyExamples/Widget/Button0.elm
Normal file
37
tests/VerifyExamples/Widget/Button0.elm
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
module VerifyExamples.Widget.Button0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Widget.Icon as Icon
|
||||||
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#button: \n\n button (Material.containedButton Material.defaultPalette)\n { text = \"Submit\"\n , icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color\n , onPress = Just Submit\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
button (Material.containedButton Material.defaultPalette)
|
||||||
|
{ text = "Submit"
|
||||||
|
, icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color
|
||||||
|
, onPress = Just Submit
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
47
tests/VerifyExamples/Widget/Dialog0.elm
Normal file
47
tests/VerifyExamples/Widget/Dialog0.elm
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
module VerifyExamples.Widget.Dialog0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Element
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
| Close
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#dialog: \n\n Element.layout\n (dialog (Material.alertDialog Material.defaultPalette)\n { title = Just \"Accept\"\n , text = \"Are you sure?\"\n , accept =\n { text = \"Accept\"\n , onPress = Just Submit\n }\n |> Just\n , dismiss =\n { text = \"Cancel\"\n , onPress = Just Close\n }\n |> Just\n }\n )\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
Element.layout
|
||||||
|
(dialog (Material.alertDialog Material.defaultPalette)
|
||||||
|
{ title = Just "Accept"
|
||||||
|
, text = "Are you sure?"
|
||||||
|
, accept =
|
||||||
|
{ text = "Accept"
|
||||||
|
, onPress = Just Submit
|
||||||
|
}
|
||||||
|
|> Just
|
||||||
|
, dismiss =
|
||||||
|
{ text = "Cancel"
|
||||||
|
, onPress = Just Close
|
||||||
|
}
|
||||||
|
|> Just
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
37
tests/VerifyExamples/Widget/IconButton0.elm
Normal file
37
tests/VerifyExamples/Widget/IconButton0.elm
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
module VerifyExamples.Widget.IconButton0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Widget.Icon as Icon
|
||||||
|
import Material.Icons.Types exposing (Coloring(..))
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Like
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#iconButton: \n\n iconButton (Material.iconButton Material.defaultPalette)\n { text = \"Like\"\n , icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color\n , onPress = Just Like\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
iconButton (Material.iconButton Material.defaultPalette)
|
||||||
|
{ text = "Like"
|
||||||
|
, icon = MaterialIcons.favorite |> Icon.elmMaterialIcons Color
|
||||||
|
, onPress = Just Like
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
38
tests/VerifyExamples/Widget/Modal0.elm
Normal file
38
tests/VerifyExamples/Widget/Modal0.elm
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
module VerifyExamples.Widget.Modal0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Element
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Submit
|
||||||
|
| Close
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#modal: \n\n Element.layout\n (modal\n { onDismiss = Just Close\n , content =\n Element.text \"Click outside this window to close it.\"\n }\n )\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
Element.layout
|
||||||
|
(modal
|
||||||
|
{ onDismiss = Just Close
|
||||||
|
, content =
|
||||||
|
Element.text "Click outside this window to close it."
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
48
tests/VerifyExamples/Widget/MultiSelect0.elm
Normal file
48
tests/VerifyExamples/Widget/MultiSelect0.elm
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
module VerifyExamples.Widget.MultiSelect0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Element
|
||||||
|
import Set
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#multiSelect: \n\n { selected = [1,2] |> Set.fromList\n , options =\n [ 1, 2, 42 ]\n |> List.map\n (\\int ->\n { text = String.fromInt int\n , icon = always Element.none\n }\n )\n , onSelect = (\\i -> Just <| ChangedSelected i)\n }\n |> Widget.multiSelect\n |> Widget.buttonRow\n { elementRow = Material.buttonRow\n , content = Material.toggleButton Material.defaultPalette\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
{ selected = [1,2] |> Set.fromList
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.multiSelect
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
47
tests/VerifyExamples/Widget/Select0.elm
Normal file
47
tests/VerifyExamples/Widget/Select0.elm
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
module VerifyExamples.Widget.Select0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Element
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#select: \n\n { selected = Just 1\n , options =\n [ 1, 2, 42 ]\n |> List.map\n (\\int ->\n { text = String.fromInt int\n , icon = always Element.none\n }\n )\n , onSelect = (\\i -> Just <| ChangedSelected i)\n }\n |> Widget.select\n |> Widget.buttonRow\n { elementRow = Material.buttonRow\n , content = Material.toggleButton Material.defaultPalette\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
{ selected = Just 1
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.select
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
47
tests/VerifyExamples/Widget/SelectButton0.elm
Normal file
47
tests/VerifyExamples/Widget/SelectButton0.elm
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
module VerifyExamples.Widget.SelectButton0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Element
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= ChangedSelected Int
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#selectButton: \n\n { selected = Just 1\n , options =\n [ 1, 2, 42 ]\n |> List.map\n (\\int ->\n { text = String.fromInt int\n , icon = always Element.none\n }\n )\n , onSelect = (\\i -> Just <| ChangedSelected i)\n }\n |> Widget.select\n |> Widget.buttonRow\n { elementRow = Material.buttonRow\n , content = Material.toggleButton Material.defaultPalette\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
{ selected = Just 1
|
||||||
|
, options =
|
||||||
|
[ 1, 2, 42 ]
|
||||||
|
|> List.map
|
||||||
|
(\int ->
|
||||||
|
{ text = String.fromInt int
|
||||||
|
, icon = always Element.none
|
||||||
|
}
|
||||||
|
)
|
||||||
|
, onSelect = (\i -> Just <| ChangedSelected i)
|
||||||
|
}
|
||||||
|
|> Widget.select
|
||||||
|
|> Widget.buttonRow
|
||||||
|
{ elementRow = Material.buttonRow
|
||||||
|
, content = Material.toggleButton Material.defaultPalette
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
35
tests/VerifyExamples/Widget/Switch0.elm
Normal file
35
tests/VerifyExamples/Widget/Switch0.elm
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
module VerifyExamples.Widget.Switch0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Activate
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#switch: \n\n switch (Material.switch Material.defaultPalette)\n { description = \"Activate Dark Mode\"\n , onPress = Just Activate\n , active = False\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
switch (Material.switch Material.defaultPalette)
|
||||||
|
{ description = "Activate Dark Mode"
|
||||||
|
, onPress = Just Activate
|
||||||
|
, active = False
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
34
tests/VerifyExamples/Widget/TextButton0.elm
Normal file
34
tests/VerifyExamples/Widget/TextButton0.elm
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
module VerifyExamples.Widget.TextButton0 exposing (..)
|
||||||
|
|
||||||
|
-- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).
|
||||||
|
-- Please don't modify this file by hand!
|
||||||
|
|
||||||
|
import Test
|
||||||
|
import Expect
|
||||||
|
|
||||||
|
import Widget exposing (..)
|
||||||
|
import Material.Icons as MaterialIcons
|
||||||
|
import Widget.Material as Material
|
||||||
|
|
||||||
|
type Msg
|
||||||
|
= Like
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
spec0 : Test.Test
|
||||||
|
spec0 =
|
||||||
|
Test.test "#textButton: \n\n textButton (Material.textButton Material.defaultPalette)\n { text = \"Like\"\n , onPress = Just Like\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
||||||
|
\() ->
|
||||||
|
Expect.equal
|
||||||
|
(
|
||||||
|
textButton (Material.textButton Material.defaultPalette)
|
||||||
|
{ text = "Like"
|
||||||
|
, onPress = Just Like
|
||||||
|
}
|
||||||
|
|> always "Ignore this line"
|
||||||
|
)
|
||||||
|
(
|
||||||
|
"Ignore this line"
|
||||||
|
)
|
@ -2,10 +2,10 @@
|
|||||||
"root": "../src",
|
"root": "../src",
|
||||||
"tests": [
|
"tests": [
|
||||||
"Widget",
|
"Widget",
|
||||||
"Widget.Style.Material",
|
"Widget.Material",
|
||||||
"Widget.Style.Material.Typography",
|
"Widget.Material.Typography",
|
||||||
"Widget.Style.Material.Color",
|
"Widget.Material.Color",
|
||||||
"Widget.Style.Customize",
|
"Widget.Customize",
|
||||||
"Widget.Layout",
|
"Widget.Layout",
|
||||||
"Widget.ScrollingNav",
|
"Widget.ScrollingNav",
|
||||||
"Widget.Snackbar",
|
"Widget.Snackbar",
|
||||||
|
Loading…
Reference in New Issue
Block a user