Sha256: 7dfc667d58d67ad82d00c32478af23935858ae281d1a3645711e319d731a9176

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

shared_examples "a paginated collection" do |options|
  before do
    # Current path strips out the request parameters, use current_url when needed
    # Be aware that current_url can lead to flaky, use with caution
    if options&.dig(:url)
      visit current_url
    else
      visit current_path
    end
  end

  describe "Number of results per page" do
    it "lists 15 resources per page by default" do
      expect(page).to have_css(".table-list tbody tr", count: 15)
    end

    it "changes the number of results per page" do
      within "[data-pagination]" do
        page.find("details", text: "15").click
        click_on "50"
      end

      expect(page).to have_css(".table-list tbody tr", count: 50)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-admin-0.29.0.rc4 lib/decidim/admin/test/manage_paginated_collection_examples.rb
decidim-admin-0.29.0.rc3 lib/decidim/admin/test/manage_paginated_collection_examples.rb
decidim-admin-0.29.0.rc2 lib/decidim/admin/test/manage_paginated_collection_examples.rb
decidim-admin-0.29.0.rc1 lib/decidim/admin/test/manage_paginated_collection_examples.rb