Skip to content

Commit

Permalink
[DUOS-1552][risk=no] multi dataset voting member tab (#1507)
Browse files Browse the repository at this point in the history
* Add tab for Member Vote

* Create voting tab component

* Add wiring for passing rp bucket to srp tab

* Add title to tab

* Filter and sort data use buckets before passing to slabs

* Add MultiDatasetVotingSlabs for each bucket

* Fix slab group numbers

* Adjust styling

* Change tab style

* Add tests

* Add dataCy attribute

* Add key property to list of MultiDatasetVoteSlabs

* Add keys to mapped elements

* Add tab to DarCollectionReview page

* Remove added linebreaks

* Update function name

* Remove padding around ResearchProposalVoteSlab

* Import ChairVoteInfo from ResearchProposalVoteSlab into MultiDatasetVoteSlab

* Change dataCy to datacy

Co-authored-by: Shae Marks <[email protected]>
  • Loading branch information
shaemarks and Shae Marks authored Apr 19, 2022
1 parent 5bb5728 commit a7339cf
Show file tree
Hide file tree
Showing 19 changed files with 536 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('does not render any buttons as selected if vote values are different', function() {
Expand All @@ -37,8 +37,8 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('does not render any buttons as selected if vote values are null', function() {
Expand All @@ -49,9 +49,9 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=collection-vote-box]').should('exist');
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=collection-vote-box]').should('exist');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('does not render any buttons as selected if list of votes is empty', function() {
Expand All @@ -62,9 +62,9 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=collection-vote-box]').should('exist');
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=collection-vote-box]').should('exist');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('does not render any buttons as selected if list of votes is null', function() {
Expand All @@ -74,9 +74,9 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=collection-vote-box]').should('exist');
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=collection-vote-box]').should('exist');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('renders existing rationale if rationale is the same for all votes', function() {
Expand Down Expand Up @@ -116,8 +116,8 @@ describe('CollectionSubmitVoteBox - Tests', function() {
cy.get('textarea').type(' hello');
cy.get('textarea').blur();
cy.get('textarea').should('have.text', 'testsample text hello');
cy.get('[dataCy=yes-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=yes-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('textarea').type('{backspace}{backspace}');
cy.get('textarea').blur();
cy.get('textarea').should('have.text', 'testsample text hel');
Expand All @@ -131,14 +131,14 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=yes-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(218, 0, 3)');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(218, 0, 3)');

});

Expand Down Expand Up @@ -173,7 +173,7 @@ describe('CollectionSubmitVoteBox - Tests', function() {
cy.get('textarea').type('sample text');
cy.get('textarea').blur();
cy.get('textarea').should('have.text', 'sample text');
cy.get('[dataCy=no-collection-vote-button]').click();
cy.get('[datacy=no-collection-vote-button]').click();
cy.get('textarea').should('be.disabled');
});

Expand All @@ -187,14 +187,14 @@ describe('CollectionSubmitVoteBox - Tests', function() {
);
cy.stub(Votes, 'updateVotesByIds');

cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=yes-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('can not vote if votes already have vote value when vote is final', function() {
Expand All @@ -205,11 +205,11 @@ describe('CollectionSubmitVoteBox - Tests', function() {
question={"question"}
/>
);
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(31, 163, 113)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
});

it('disables vote buttons and text area if page is loading', function () {
Expand All @@ -223,11 +223,11 @@ describe('CollectionSubmitVoteBox - Tests', function() {
);
cy.stub(Votes, 'updateVotesByIds');

cy.get('[dataCy=yes-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('textarea').should('be.disabled');
})
});

it('disables vote buttons and text area if isDisabled prop is true', function () {
mount(
Expand All @@ -240,9 +240,9 @@ describe('CollectionSubmitVoteBox - Tests', function() {
);
cy.stub(Votes, 'updateVotesByIds');

cy.get('[dataCy=yes-collection-vote-button]').click();
cy.get('[dataCy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[dataCy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=yes-collection-vote-button]').click();
cy.get('[datacy=yes-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('[datacy=no-collection-vote-button]').should('have.css', 'background-color', 'rgb(255, 255, 255)');
cy.get('textarea').should('be.disabled');
})
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseManualReviewTrue]}}
/>
);
const component = cy.get('[dataCy=alert-box]').should('be.visible');
const component = cy.get('[datacy=alert-box]').should('be.visible');
component.contains('!');
});

Expand All @@ -45,7 +45,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseManualReviewFalse]}}
/>
);
cy.get('[dataCy=alert-box]').should('not.exist');
cy.get('[datacy=alert-box]').should('not.exist');
});

it('Does not render the description of a data use without a manuallyReviewed attribute', function() {
Expand All @@ -54,7 +54,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseNoManualReview]}}
/>
);
cy.get('[dataCy=alert-box]').should('not.exist');
cy.get('[datacy=alert-box]').should('not.exist');
});

it('Renders the description of a primary use manually reviewed data use', function() {
Expand All @@ -63,7 +63,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseManualReviewTrue], "secondary": [dataUseManualReviewFalse]}}
/>
);
cy.get('[dataCy=alert-box]').should('be.visible');
cy.get('[datacy=alert-box]').should('be.visible');
cy.contains('data use 1');
cy.get('data use 2').should('not.exist');
});
Expand All @@ -74,7 +74,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseManualReviewFalse], "secondary": [dataUseManualReviewTrue]}}
/>
);
cy.get('[dataCy=alert-box]').should('be.visible');
cy.get('[datacy=alert-box]').should('be.visible');
cy.contains('data use 1');
cy.get('data use 3').should('not.exist');
});
Expand All @@ -85,7 +85,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"Primary": [dataUseManualReviewTrue, dataUseManualReviewTrue2]}}
/>
);
cy.get('[dataCy=alert-box]').should('be.visible');
cy.get('[datacy=alert-box]').should('be.visible');
cy.contains('data use 1');
cy.contains('data use 2');
});
Expand All @@ -96,7 +96,7 @@ describe('DataUseAlertBox - Tests', function() {
translatedDataUse={{"primary": [dataUseManualReviewTrue2], "secondary": [dataUseManualReviewTrue]}}
/>
);
cy.get('[dataCy=alert-box]').should('be.visible');
cy.get('[datacy=alert-box]').should('be.visible');
cy.contains('data use 1');
cy.contains('data use 2');
});
Expand Down
Loading

0 comments on commit a7339cf

Please sign in to comment.