Skip to content

Commit 5fa4d55

Browse files
committed
more "random" new column name
1 parent 09b9393 commit 5fa4d55

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

tests/integration/renderer/test_persistence.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ def report_props(columns, hidden_columns):
5050

5151
return app
5252

53+
NEW_NAME = 'mango'
5354

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):
5557
dash_duo.find_element(
5658
'.dash-header.column-{} .column-header--edit'.format(rename)
5759
).click()
@@ -86,13 +88,13 @@ def test_rdps001_local_reload(dash_duo):
8688

8789
rename_and_hide(dash_duo)
8890
# 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])
9193

9294
dash_duo.wait_for_page()
9395
# 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])
9698

9799
# new persistence reverts
98100
app.persistence.value = 2
@@ -105,15 +107,15 @@ def test_rdps001_local_reload(dash_duo):
105107
# put back the old persistence, get the old values
106108
app.persistence.value = 1
107109
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])
110112

111113
# falsy persistence disables it
112114
app.persistence.value = 0
113115
dash_duo.wait_for_page()
114116
check_table_names(dash_duo, ['a', 'b'])
115117
rename_and_hide(dash_duo)
116-
check_table_names(dash_duo, ['x'])
118+
check_table_names(dash_duo, [NEW_NAME])
117119
dash_duo.wait_for_page()
118120
check_table_names(dash_duo, ['a', 'b'])
119121

@@ -129,20 +131,20 @@ def test_rdps002_session_reload(dash_duo):
129131
dash_duo.start_server(app)
130132
check_table_names(dash_duo, ['a', 'b'])
131133
rename_and_hide(dash_duo)
132-
check_table_names(dash_duo, ['x'])
134+
check_table_names(dash_duo, [NEW_NAME])
133135

134136
dash_duo.wait_for_page()
135137
# 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])
138140

139141

140142
def test_rdps003_memory_reload(dash_duo):
141143
app = reloadable_app(persistence_type='memory')
142144
dash_duo.start_server(app)
143145
check_table_names(dash_duo, ['a', 'b'])
144146
rename_and_hide(dash_duo)
145-
check_table_names(dash_duo, ['x'])
147+
check_table_names(dash_duo, [NEW_NAME])
146148

147149
dash_duo.wait_for_page()
148150
# no persistence after reload with persistence_type=memory
@@ -172,15 +174,15 @@ def toggle_table(n):
172174
check_table_names(dash_duo, ['a', 'b'])
173175

174176
rename_and_hide(dash_duo)
175-
check_table_names(dash_duo, ['x'])
177+
check_table_names(dash_duo, [NEW_NAME])
176178

177179
dash_duo.find_element('#toggle-table').click()
178180
# table is gone
179181
dash_duo.wait_for_text_to_equal('#container', 'nope')
180182

181183
dash_duo.find_element('#toggle-table').click()
182184
# table is back, with persisted props
183-
check_table_names(dash_duo, ['x'])
185+
check_table_names(dash_duo, [NEW_NAME])
184186

185187
dash_duo.find_element('#toggle-table').click()
186188
# gone again
@@ -211,15 +213,15 @@ def toggle_table(n):
211213
check_table_names(dash_duo, ['a', 'b'])
212214

213215
rename_and_hide(dash_duo)
214-
check_table_names(dash_duo, ['x'])
216+
check_table_names(dash_duo, [NEW_NAME])
215217

216218
dash_duo.find_element('#toggle-table').click()
217219
# hidden_columns not persisted
218-
check_table_names(dash_duo, ['x', 'b'])
220+
check_table_names(dash_duo, [NEW_NAME, 'b'])
219221

220222
dash_duo.find_element('#toggle-table').click()
221223
# back to original persisted_props hidden_columns returns
222-
check_table_names(dash_duo, ['x'])
224+
check_table_names(dash_duo, [NEW_NAME])
223225

224226

225227
def test_rdps006_move_on_page(dash_duo):
@@ -251,12 +253,12 @@ def find_last_div(n):
251253
check_table_names(dash_duo, ['a', 'b'])
252254

253255
rename_and_hide(dash_duo)
254-
check_table_names(dash_duo, ['x'])
256+
check_table_names(dash_duo, [NEW_NAME])
255257

256258
for i in range(1, 5):
257259
dash_duo.find_element('#move-table').click()
258260
find_last_div(i)
259-
check_table_names(dash_duo, ['x'])
261+
check_table_names(dash_duo, [NEW_NAME])
260262

261263

262264
def test_rdps007_one_prop_changed(dash_duo):
@@ -277,15 +279,15 @@ def hide_cols(n):
277279
check_table_names(dash_duo, ['a', 'b'])
278280

279281
rename_and_hide(dash_duo)
280-
check_table_names(dash_duo, ['x'])
282+
check_table_names(dash_duo, [NEW_NAME])
281283

282284
dash_duo.find_element('#hide-cols').click()
283285
# hidden_columns gets the new value
284286
check_table_names(dash_duo, ['b'])
285287

286288
dash_duo.find_element('#hide-cols').click()
287289
# 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'])
289291

290292

291293
def test_rdps008_unsaved_part_changed(dash_duo):
@@ -310,17 +312,17 @@ def toggle_deletable(n):
310312
check_table_names(dash_duo, ['a', 'b'])
311313

312314
rename_and_hide(dash_duo)
313-
check_table_names(dash_duo, ['x'])
315+
check_table_names(dash_duo, [NEW_NAME])
314316
assert len(dash_duo.find_elements('.column-header--delete')) == 0
315317

316318
dash_duo.find_element('#deletable').click()
317319
# column names still persisted when columns.deletable changed
318320
# because extracted name list didn't change
319-
check_table_names(dash_duo, ['x'])
321+
check_table_names(dash_duo, [NEW_NAME])
320322
assert len(dash_duo.find_elements('.column-header--delete')) == 1
321323

322324
dash_duo.find_element('#deletable').click()
323-
check_table_names(dash_duo, ['x'])
325+
check_table_names(dash_duo, [NEW_NAME])
324326
assert len(dash_duo.find_elements('.column-header--delete')) == 0
325327

326328

@@ -346,7 +348,7 @@ def reset_names(n):
346348
check_table_names(dash_duo, ['a', 'b'])
347349

348350
rename_and_hide(dash_duo)
349-
check_table_names(dash_duo, ['x'])
351+
check_table_names(dash_duo, [NEW_NAME])
350352

351353
dash_duo.find_element('#reset-names').click()
352354
# names are reset, but not hidden_columns

0 commit comments

Comments
 (0)