-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly display 'request accessible format' option
- attachments on publications should only show this option when 'accessible' is false and email address is supplied - including tests accordingly
- Loading branch information
1 parent
4e69bf9
commit 7c71da9
Showing
2 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,95 @@ class PublicationTest < ActionDispatch::IntegrationTest | |
end | ||
end | ||
|
||
test "renders accessible format option when accessible is false and email is supplied" do | ||
overrides = { | ||
"details" => { | ||
"attachments" => [{ | ||
"accessible" => false, | ||
"alternative_format_contact_email" => "[email protected]", | ||
"attachment_type" => "file", | ||
"id" => "PUBLIC_1392629965.pdf", | ||
"title" => "Number of ex-regular service personnel now part of FR20", | ||
"url" => "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/315163/PUBLIC_1392629965.pdf", | ||
"command_paper_number" => "", | ||
"hoc_paper_number" => "", | ||
"isbn" => "", | ||
"unique_reference" => "", | ||
"unnumbered_command_paper" => false, | ||
"unnumbered_hoc_paper" => false, | ||
"content_type" => "application/pdf", | ||
"file_size" => 932, | ||
"filename" => "PUBLIC_1392629965.pdf", | ||
"number_of_pages" => 2, | ||
"locale" => "en", | ||
}], | ||
}, | ||
} | ||
setup_and_visit_content_item("publication-with-featured-attachments", overrides) | ||
within "#documents" do | ||
assert page.has_text?("Request an accessible format") | ||
end | ||
end | ||
|
||
test "doesn't render accessible format option when accessible is false and email is not supplied" do | ||
overrides = { | ||
"details" => { | ||
"attachments" => [{ | ||
"accessible" => false, | ||
"attachment_type" => "file", | ||
"id" => "PUBLIC_1392629965.pdf", | ||
"title" => "Number of ex-regular service personnel now part of FR20", | ||
"url" => "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/315163/PUBLIC_1392629965.pdf", | ||
"command_paper_number" => "", | ||
"hoc_paper_number" => "", | ||
"isbn" => "", | ||
"unique_reference" => "", | ||
"unnumbered_command_paper" => false, | ||
"unnumbered_hoc_paper" => false, | ||
"content_type" => "application/pdf", | ||
"file_size" => 932, | ||
"filename" => "PUBLIC_1392629965.pdf", | ||
"number_of_pages" => 2, | ||
"locale" => "en", | ||
}], | ||
}, | ||
} | ||
setup_and_visit_content_item("publication-with-featured-attachments", overrides) | ||
within "#documents" do | ||
assert page.has_no_text?("Request an accessible format") | ||
end | ||
end | ||
|
||
test "doesn't render accessible format option when accessible is true and email is supplied" do | ||
overrides = { | ||
"details" => { | ||
"attachments" => [{ | ||
"accessible" => true, | ||
"alternative_format_contact_email" => "[email protected]", | ||
"attachment_type" => "file", | ||
"id" => "PUBLIC_1392629965.pdf", | ||
"title" => "Number of ex-regular service personnel now part of FR20", | ||
"url" => "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/315163/PUBLIC_1392629965.pdf", | ||
"command_paper_number" => "", | ||
"hoc_paper_number" => "", | ||
"isbn" => "", | ||
"unique_reference" => "", | ||
"unnumbered_command_paper" => false, | ||
"unnumbered_hoc_paper" => false, | ||
"content_type" => "application/pdf", | ||
"file_size" => 932, | ||
"filename" => "PUBLIC_1392629965.pdf", | ||
"number_of_pages" => 2, | ||
"locale" => "en", | ||
}], | ||
}, | ||
} | ||
setup_and_visit_content_item("publication-with-featured-attachments", overrides) | ||
within "#documents" do | ||
assert page.has_no_text?("Request an accessible format") | ||
end | ||
end | ||
|
||
test "withdrawn publication" do | ||
setup_and_visit_content_item("withdrawn_publication") | ||
assert page.has_css?("title", text: "[Withdrawn]", visible: false) | ||
|