Skip to content

Commit

Permalink
chore(graph): change select by directory behavior when some projects …
Browse files Browse the repository at this point in the history
…are selected
  • Loading branch information
philipjfulcher committed Nov 1, 2022
1 parent a508981 commit 2a047bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions graph/client-e2e/src/integration/app.spec.ts
Expand Up @@ -231,18 +231,25 @@ describe('graph-client', () => {
});

describe('toggle all projects in folder button', () => {
it('should uncheck all projects in folder if at least one project checked', () => {
it('should check all projects in folder if at least one project checked', () => {
cy.contains('shared-product-state').scrollIntoView().should('be.visible');
cy.get('[data-project="shared-product-state"]').should('be.visible');
cy.get('[data-project="shared-product-state"]').click({ force: true });
getToggleAllButtonForFolder('shared/product').click({ force: true });
getCheckedProjectItems().should('have.length', 0);
getCheckedProjectItems().should('have.length', 4);
});

it('should check all projects in folder if no projects checked yet', () => {
getToggleAllButtonForFolder('shared').click({ force: true });
getCheckedProjectItems().should('have.length', 5);
});

it('should uncheck all projects in folder if all projects checked yet', () => {
getToggleAllButtonForFolder('shared').click({ force: true });
getCheckedProjectItems().should('have.length', 5);
getToggleAllButtonForFolder('shared').click({ force: true });
getCheckedProjectItems().should('have.length', 0);
});
});

describe('image download button', () => {
Expand Down
6 changes: 3 additions & 3 deletions graph/client/src/app/sidebar/project-list.tsx
Expand Up @@ -199,7 +199,7 @@ function SubProjectList({
}
}

const someProjectsSelected = projects.some((project) => project.isSelected);
const allProjectsSelected = projects.every((project) => project.isSelected);

return (
<>
Expand All @@ -211,13 +211,13 @@ function SubProjectList({

<span
title={
someProjectsSelected
allProjectsSelected
? `Hide all ${headerText} projects`
: `Show all ${headerText} projects`
}
className="absolute inset-y-0 right-0 flex cursor-pointer items-center text-sm font-semibold uppercase tracking-wide lg:text-xs"
data-cy={`toggle-folder-visibility-button-${headerText}`}
onClick={() => toggleAllProjects(someProjectsSelected)}
onClick={() => toggleAllProjects(allProjectsSelected)}
>
<EyeIcon className="h-5 w-5"></EyeIcon>
</span>
Expand Down

0 comments on commit 2a047bc

Please sign in to comment.