From 4d16f712b2db3b8a88608d781e2d3a1cef1abf7c Mon Sep 17 00:00:00 2001 From: Mathias Polligkeit Date: Fri, 20 Oct 2023 06:06:18 +0900 Subject: [PATCH 1/2] fix: wrap pagination links in li --- lib/flop_phoenix.ex | 23 ++++++++++++----------- test/flop_phoenix_test.exs | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/flop_phoenix.ex b/lib/flop_phoenix.ex index 276d31d..633b7fd 100644 --- a/lib/flop_phoenix.ex +++ b/lib/flop_phoenix.ex @@ -503,17 +503,18 @@ defmodule Flop.Phoenix do <%= @opts[:ellipsis_content] %> - <.pagination_link - :for={page <- @range} - event={@event} - target={@target} - page={page} - path={@page_link_helper.(page)} - on_paginate={@on_paginate} - {Pagination.attrs_for_page_link(page, @meta, @opts)} - > - <%= page %> - +
  • + <.pagination_link + event={@event} + target={@target} + page={page} + path={@page_link_helper.(page)} + on_paginate={@on_paginate} + {Pagination.attrs_for_page_link(page, @meta, @opts)} + > + <%= page %> + +
  • <%= @opts[:ellipsis_content] %> diff --git a/test/flop_phoenix_test.exs b/test/flop_phoenix_test.exs index 8b593ea..2254566 100644 --- a/test/flop_phoenix_test.exs +++ b/test/flop_phoenix_test.exs @@ -512,14 +512,14 @@ defmodule Flop.PhoenixTest do assert [_] = Floki.find(html, "ul[class='pagination-links']") - assert [link] = Floki.find(html, "a[aria-label='Go to page 1']") + assert [link] = Floki.find(html, "li a[aria-label='Go to page 1']") assert Floki.attribute(link, "class") == ["pagination-link"] assert Floki.attribute(link, "data-phx-link") == ["patch"] assert Floki.attribute(link, "data-phx-link-state") == ["push"] assert Floki.attribute(link, "href") == ["/pets?page_size=10"] assert String.trim(Floki.text(link)) == "1" - assert [link] = Floki.find(html, "a[aria-label='Go to page 2']") + assert [link] = Floki.find(html, "li a[aria-label='Go to page 2']") assert Floki.attribute(link, "class") == ["pagination-link is-current"] assert Floki.attribute(link, "data-phx-link") == ["patch"] assert Floki.attribute(link, "data-phx-link-state") == ["push"] @@ -527,7 +527,7 @@ defmodule Flop.PhoenixTest do assert_urls_match(href, "/pets?page=2&page_size=10") assert String.trim(Floki.text(link)) == "2" - assert [link] = Floki.find(html, "a[aria-label='Go to page 3']") + assert [link] = Floki.find(html, "li a[aria-label='Go to page 3']") assert Floki.attribute(link, "class") == ["pagination-link"] assert Floki.attribute(link, "data-phx-link") == ["patch"] assert Floki.attribute(link, "data-phx-link-state") == ["push"] From 65458e0462aa390e35aa42ee543944af45013114 Mon Sep 17 00:00:00 2001 From: Mathias Polligkeit Date: Fri, 20 Oct 2023 06:09:04 +0900 Subject: [PATCH 2/2] chore: bump version --- CHANGELOG.md | 6 ++++++ README.md | 2 +- mix.exs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36ded47..7a0950b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [0.22.2] - 2023-10-19 + +### Fixed + +- Numbered pagination links were not wrapped in `li` elements. + ## [0.22.1] - 2023-09-28 ### Changed diff --git a/README.md b/README.md index 654c887..99102be 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ application. ```elixir def deps do [ - {:flop_phoenix, "~> 0.22.1"} + {:flop_phoenix, "~> 0.22.2"} ] end ``` diff --git a/mix.exs b/mix.exs index 39b7a91..d17863b 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule FlopPhoenix.MixProject do use Mix.Project @source_url "https://github.com/woylie/flop_phoenix" - @version "0.22.1" + @version "0.22.2" def project do [