From ead40d246a0d7a1bcc9c16382a67f4f64bcbf88a Mon Sep 17 00:00:00 2001 From: djsegal Date: Wed, 15 Aug 2018 21:48:02 -0400 Subject: [PATCH 1/2] Change to use first element as default for toggles --- src/optioninput.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/optioninput.jl b/src/optioninput.jl index cfab6e5..44c1c66 100644 --- a/src/optioninput.jl +++ b/src/optioninput.jl @@ -315,7 +315,7 @@ for (wdg, tag, singlewdg, div, process) in zip([:togglebuttons, :tabs], [:button label = nothing, readout = false, vskip = 1em, kwargs...) vals2idxs = map(Vals2Idxs, options) - p = initvalueindex(value, index, vals2idxs; default = medianelement(vals2idxs[])) + p = initvalueindex(value, index, vals2idxs; default = first(vals2idxs[])) value, index = p.first, p.second className = mergeclasses(getclass($(Expr(:quote, singlewdg))), className) From 5d1db3124c573d78f5675b695f64635dc441660f Mon Sep 17 00:00:00 2001 From: djsegal Date: Sun, 19 Aug 2018 02:19:23 -0400 Subject: [PATCH 2/2] Fix tests that focused on init element selection --- test/test_observables.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_observables.jl b/test/test_observables.jl index fcf19cd..bfe66e8 100644 --- a/test/test_observables.jl +++ b/test/test_observables.jl @@ -145,9 +145,9 @@ end a = togglebuttons(["a", "b", "c"]) @test widgettype(a) == :togglebuttons - @test observe(a)[] == "b" + @test observe(a)[] == "a" a = togglebuttons(OrderedDict("a" => 1, "b" => 2, "c"=>3)) - @test observe(a)[] == 2 + @test observe(a)[] == 1 a = togglebuttons(OrderedDict("a" => 1, "b" => 2, "c" => 4), value = 4) @test observe(a)[] == 4