Sha256: 1761dfb6c2c4d26405ae12eccf3c039933c4443f18423b429f61f218386d4cd0

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

require "rails_helper"

RSpec.describe GovukDesignSystem::InsetTextHelper, type: :helper do
  describe "#govukInsetText" do
    it "returns the correct HTML for the default example" do
      html = helper.govukInsetText({
        text: "It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application."
      })

      expect(html).to match_html(<<~HTML)
        <div class="govuk-inset-text">
          It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application.
        </div>
      HTML
    end

    it "returns the correct HTML for an example using html" do
      inset_html = <<~HTML.html_safe
        <p class="govuk-body-l govuk-!-margin-bottom-4">
          Creating a case starts from a product record page.
        </p>
        <p class="govuk-body">
          Find a product and create the case from there.
        </p>
        <details class="govuk-details" data-module="govuk-details">
          <summary class="govuk-details__summary">
            <span class="govuk-details__summary-text">
              How to create a case
            </span>
          </summary>
        </details>
      HTML

      html = helper.govukInsetText({
        classes: "govuk-!-margin-bottom-7",
        html: inset_html
      })

      expect(html).to match_html(<<~HTML)
        <div class="govuk-inset-text govuk-!-margin-bottom-7">
          <p class="govuk-body-l govuk-!-margin-bottom-4">
            Creating a case starts from a product record page.
          </p>
          <p class="govuk-body">
            Find a product and create the case from there.
          </p>
          <details class="govuk-details" data-module="govuk-details">
            <summary class="govuk-details__summary">
              <span class="govuk-details__summary-text">
                How to create a case
              </span>
            </summary>
          </details>
        </div>
      HTML
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
govuk-design-system-rails-0.10.3 spec/helpers/govuk_design_system/inset_text_helper_spec.rb
govuk-design-system-rails-0.10.2 spec/helpers/govuk_design_system/inset_text_helper_spec.rb
govuk-design-system-rails-0.10.1 spec/helpers/govuk_design_system/inset_text_helper_spec.rb