0001-revert-fields-display-page-with-single-comment-in-su.patch
tests/form_pages/test_all.py | ||
---|---|---|
1453 | 1453 |
type='page', |
1454 | 1454 |
condition={'type': 'python', 'value': 'form_var_toto == "foo"'}, |
1455 | 1455 |
), |
1456 |
fields.TitleField(id='6', label='title in second page', type='title', display_locations=[]),
|
|
1456 |
fields.TitleField(id='6', label='title in second page', type='title'), |
|
1457 | 1457 |
fields.StringField(id='3', label='string'), |
1458 | 1458 |
fields.PageField(id='4', label='3rd page', type='page'), |
1459 | 1459 |
fields.StringField(id='5', label='string'), |
... | ... | |
1509 | 1509 |
assert '<h3>3rd page</h3>' in resp.text |
1510 | 1510 |
assert '<h3>4th page</h3>' not in resp.text |
1511 | 1511 | |
1512 |
formdef.fields[8].display_locations = ['summary'] |
|
1513 |
formdef.store() |
|
1514 |
resp = app.get('/test/') # -> 1st page |
|
1515 |
resp.form['f1'] = 'foo' |
|
1516 |
resp = resp.form.submit('submit') # -> 2nd page |
|
1517 |
resp.form['f3'] = 'bar' |
|
1518 |
resp = resp.form.submit('submit') # -> 3rd page |
|
1519 |
resp.form['f5'] = 'baz' |
|
1520 |
resp = resp.form.submit('submit') # -> 4th page |
|
1521 |
resp = resp.form.submit('submit') # -> validation |
|
1522 |
resp = resp.form.submit('submit') |
|
1523 |
resp = resp.follow() # -> submit |
|
1524 |
assert '<h3>1st page</h3>' in resp.text |
|
1525 |
assert '<h3>2nd page</h3>' in resp.text |
|
1526 |
assert '<h3>3rd page</h3>' in resp.text |
|
1527 |
assert '<h3>4th page</h3>' in resp.text |
|
1528 | ||
1529 | 1512 | |
1530 | 1513 |
def test_form_display_locations(pub): |
1531 | 1514 |
formdef = create_formdef() |
wcs/formdata.py | ||
---|---|---|
1342 | 1342 |
# ignore empty pages |
1343 | 1343 |
fields_and_details = [] |
1344 | 1344 |
for page in pages: |
1345 |
if not any( |
|
1346 |
bool(x['field'].type in ('title', 'subtitle', 'comment') or 'value' in x) |
|
1347 |
for x in page['fields'] |
|
1348 |
): |
|
1345 |
if not any(bool('value' in x) for x in page['fields']): |
|
1349 | 1346 |
continue |
1350 | 1347 |
fields_and_details.append(page) |
1351 | 1348 |
fields_and_details.extend([x for x in page['fields']]) |
1352 |
- |