@@ -50,8 +50,10 @@ def report_props(columns, hidden_columns):
50
50
51
51
return app
52
52
53
+ NEW_NAME = 'mango'
53
54
54
- def rename_and_hide (dash_duo , rename = 0 , new_name = 'x' , hide = 1 ):
55
+
56
+ def rename_and_hide (dash_duo , rename = 0 , new_name = NEW_NAME , hide = 1 ):
55
57
dash_duo .find_element (
56
58
'.dash-header.column-{} .column-header--edit' .format (rename )
57
59
).click ()
@@ -86,13 +88,13 @@ def test_rdps001_local_reload(dash_duo):
86
88
87
89
rename_and_hide (dash_duo )
88
90
# callback output
89
- dash_duo .wait_for_text_to_equal ('#out' , 'names: [x , b]; hidden: [c1]' )
90
- check_table_names (dash_duo , ['x' ])
91
+ dash_duo .wait_for_text_to_equal ('#out' , 'names: [{} , b]; hidden: [c1]' . format ( NEW_NAME ) )
92
+ check_table_names (dash_duo , [NEW_NAME ])
91
93
92
94
dash_duo .wait_for_page ()
93
95
# callback gets persisted values, not the values provided with the layout
94
- dash_duo .wait_for_text_to_equal ('#out' , 'names: [x , b]; hidden: [c1]' )
95
- check_table_names (dash_duo , ['x' ])
96
+ dash_duo .wait_for_text_to_equal ('#out' , 'names: [{} , b]; hidden: [c1]' . format ( NEW_NAME ) )
97
+ check_table_names (dash_duo , [NEW_NAME ])
96
98
97
99
# new persistence reverts
98
100
app .persistence .value = 2
@@ -105,15 +107,15 @@ def test_rdps001_local_reload(dash_duo):
105
107
# put back the old persistence, get the old values
106
108
app .persistence .value = 1
107
109
dash_duo .wait_for_page ()
108
- dash_duo .wait_for_text_to_equal ('#out' , 'names: [x , b]; hidden: [c1]' )
109
- check_table_names (dash_duo , ['x' ])
110
+ dash_duo .wait_for_text_to_equal ('#out' , 'names: [{} , b]; hidden: [c1]' . format ( NEW_NAME ) )
111
+ check_table_names (dash_duo , [NEW_NAME ])
110
112
111
113
# falsy persistence disables it
112
114
app .persistence .value = 0
113
115
dash_duo .wait_for_page ()
114
116
check_table_names (dash_duo , ['a' , 'b' ])
115
117
rename_and_hide (dash_duo )
116
- check_table_names (dash_duo , ['x' ])
118
+ check_table_names (dash_duo , [NEW_NAME ])
117
119
dash_duo .wait_for_page ()
118
120
check_table_names (dash_duo , ['a' , 'b' ])
119
121
@@ -129,20 +131,20 @@ def test_rdps002_session_reload(dash_duo):
129
131
dash_duo .start_server (app )
130
132
check_table_names (dash_duo , ['a' , 'b' ])
131
133
rename_and_hide (dash_duo )
132
- check_table_names (dash_duo , ['x' ])
134
+ check_table_names (dash_duo , [NEW_NAME ])
133
135
134
136
dash_duo .wait_for_page ()
135
137
# callback gets persisted values, not the values provided with the layout
136
- dash_duo .wait_for_text_to_equal ('#out' , 'names: [x , b]; hidden: [c1]' )
137
- check_table_names (dash_duo , ['x' ])
138
+ dash_duo .wait_for_text_to_equal ('#out' , 'names: [{} , b]; hidden: [c1]' . format ( NEW_NAME ) )
139
+ check_table_names (dash_duo , [NEW_NAME ])
138
140
139
141
140
142
def test_rdps003_memory_reload (dash_duo ):
141
143
app = reloadable_app (persistence_type = 'memory' )
142
144
dash_duo .start_server (app )
143
145
check_table_names (dash_duo , ['a' , 'b' ])
144
146
rename_and_hide (dash_duo )
145
- check_table_names (dash_duo , ['x' ])
147
+ check_table_names (dash_duo , [NEW_NAME ])
146
148
147
149
dash_duo .wait_for_page ()
148
150
# no persistence after reload with persistence_type=memory
@@ -172,15 +174,15 @@ def toggle_table(n):
172
174
check_table_names (dash_duo , ['a' , 'b' ])
173
175
174
176
rename_and_hide (dash_duo )
175
- check_table_names (dash_duo , ['x' ])
177
+ check_table_names (dash_duo , [NEW_NAME ])
176
178
177
179
dash_duo .find_element ('#toggle-table' ).click ()
178
180
# table is gone
179
181
dash_duo .wait_for_text_to_equal ('#container' , 'nope' )
180
182
181
183
dash_duo .find_element ('#toggle-table' ).click ()
182
184
# table is back, with persisted props
183
- check_table_names (dash_duo , ['x' ])
185
+ check_table_names (dash_duo , [NEW_NAME ])
184
186
185
187
dash_duo .find_element ('#toggle-table' ).click ()
186
188
# gone again
@@ -211,15 +213,15 @@ def toggle_table(n):
211
213
check_table_names (dash_duo , ['a' , 'b' ])
212
214
213
215
rename_and_hide (dash_duo )
214
- check_table_names (dash_duo , ['x' ])
216
+ check_table_names (dash_duo , [NEW_NAME ])
215
217
216
218
dash_duo .find_element ('#toggle-table' ).click ()
217
219
# hidden_columns not persisted
218
- check_table_names (dash_duo , ['x' , 'b' ])
220
+ check_table_names (dash_duo , [NEW_NAME , 'b' ])
219
221
220
222
dash_duo .find_element ('#toggle-table' ).click ()
221
223
# back to original persisted_props hidden_columns returns
222
- check_table_names (dash_duo , ['x' ])
224
+ check_table_names (dash_duo , [NEW_NAME ])
223
225
224
226
225
227
def test_rdps006_move_on_page (dash_duo ):
@@ -251,12 +253,12 @@ def find_last_div(n):
251
253
check_table_names (dash_duo , ['a' , 'b' ])
252
254
253
255
rename_and_hide (dash_duo )
254
- check_table_names (dash_duo , ['x' ])
256
+ check_table_names (dash_duo , [NEW_NAME ])
255
257
256
258
for i in range (1 , 5 ):
257
259
dash_duo .find_element ('#move-table' ).click ()
258
260
find_last_div (i )
259
- check_table_names (dash_duo , ['x' ])
261
+ check_table_names (dash_duo , [NEW_NAME ])
260
262
261
263
262
264
def test_rdps007_one_prop_changed (dash_duo ):
@@ -277,15 +279,15 @@ def hide_cols(n):
277
279
check_table_names (dash_duo , ['a' , 'b' ])
278
280
279
281
rename_and_hide (dash_duo )
280
- check_table_names (dash_duo , ['x' ])
282
+ check_table_names (dash_duo , [NEW_NAME ])
281
283
282
284
dash_duo .find_element ('#hide-cols' ).click ()
283
285
# hidden_columns gets the new value
284
286
check_table_names (dash_duo , ['b' ])
285
287
286
288
dash_duo .find_element ('#hide-cols' ).click ()
287
289
# back to original hidden_columns, but saved value won't come back
288
- check_table_names (dash_duo , ['x' , 'b' ])
290
+ check_table_names (dash_duo , [NEW_NAME , 'b' ])
289
291
290
292
291
293
def test_rdps008_unsaved_part_changed (dash_duo ):
@@ -310,17 +312,17 @@ def toggle_deletable(n):
310
312
check_table_names (dash_duo , ['a' , 'b' ])
311
313
312
314
rename_and_hide (dash_duo )
313
- check_table_names (dash_duo , ['x' ])
315
+ check_table_names (dash_duo , [NEW_NAME ])
314
316
assert len (dash_duo .find_elements ('.column-header--delete' )) == 0
315
317
316
318
dash_duo .find_element ('#deletable' ).click ()
317
319
# column names still persisted when columns.deletable changed
318
320
# because extracted name list didn't change
319
- check_table_names (dash_duo , ['x' ])
321
+ check_table_names (dash_duo , [NEW_NAME ])
320
322
assert len (dash_duo .find_elements ('.column-header--delete' )) == 1
321
323
322
324
dash_duo .find_element ('#deletable' ).click ()
323
- check_table_names (dash_duo , ['x' ])
325
+ check_table_names (dash_duo , [NEW_NAME ])
324
326
assert len (dash_duo .find_elements ('.column-header--delete' )) == 0
325
327
326
328
@@ -346,7 +348,7 @@ def reset_names(n):
346
348
check_table_names (dash_duo , ['a' , 'b' ])
347
349
348
350
rename_and_hide (dash_duo )
349
- check_table_names (dash_duo , ['x' ])
351
+ check_table_names (dash_duo , [NEW_NAME ])
350
352
351
353
dash_duo .find_element ('#reset-names' ).click ()
352
354
# names are reset, but not hidden_columns
0 commit comments