Show error across the whole row

Errors with messages being too long or empty aren’t specific to a single
cell of the uploaded spreadsheet, they’re the results of combining all
the cells with the template.

Previously we could only show errors against a specific cell. This
commit makes it possible to add a super-row which spans all the cells,
into which we can put errors.

The index (header) column then spans both these rows, to show that they
are both associated with the same row of input.

Depends on:
- [x] https://github.com/alphagov/notifications-utils/pull/719
This commit is contained in:
Chris Hill-Scott
2020-04-11 11:42:13 +01:00
parent f37137cdb3
commit e2d1401b54
3 changed files with 38 additions and 10 deletions

View File

@@ -486,8 +486,16 @@ def test_upload_csv_file_with_empty_message_shows_check_page_with_errors(
assert [
normalize_spaces(row.text) for row in page.select('tbody tr')
] == [
'3 +447700900986 no',
'3 No content for this message',
'+447700900986 no',
]
assert normalize_spaces(page.select_one('.table-field-index').text) == '3'
assert page.select_one('.table-field-index')['rowspan'] == '2'
assert normalize_spaces(page.select('tbody tr td')[0].text) == '3'
assert normalize_spaces(page.select('tbody tr td')[1].text) == (
'No content for this message'
)
assert page.select('tbody tr td')[1]['colspan'] == '2'
@pytest.mark.parametrize('file_contents, expected_error,', [