@@ -29,7 +29,7 @@ def test_clol001_clientside_outputs_list_by_single_output(dash_duo):
29
29
trigger_clicker .click ()
30
30
dash_duo .wait_for_text_to_equal (
31
31
"#output-demo" ,
32
- '[ {"id":"output-demo","property":"children"}] ' ,
32
+ '{"id":"output-demo","property":"children"}' ,
33
33
)
34
34
35
35
@@ -128,130 +128,3 @@ def test_clol004_clientside_outputs_list_by_no_output(dash_duo):
128
128
"#output-demo" ,
129
129
"" ,
130
130
)
131
-
132
-
133
- def test_clo001_clientside_outputs_by_single_output (dash_duo ):
134
- app = Dash (__name__ )
135
- app .layout = html .Div (
136
- [html .Button ("trigger" , id = "trigger-demo" ), html .Pre (id = "output-demo" )],
137
- style = {"padding" : 50 },
138
- )
139
-
140
- clientside_callback (
141
- """(n_clicks) => {
142
- return window.dash_clientside.callback_context.outputs;
143
- }""" ,
144
- Output ("output-demo" , "children" ),
145
- Input ("trigger-demo" , "n_clicks" ),
146
- prevent_initial_call = True ,
147
- )
148
-
149
- dash_duo .start_server (app )
150
-
151
- trigger_clicker = dash_duo .wait_for_element ("#trigger-demo" )
152
- trigger_clicker .click ()
153
- dash_duo .wait_for_text_to_equal (
154
- "#output-demo" ,
155
- "output-demo.children" ,
156
- )
157
-
158
-
159
- def test_clo002_clientside_outputs_by_multiple_output1 (dash_duo ):
160
- app = Dash (__name__ )
161
- app .layout = html .Div (
162
- [
163
- html .Button ("trigger" , id = "trigger-demo" ),
164
- html .Pre (id = "output-demo1" ),
165
- html .Pre (id = "output-demo2" ),
166
- ],
167
- style = {"padding" : 50 },
168
- )
169
-
170
- clientside_callback (
171
- """(n_clicks) => {
172
- return [window.dash_clientside.callback_context.outputs, window.dash_clientside.callback_context.outputs];
173
- }""" ,
174
- [Output ("output-demo1" , "children" ), Output ("output-demo2" , "children" )],
175
- Input ("trigger-demo" , "n_clicks" ),
176
- prevent_initial_call = True ,
177
- )
178
-
179
- dash_duo .start_server (app )
180
-
181
- dash_duo .find_element ("#trigger-demo" ).click ()
182
- dash_duo .wait_for_text_to_equal (
183
- "#output-demo1" ,
184
- "..output-demo1.children...output-demo2.children.." ,
185
- )
186
- dash_duo .wait_for_text_to_equal (
187
- "#output-demo2" ,
188
- "..output-demo1.children...output-demo2.children.." ,
189
- )
190
-
191
-
192
- def test_clo003_clientside_outputs_by_multiple_output2 (dash_duo ):
193
- app = Dash (__name__ )
194
- app .layout = html .Div (
195
- [
196
- html .Button ("trigger1" , id = "trigger-demo1" ),
197
- html .Button ("trigger2" , id = "trigger-demo2" ),
198
- html .Pre (id = "output-demo1" ),
199
- html .Pre (id = "output-demo2" ),
200
- ],
201
- style = {"padding" : 50 },
202
- )
203
-
204
- clientside_callback (
205
- """(n_clicks1, n_clicks2) => {
206
- if (window.dash_clientside.callback_context.triggered_id === 'trigger-demo1') {
207
- return [window.dash_clientside.callback_context.outputs, window.dash_clientside.no_update];
208
- } else if (window.dash_clientside.callback_context.triggered_id === 'trigger-demo2') {
209
- return [window.dash_clientside.no_update, window.dash_clientside.callback_context.outputs];
210
- }
211
- return [window.dash_clientside.no_update, window.dash_clientside.no_update];
212
- }""" ,
213
- [Output ("output-demo1" , "children" ), Output ("output-demo2" , "children" )],
214
- [Input ("trigger-demo1" , "n_clicks" ), Input ("trigger-demo2" , "n_clicks" )],
215
- prevent_initial_call = True ,
216
- )
217
-
218
- dash_duo .start_server (app )
219
-
220
- dash_duo .find_element ("#trigger-demo1" ).click ()
221
- dash_duo .wait_for_text_to_equal (
222
- "#output-demo1" ,
223
- "..output-demo1.children...output-demo2.children.." ,
224
- )
225
- dash_duo .find_element ("#trigger-demo2" ).click ()
226
- dash_duo .wait_for_text_to_equal (
227
- "#output-demo2" ,
228
- "..output-demo1.children...output-demo2.children.." ,
229
- )
230
-
231
-
232
- def test_clo004_clientside_outputs_by_no_output (dash_duo ):
233
- app = Dash (__name__ )
234
- app .layout = html .Div (
235
- [html .Button ("trigger" , id = "trigger-demo" ), html .Pre (id = "output-demo" )],
236
- style = {"padding" : 50 },
237
- )
238
-
239
- clientside_callback (
240
- """(n_clicks) => {
241
- if (window.dash_clientside.callback_context.outputs) {
242
- window.dash_clientside.set_props('output-demo', {'children': 'success-outputs'});
243
- } else {
244
- window.dash_clientside.set_props('output-demo', {'children': 'error-outputs'});
245
- }
246
- }""" ,
247
- Input ("trigger-demo" , "n_clicks" ),
248
- prevent_initial_call = True ,
249
- )
250
-
251
- dash_duo .start_server (app )
252
-
253
- dash_duo .find_element ("#trigger-demo" ).click ()
254
- dash_duo .wait_for_text_to_equal (
255
- "#output-demo" ,
256
- "success-outputs" ,
257
- )
0 commit comments