Skip to content

Commit

Permalink
AG-1409 fix sort bug when switching categories
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 committed May 13, 2024
1 parent 83dc635 commit e203798
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {

if (!this.sortField || !this.columns.includes(this.sortField)) {
this.sortField = this.columns[0];
this.sortOrder = -1;
}

const preSelection = this.helperService.getGCTSelection();
Expand Down
37 changes: 37 additions & 0 deletions tests/gene-comparison-tool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,41 @@ test.describe('specific viewport block', () => {
const dropdown = page.locator('#subCategory');
await expect(dropdown).toHaveText('Targeted Selected Reaction Monitoring (SRM)');
});

test('switching from RNA to Protein with RNA-specific column ordering reverts back to Risk Score descending', async ({ page }) => {
// set category for Protein - Differential Expression
await page.goto('/genes/comparison?sortField=FP&sortOrder=1');

// wait for page to load (i.e. spinner to disappear)
await expect(page.locator('div:nth-child(4) > div > .spinner'))
.not.toBeVisible({ timeout: 150000});

// Gene Comparison Overview tutorial modal
const tutorialModal = page.getByText('Gene Comparison Overview');
await expect(tutorialModal).toBeVisible({ timeout: 10000});

// close the Gene Comparison Overview tutorial modal
const closeButton = page.locator('.p-dialog-header-close-icon');
await closeButton.click();

// Gene Comparison Overview tutorial modal
await expect(tutorialModal).not.toBeVisible({ timeout: 10000});

// sort by FP ascending
const FPColumn = page.getByText('FP');
// first click sorts descending
await FPColumn.click();
// second click sorts ascending
await FPColumn.click();

// expect url to be correct
expect(page.url()).toBe('http://localhost:8080/genes/comparison?sortField=FP&sortOrder=1');

// change category to Protein
await page.locator('p-dropdown').filter({ hasText: 'RNA - Differential Expression' }).getByLabel('dropdown trigger').click();
await page.getByText('Protein - Differential Expression').click();

// expect url to be correct
expect(page.url()).toBe('http://localhost:8080/genes/comparison?category=Protein+-+Differential+Expression');
});
});

0 comments on commit e203798

Please sign in to comment.