mirror of
https://github.com/Orasund/elm-ui-widgets.git
synced 2024-11-22 13:14:10 +03:00
71 lines
3.8 KiB
Elm
71 lines
3.8 KiB
Elm
module VerifyExamples.Widget.SortTable0 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 =
|
|
ChangedSorting String
|
|
|
|
asc : Bool
|
|
asc =
|
|
True
|
|
sortBy : String
|
|
sortBy =
|
|
"Id"
|
|
|
|
|
|
|
|
spec0 : Test.Test
|
|
spec0 =
|
|
Test.test "#sortTable: \n\n Widget.sortTable (Material.sortTable Material.defaultPalette)\n { content =\n [ { id = 1, name = \"Antonio\", rating = 2.456, hash = Nothing }\n , { id = 2, name = \"Ana\", rating = 1.34, hash = Just \"45jf\" }\n , { id = 3, name = \"Alfred\", rating = 4.22, hash = Just \"6fs1\" }\n , { id = 4, name = \"Thomas\", rating = 3, hash = Just \"k52f\" }\n ]\n , columns =\n [ Widget.intColumn\n { title = \"Id\"\n , value = .id\n , toString = \\int -> \"#\" ++ String.fromInt int\n , width = Element.fill\n }\n , Widget.stringColumn\n { title = \"Name\"\n , value = .name\n , toString = identity\n , width = Element.fill\n }\n , Widget.floatColumn\n { title = \"Rating\"\n , value = .rating\n , toString = String.fromFloat\n , width = Element.fill\n }\n , Widget.unsortableColumn\n { title = \"Hash\"\n , toString = (\\{hash} -> hash |> Maybe.withDefault \"None\")\n , width = Element.fill\n }\n ]\n , asc = asc\n , sortBy = sortBy\n , onChange = ChangedSorting\n }\n |> always \"Ignore this line\"\n --> \"Ignore this line\"" <|
|
|
\() ->
|
|
Expect.equal
|
|
(
|
|
Widget.sortTable (Material.sortTable Material.defaultPalette)
|
|
{ content =
|
|
[ { id = 1, name = "Antonio", rating = 2.456, hash = Nothing }
|
|
, { id = 2, name = "Ana", rating = 1.34, hash = Just "45jf" }
|
|
, { id = 3, name = "Alfred", rating = 4.22, hash = Just "6fs1" }
|
|
, { id = 4, name = "Thomas", rating = 3, hash = Just "k52f" }
|
|
]
|
|
, columns =
|
|
[ Widget.intColumn
|
|
{ title = "Id"
|
|
, value = .id
|
|
, toString = \int -> "#" ++ String.fromInt int
|
|
, width = Element.fill
|
|
}
|
|
, Widget.stringColumn
|
|
{ title = "Name"
|
|
, value = .name
|
|
, toString = identity
|
|
, width = Element.fill
|
|
}
|
|
, Widget.floatColumn
|
|
{ title = "Rating"
|
|
, value = .rating
|
|
, toString = String.fromFloat
|
|
, width = Element.fill
|
|
}
|
|
, Widget.unsortableColumn
|
|
{ title = "Hash"
|
|
, toString = (\{hash} -> hash |> Maybe.withDefault "None")
|
|
, width = Element.fill
|
|
}
|
|
]
|
|
, asc = asc
|
|
, sortBy = sortBy
|
|
, onChange = ChangedSorting
|
|
}
|
|
|> always "Ignore this line"
|
|
)
|
|
(
|
|
"Ignore this line"
|
|
) |