Sha256: 8fdab5cb6c88f5c131ae5019b1f0c5348ae65fbe4efd3bfd2677ec666f67840f

Contents?: true

Size: 1.84 KB

Versions: 6

Compression:

Stored size: 1.84 KB

Contents

describe BatchEditsHelper, type: :helper do
  describe "#render_check_all" do
    subject { helper.render_check_all }
    before do
      view.lookup_context.prefixes = ['my']
    end

    context "with my works" do
      it "shows the check all dropdown" do
        allow(controller).to receive(:params).and_return(controller: "my/works")
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_all")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_none")
      end
    end

    context "with my shares" do
      it "shows the check all dropdown" do
        allow(controller).to receive(:params).and_return(controller: "my/shares")
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_all")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_none")
      end
    end

    context "with my highlights" do
      it "shows the check all dropdown" do
        allow(controller).to receive(:params).and_return(controller: "my/shares")
        expect(subject).to have_css("span.caret")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_all")
        expect(subject).to have_content t("sufia.dashboard.my.action.select_none")
      end
    end

    context "with my collections" do
      it "does not show the check all dropdown" do
        allow(controller).to receive(:params).and_return(controller: "my/collections")
        expect(subject).to be_nil
      end
    end

    context "with select all disabled" do
      it "does not show the check all dropdown" do
        allow(helper).to receive(:params).and_return(controller: "foo")
        assign(:disable_select_all, true)
        expect(subject).to have_css("input[disabled=disabled]")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/helpers/batch_edits_helper_spec.rb
sufia-7.4.0 spec/helpers/batch_edits_helper_spec.rb
sufia-7.3.1 spec/helpers/batch_edits_helper_spec.rb
sufia-7.3.0 spec/helpers/batch_edits_helper_spec.rb
sufia-7.3.0.rc3 spec/helpers/batch_edits_helper_spec.rb
sufia-7.3.0.rc2 spec/helpers/batch_edits_helper_spec.rb