Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/serializers/accessibility_error_entity_spec.rb')
-rw-r--r--spec/serializers/accessibility_error_entity_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/serializers/accessibility_error_entity_spec.rb b/spec/serializers/accessibility_error_entity_spec.rb
new file mode 100644
index 00000000000..e9bfabb7aa8
--- /dev/null
+++ b/spec/serializers/accessibility_error_entity_spec.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe AccessibilityErrorEntity do
+ let(:entity) { described_class.new(accessibility_error) }
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ context 'when accessibility contains an error' do
+ let(:accessibility_error) do
+ {
+ code: "WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoContent",
+ type: "error",
+ typeCode: 1,
+ message: "Anchor element found with a valid href attribute, but no link content has been supplied.",
+ context: "<a href=\"/\" class=\"navbar-brand animated\"><svg height=\"36\" viewBox=\"0 0 1...</a>",
+ selector: "#main-nav > div:nth-child(1) > a",
+ runner: "htmlcs",
+ runnerExtras: {}
+ }
+ end
+
+ it 'contains correct accessibility error details', :aggregate_failures do
+ expect(subject[:code]).to eq("WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.NoContent")
+ expect(subject[:type]).to eq("error")
+ expect(subject[:type_code]).to eq(1)
+ expect(subject[:message]).to eq("Anchor element found with a valid href attribute, but no link content has been supplied.")
+ expect(subject[:context]).to eq("<a href=\"/\" class=\"navbar-brand animated\"><svg height=\"36\" viewBox=\"0 0 1...</a>")
+ expect(subject[:selector]).to eq("#main-nav > div:nth-child(1) > a")
+ expect(subject[:runner]).to eq("htmlcs")
+ expect(subject[:runner_extras]).to be_empty
+ end
+ end
+ end
+end