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.
32 lines
949 B
32 lines
949 B
3 years ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe DetailsTableHelper do
|
||
|
describe "details html" do
|
||
3 years ago
|
let(:details) { details_html(attribute) }
|
||
3 years ago
|
|
||
|
context "when given a simple attribute" do
|
||
3 years ago
|
let(:attribute) { { name: "name", value: "Dummy org", editable: true } }
|
||
3 years ago
|
|
||
|
it "displays the string wrapped in a div" do
|
||
3 years ago
|
expect(details).to eq("<div>Dummy org</div>")
|
||
3 years ago
|
end
|
||
|
end
|
||
|
|
||
|
context "when given a bullet point list of attibutes" do
|
||
3 years ago
|
let(:list) { %w[Camden Westminster Bristol] }
|
||
3 years ago
|
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
|
||
3 years ago
|
expect(details).to eq("<ul class=\"govuk-list govuk-list--bullet\"><li>Camden</li>\n<br /><li>Westminster</li>\n<br /><li>Bristol</li></ul>")
|
||
3 years ago
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|