Sha256: c5c4d363eb21b519284d42e6902651024f57e5f83a7b9551a3889158eb6486a3

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 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_utl 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 25 resources per page by default" do
      expect(page).to have_css(".table-list tbody tr", count: 25)
    end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-admin-0.28.4 lib/decidim/admin/test/manage_paginated_collection_examples.rb
decidim-admin-0.28.3 lib/decidim/admin/test/manage_paginated_collection_examples.rb