module InputTable.UpdateTest exposing (all) import Expect import Test exposing (Test, test, describe) import InputTable.Messages exposing (..) import InputTable.Model exposing (..) import InputTable.Update exposing (update) import InputTable.TestData exposing (tableState, columnSubdropdown) import List.Extra all : Test all = describe "Update.update" [ test "ToggleCellDropdown should set the focussedRowId on a column to the passed rowI and the focussedOption to Nothing" <| \() -> Expect.equal ((update (ToggleCellDropdown "3" "5") tableState) |> Tuple.first |> .columns |> List.Extra.find (.id >> (==) "5") |> Maybe.map (\c -> case c.subType of SubDropdownColumn props -> ( props.focussedRowId, props.focussedOption ) _ -> ( Nothing, Nothing ) ) ) (Just ( Just "3", Nothing )) ]