Sha256: 6e2d58fa123f98cf07b262042c8d73b6eb4025e427a9cef80d400a943322c576

Contents?: true

Size: 1.77 KB

Versions: 9

Compression:

Stored size: 1.77 KB

Contents

describe BatchEditsHelper, type: :helper do
  describe "#render_check_all" do
    subject { helper.render_check_all }
    before do
      view.lookup_context.prefixes = ['hyrax/my']
      allow(helper).to receive(:params).and_return(controller: controller_path)
    end

    context "with my works" do
      let(:controller_path) { "hyrax/my/works" }
      it "shows the check all dropdown" do
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_all")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_none")
      end
    end

    context "with my shares" do
      let(:controller_path) { "hyrax/my/shares" }
      it "shows the check all dropdown" do
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_all")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_none")
      end
    end

    context "with my highlights" do
      let(:controller_path) { "hyrax/my/highlights" }
      it "shows the check all dropdown" do
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_all")
        expect(subject).to have_content t("hyrax.dashboard.my.action.select_none")
      end
    end

    context "with my collections" do
      let(:controller_path) { "hyrax/my/collections" }
      it "does not show the check all dropdown" do
        expect(subject).to be_nil
      end
    end

    context "with select all disabled" do
      let(:controller_path) { "foo" }

      it "does not show the check all dropdown" do
        assign(:disable_select_all, true)
        expect(subject).to have_css("input[disabled=disabled]")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyrax-1.1.1 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.1.0 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.5 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.4 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.3 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.2 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.1 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.0.rc2 spec/helpers/batch_edits_helper_spec.rb
hyrax-1.0.0.rc1 spec/helpers/batch_edits_helper_spec.rb