Fixes #3279 - "Next ticket in overview" is clickable for the last ticket in the overview
This commit is contained in:
parent
bb26438c1c
commit
e85f80aa2c
2 changed files with 56 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<li <% if !@previous: %>class="disabled"<% end %> title="<%- @Ti( 'Previous in overview' ) %>">
|
<li <% if !@previous: %>class="disabled"<% end %> title="<%- @Ti( 'Previous in overview' ) %>">
|
||||||
<a class="centered previous" href="<% if @previous: %><%- @previous.uiUrl() %><% end %>" data-id="<% if @previous: %><%- @previous.id %><% end %>">
|
<a class="centered previous" href="<% if @previous: %><%- @previous.uiUrl() %><% end %>" <% if @previous: %>data-id="<%- @previous.id %>"<% end %>>
|
||||||
<% if @previous: %>
|
<% if @previous: %>
|
||||||
<%- @Icon('arrow-left') %>
|
<%- @Icon('arrow-left') %>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
|
@ -11,11 +11,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</a>
|
</a>
|
||||||
<li <% if !@next: %>class="disabled"<% end %> title="<%- @Ti( 'Next in overview' ) %>">
|
<li <% if !@next: %>class="disabled"<% end %> title="<%- @Ti( 'Next in overview' ) %>">
|
||||||
<a class="centered next" href="<% if @next: %><%- @next.uiUrl() %><% end %>" data-id="<% if @next: %><%- @next.id %><% end %>">
|
<a class="centered next" href="<% if @next: %><%- @next.uiUrl() %><% end %>" <% if @next: %>data-id="<%- @next.id %>"<% end %>>
|
||||||
<% if @next: %>
|
<% if @next: %>
|
||||||
<%- @Icon('arrow-right') %>
|
<%- @Icon('arrow-right') %>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<%- @Icon('arrow-right', 'arrow--disabled') %>
|
<%- @Icon('arrow-right', 'arrow--disabled') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</a>
|
</a>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1112,6 +1112,59 @@ RSpec.describe 'Ticket zoom', type: :system do
|
||||||
|
|
||||||
expect { find(:element_containing, macro.name).click }.to change { current_url }
|
expect { find(:element_containing, macro.name).click }.to change { current_url }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# https://github.com/zammad/zammad/issues/3279
|
||||||
|
describe 'previous/next clickability when at last or first ticket' do
|
||||||
|
let(:ticket_a) { create(:ticket, title: 'ticket a', group: Group.first) }
|
||||||
|
let(:ticket_b) { create(:ticket, title: 'ticket b', group: Group.first) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
ticket_a && ticket_b
|
||||||
|
|
||||||
|
visit 'ticket/view/all_unassigned'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'previous is not clickable for the first item' do
|
||||||
|
open_nth_item(0)
|
||||||
|
|
||||||
|
expect { click '.pagination .previous' }.not_to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'next is clickable for the first item' do
|
||||||
|
open_nth_item(0)
|
||||||
|
|
||||||
|
expect { click '.pagination .next' }.to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'previous is clickable for the middle item' do
|
||||||
|
open_nth_item(1)
|
||||||
|
|
||||||
|
expect { click '.pagination .previous' }.to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'next is clickable for the middle item' do
|
||||||
|
open_nth_item(1)
|
||||||
|
|
||||||
|
expect { click '.pagination .next' }.to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'previous is clickable for the last item' do
|
||||||
|
open_nth_item(2)
|
||||||
|
|
||||||
|
expect { click '.pagination .previous' }.to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'next is not clickable for the last item' do
|
||||||
|
open_nth_item(2)
|
||||||
|
|
||||||
|
expect { click '.pagination .next' }.not_to change { current_url }
|
||||||
|
end
|
||||||
|
|
||||||
|
def open_nth_item(nth)
|
||||||
|
within :active_content do
|
||||||
|
find_all('.table tr.item .user-popover')[nth].click
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue