Sha256: bea61ce47630d3f8c56fd21e63117784fcb58a02e2849b0cb18578de69c4a750

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require "rails_helper"

RSpec.describe GovukDesignSystem::ErrorSummaryHelper, type: :helper do
  describe "#govukErrorSummary" do
    it "returns the correct HTML for the default example" do
      html = helper.govukErrorSummary({
        titleText: "There is a problem",
        errorList: [
          {
            text: "The date your passport was issued must be in the past",
            href: "#passport-issued-day"
          },
          {
            text: "Enter a postcode, like AA1 1AA",
            href: "#postcode-input"
          }
        ]
      })

      expect(html).to match_html(<<~HTML)
        <div class="govuk-error-summary" aria-labelledby="error-summary-title" role="alert" data-module="govuk-error-summary">
          <h2 class="govuk-error-summary__title" id="error-summary-title">
            There is a problem
          </h2>
          <div class="govuk-error-summary__body">
            <ul class="govuk-list govuk-error-summary__list">
              <li>
                <a href="#passport-issued-day">The date your passport was issued must be in the past</a>
              </li>
              <li>
                <a href="#postcode-input">Enter a postcode, like AA1 1AA</a>
              </li>
            </ul>
          </div>
        </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/error_summary_helper_spec.rb
govuk-design-system-rails-0.10.2 spec/helpers/govuk_design_system/error_summary_helper_spec.rb
govuk-design-system-rails-0.10.1 spec/helpers/govuk_design_system/error_summary_helper_spec.rb