|
139 | 139 | end
|
140 | 140 | end
|
141 | 141 |
|
142 |
| - describe "custom meta_licence text" do |
143 |
| - let(:licence_text) { "Permission is hereby granted, free of charge, to any person obtaining a copy of this software" } |
144 |
| - let(:kwargs) { { meta_licence: licence_text } } |
| 142 | + describe "custom licence content" do |
145 | 143 | let(:licence_selector) { [selector, ".govuk-footer__licence-description"].join(" ") }
|
146 | 144 |
|
147 |
| - specify "the custom licence text should be rendered" do |
148 |
| - expect(rendered_content).to have_tag(licence_selector, text: licence_text) |
| 145 | + describe "meta_licence" do |
| 146 | + let(:licence_text) { "Permission is hereby granted, free of charge, to any person obtaining a copy of this software" } |
| 147 | + let(:kwargs) { { meta_licence: licence_text } } |
| 148 | + |
| 149 | + specify "the custom licence text should be rendered" do |
| 150 | + expect(rendered_content).to have_tag(licence_selector, text: licence_text) |
| 151 | + end |
| 152 | + |
| 153 | + specify "the licence SVG is not rendered" do |
| 154 | + expect(rendered_content).to have_tag("footer", with: { class: "govuk-footer" }) do |
| 155 | + with_tag("div", with: { class: "govuk-footer__meta" }) do |
| 156 | + without_tag("svg") |
| 157 | + end |
| 158 | + end |
| 159 | + end |
149 | 160 | end
|
150 | 161 |
|
151 |
| - specify "the licence SVG is not rendered" do |
152 |
| - expect(rendered_content).to have_tag("footer", with: { class: "govuk-footer" }) do |
153 |
| - with_tag("div", with: { class: "govuk-footer__meta" }) do |
154 |
| - without_tag("svg") |
| 162 | + describe "meta_licence_html" do |
| 163 | + let(:custom_text) { "Some licence HTML" } |
| 164 | + let(:custom_tag) { "strong" } |
| 165 | + let(:custom_html) { helper.content_tag(custom_tag, custom_text) } |
| 166 | + |
| 167 | + subject! do |
| 168 | + render_inline(GovukComponent::FooterComponent.new(**kwargs)) do |component| |
| 169 | + component.with_meta_licence_html { custom_html } |
| 170 | + end |
| 171 | + end |
| 172 | + |
| 173 | + specify "the custom licence custom HTML is rendered" do |
| 174 | + expect(rendered_content).to have_tag(licence_selector) do |
| 175 | + with_tag(custom_tag, text: Regexp.new(custom_text)) |
| 176 | + end |
| 177 | + end |
| 178 | + |
| 179 | + specify "the licence SVG is not rendered" do |
| 180 | + expect(rendered_content).to have_tag("footer", with: { class: "govuk-footer" }) do |
| 181 | + with_tag("div", with: { class: "govuk-footer__meta" }) do |
| 182 | + without_tag("svg") |
| 183 | + end |
155 | 184 | end
|
156 | 185 | end
|
157 | 186 | end
|
|
0 commit comments