Skip to content

Commit

Permalink
Merge pull request #279 from woylie/fix/missing-li
Browse files Browse the repository at this point in the history
fix/missing li
  • Loading branch information
woylie authored Oct 19, 2023
2 parents 797d9a6 + 65458e0 commit 827ad51
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ application.
```elixir
def deps do
[
{:flop_phoenix, "~> 0.22.1"}
{:flop_phoenix, "~> 0.22.2"}
]
end
```
Expand Down
23 changes: 12 additions & 11 deletions lib/flop_phoenix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -503,17 +503,18 @@ defmodule Flop.Phoenix do
<span {@opts[:ellipsis_attrs]}><%= @opts[:ellipsis_content] %></span>
</li>
<.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>
<li :for={page <- @range}>
<.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 %>
</.pagination_link>
</li>
<li :if={@last < @meta.total_pages - 1}>
<span {@opts[:ellipsis_attrs]}><%= @opts[:ellipsis_content] %></span>
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
[
Expand Down
6 changes: 3 additions & 3 deletions test/flop_phoenix_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -512,22 +512,22 @@ 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"]
assert [href] = Floki.attribute(link, "href")
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"]
Expand Down

0 comments on commit 827ad51

Please sign in to comment.