diff --git a/lib/pagy/extras/support.rb b/lib/pagy/extras/support.rb index b5654c2c8..a02391076 100644 --- a/lib/pagy/extras/support.rb +++ b/lib/pagy/extras/support.rb @@ -15,7 +15,7 @@ def pagy_next_url(pagy) end def pagy_prev_link(pagy, text = pagy_t('pagy.nav.prev'), link_extra = '') - pagy.prev ? %() + pagy.prev ? %() : %(#{text}) end diff --git a/test/pagy/extras/support_test.rb b/test/pagy/extras/support_test.rb index ae056d10f..53481be85 100644 --- a/test/pagy/extras/support_test.rb +++ b/test/pagy/extras/support_test.rb @@ -87,22 +87,22 @@ it 'renders the prev link for page 3' do pagy = Pagy.new count: 1000, page: 3 pagy_countless = Pagy::Countless.new(page: 3).finalize(21) - _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" - _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" end it 'renders the prev link for page 6' do pagy = Pagy.new count: 1000, page: 6 pagy_countless = Pagy::Countless.new(page: 6).finalize(21) - _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" - _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" end it 'renders the prev link for last page' do pagy = Pagy.new count: 1000, page: 50 pagy_countless = Pagy::Countless.new(page: 50).finalize(20) - _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" - _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy)).must_equal "‹ Prev" + _(view.pagy_prev_link(pagy_countless)).must_equal "‹ Prev" end end @@ -140,4 +140,3 @@ end end -