Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

require "rails_helper"
RSpec.describe DetailsTableHelper do
describe "details html" do
3 years ago
let(:details) { details_html(attribute) }
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
let(:current_user) { FactoryBot.build(:user) }
context "when given a simple attribute" do
3 years ago
let(:attribute) { { name: "name", value: "Dummy org", editable: true } }
it "displays the string wrapped in a p" do
expect(details).to eq("<p class=\"govuk-body\">Dummy org</p>")
end
end
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
context "when given a bullet point list of attributes" do
3 years ago
let(:list) { %w[Camden Westminster Bristol] }
let(:attribute) do
{
name: "local_authorities_operated_in",
value: list,
editable: false,
format: :bullet,
}
end
it "displays the string wrapped in an unordered list with the correct classes" do
expect(details).to eq("<ul class=\"govuk-list govuk-list--bullet\"><li>Camden</li><li>Westminster</li><li>Bristol</li></ul>")
end
end
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
context "when given a bullet point list with one attribute" do
let(:list) { %w[Camden] }
let(:attribute) do
{
name: "local_authorities_operated_in",
value: list,
editable: false,
format: :bullet,
}
end
it "displays the string wrapped in a p" do
expect(details).to eq("<p class=\"govuk-body\">Camden</p>")
end
end
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
context "when given an attribute value is empty" do
let(:attribute) { { value: "" } }
it "displays the default message" do
expect(details_html(attribute)).to include("No answer provided")
end
end
context "when given an attribute value is not empty" do
let(:attribute) { { value: "Dummy text" } }
it "displays the default message" do
expect(details_html(attribute)).to include("Dummy text")
end
end
end
end