Skip to content

Commit

Permalink
Reset page when clicking segmented tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdaley committed Apr 5, 2024
1 parent 3b0597d commit 048bd00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion web/app/components/projects/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<LinkTo
data-test-tab={{status.value}}
@route="authenticated.projects"
@query={{hash status=status.value}}
@query={{hash status=status.value page=1}}
class="hds-button hds-button--color-secondary"
>
{{status.label}}
Expand Down
11 changes: 11 additions & 0 deletions web/tests/acceptance/authenticated/projects-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,16 @@ module("Acceptance | authenticated/projects", function (hooks) {
assert
.dom(getPageTwoButton())
.hasAttribute("href", "/projects?page=2&status=archived");

// Click a pagination link
await click(getPageTwoButton());
assert.equal(currentURL(), "/projects?page=2&status=archived");

// Assert that the segmented controls have the correct hrefs (no page number)
assert.dom(ACTIVE_TAB).hasAttribute("href", "/projects");
assert
.dom(COMPLETED_TAB)
.hasAttribute("href", "/projects?status=completed");
assert.dom(ARCHIVED_TAB).hasAttribute("href", "/projects?status=archived");
});
});

0 comments on commit 048bd00

Please sign in to comment.