Sha256: 145bebe9d7735e5d0e4eab0409c0ffb8400f3c68c96151cfb5950bb3968dbbf7

Contents?: true

Size: 1.18 KB

Versions: 20

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require "spec_helper"

module Decidim
  module Admin
    describe AriaSelectedLinkToHelper do
      let(:options) { {} }
      subject do
        Nokogiri::HTML(
          helper.aria_selected_link_to("Text", "url", options)
        )
      end

      context "with options" do
        let(:options) { { class: "my_class" } }

        it "still uses the options hash" do
          expect(subject.css("a[class='my_class']")).not_to be_empty
        end
      end

      context "when it's ponting to the current path" do
        before do
          expect(helper)
            .to receive(:is_active_link?)
            .and_return true
        end

        it "adds the attribute with 'true' as value" do
          expect(subject.css("a[href='url'][aria-selected='true']")).not_to be_empty
        end
      end

      context "when it's ponting to the current path" do
        before do
          expect(helper)
            .to receive(:is_active_link?)
            .and_return false
        end

        it "adds the attribute with 'false' as value" do
          expect(subject.css("a[href='url'][aria-selected='false']")).not_to be_empty
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.7 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.6 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.5 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.4 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.3 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.2 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.1 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.6.0 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.5.1 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.5.0 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.4.4 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.4.3 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.4.2 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.4.1 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.4.0 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.3.2 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.3.1 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.3.0 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb
decidim-0.2.0 decidim-admin/spec/helpers/aria_selected_link_to_helper_spec.rb