|
120 | 120 | @test haskey(app.callbacks, Symbol("my-div.children"))
|
121 | 121 | @test app.callbacks[Symbol("my-div.children")].func("value", " value2") == "value value2"
|
122 | 122 |
|
| 123 | +end |
| 124 | +@testset "callback! multi output same component id" begin |
| 125 | + app = dash() |
| 126 | + app.layout = html_div() do |
| 127 | + dcc_input(id = "input-one", |
| 128 | + placeholder = "text or number?") |
| 129 | + dcc_input(id = "input-two", |
| 130 | + placeholder = "") |
| 131 | + end |
| 132 | + callback!(app, Output("input-two","placeholder"), Output("input-two","type"), |
| 133 | + Input("input-one","value")) do val1 |
| 134 | + if val1 in ["text", "number"] |
| 135 | + return "$val1 ??", val1 |
| 136 | + end |
| 137 | + return "invalid", nothing |
| 138 | + end |
| 139 | + @test length(app.callbacks) == 1 |
| 140 | + @test haskey(app.callbacks, Symbol("..input-two.placeholder...input-two.type..")) |
| 141 | + @test app.callbacks[Symbol("..input-two.placeholder...input-two.type..")].func("text") == ("text ??", "text") |
| 142 | + @test Dash.process_callback_call(app, |
| 143 | + Symbol("..input-two.placeholder...input-two.type.."), |
| 144 | + [(id = "input-two", property = "placeholder"), |
| 145 | + (id = "input-two", property = "type")], |
| 146 | + [(value = "text",)], [])[:response] == Dict("input-two" => Dict(:type => "text", |
| 147 | + :placeholder => "text ??")) |
| 148 | + |
123 | 149 | end
|
124 | 150 | @testset "callback! checks" begin
|
125 | 151 |
|
|
0 commit comments