feat: 🎸 Add sorting to sessions started column (#3174)
* feat: 🎸 Add sorting to sessions started column * test: 💍 add missing a11y ignores for existing color issue ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-18520
This commit is contained in:
1 parent
df24ba6a15
commit
d6e8e58ca1
6 files changed
+190
-80
No files matched your search
@@ -28,6 +28,11 @@ module('Acceptance | projects | sessions | index', function (hooks) {
|
||||
|
||||
const APP_STATE_TITLE =
|
||||
'[data-test-no-sessions] .hds-application-state__title';
|
||||
const TABLE_SORT_BTN = 'thead tr th:nth-child(1) button';
|
||||
const TABLE_SORT_BTN_ARROW_UP =
|
||||
'thead tr th:nth-child(1) button .hds-icon-arrow-up';
|
||||
const TABLE_SORT_BTN_ARROW_DOWN =
|
||||
'thead tr th:nth-child(1) button .hds-icon-arrow-down';
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
@@ -577,4 +582,41 @@ module('Acceptance | projects | sessions | index', function (hooks) {
|
||||
assert.strictEqual(currentURL(), urls.globalSessions);
|
||||
assert.dom('tbody tr').exists({ count: sessionsCount });
|
||||
});
|
||||
|
||||
test('sorting by session created time updates url', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2026-02-24
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.stubCacheDaemonSearch(
|
||||
'sessions',
|
||||
'sessions',
|
||||
'targets',
|
||||
|
||||
'sessions',
|
||||
'targets',
|
||||
|
||||
'sessions',
|
||||
'targets',
|
||||
);
|
||||
await visit(urls.projects);
|
||||
|
||||
await click(`[href="${urls.sessions}"]`);
|
||||
await click(TABLE_SORT_BTN);
|
||||
|
||||
assert.true(currentURL().includes('sortAttribute=created_time'));
|
||||
assert.true(currentURL().includes('sortDirection=asc'));
|
||||
assert.dom(TABLE_SORT_BTN_ARROW_UP).isVisible();
|
||||
|
||||
await click(TABLE_SORT_BTN);
|
||||
|
||||
assert.true(currentURL().includes('sortAttribute=created_time'));
|
||||
assert.true(currentURL().includes('sortDirection=desc'));
|
||||
assert.dom(TABLE_SORT_BTN_ARROW_DOWN).isVisible();
|
||||
});
|
||||
});
|
||||
@@ -884,6 +884,15 @@ module('Acceptance | projects | targets | index', function (hooks) {
|
||||
});
|
||||
|
||||
test('sorting by target name updates url', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2026-02-24
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
this.stubCacheDaemonSearch(
|
||||
'sessions',
|
||||
'targets',
|
||||
|
||||
@@ -148,5 +148,17 @@ module(
|
||||
|
||||
assert.strictEqual(session.status, STATUS_SESSION_CANCELING);
|
||||
});
|
||||
|
||||
test('onSort action sets expected values correctly', async function (assert) {
|
||||
this.stubCacheDaemonSearch();
|
||||
assert.notOk(controller.sortAttribute);
|
||||
assert.notOk(controller.sortDirection);
|
||||
|
||||
controller.onSort('created_time', 'desc');
|
||||
|
||||
assert.strictEqual(controller.page, 1);
|
||||
assert.strictEqual(controller.sortAttribute, 'created_time');
|
||||
assert.strictEqual(controller.sortDirection, 'desc');
|
||||
});
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user