Skip to content

Commit

Permalink
Merge pull request #118 from bender2k14/#114_wrap_dispatch_in_bindings
Browse files Browse the repository at this point in the history
#114 wrap dispatch in bindings
  • Loading branch information
cmeeren authored Sep 15, 2019
2 parents f6efc5c + cecc480 commit 705b499
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 63 deletions.
4 changes: 2 additions & 2 deletions src/Elmish.WPF.Tests/BindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ module cmdIf =
let ``sets the correct binding name`` () =
Property.check <| property {
let! bindingName = GenX.auto<string>
let binding = bindingName |> Binding.cmdIf(fail, fail)
let binding = bindingName |> Binding.cmdIf(fail, fail, id)
test <@ binding.Name = bindingName @>
}

Expand Down Expand Up @@ -2476,7 +2476,7 @@ module cmdParamIf =
let ``final autoRequery equals original uiBoundCmdParam`` () =
Property.check <| property {
let! uiBoundCmdParam = GenX.auto<bool>
let d = Binding.cmdParamIf(fail, fail, uiBoundCmdParam = uiBoundCmdParam) |> getCmdParamData
let d = Binding.cmdParamIf(fail, fail, uiBoundCmdParam = uiBoundCmdParam, wrapDispatch = id) |> getCmdParamData
test <@ d.AutoRequery = uiBoundCmdParam @>
}

Expand Down
5 changes: 5 additions & 0 deletions src/Elmish.WPF.Tests/ViewModelTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ module Helpers =
name |> createBinding (TwoWayData {
Get = get >> box
Set = unbox<'a> >> set
WrapDispatch = id
})


Expand All @@ -227,6 +228,7 @@ module Helpers =
Get = get >> box
Set = unbox<'a> >> set
Validate = validate
WrapDispatch = id
})


Expand All @@ -237,6 +239,7 @@ module Helpers =
name |> createBinding (CmdData {
Exec = exec
CanExec = canExec
WrapDispatch = id
})


Expand All @@ -249,6 +252,7 @@ module Helpers =
Exec = unbox >> exec
CanExec = unbox >> canExec
AutoRequery = autoRequery
WrapDispatch = id
})


Expand Down Expand Up @@ -289,6 +293,7 @@ module Helpers =
Get = get >> ValueOption.map box
Set = ValueOption.map unbox<'id> >> set
SubModelSeqBindingName = subModelSeqBindingName
WrapDispatch = id
})


Expand Down
Loading

0 comments on commit 705b499

Please sign in to comment.