Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@
if(value){
value.setAttribute('aria-labelledby', id);
}
if(editButton && editButton.getAttribute(Review.DATA_ATTRIBUTE_VISIBLE) === 'true'){
editButton.setAttribute('aria-describedby', id);
}
}

static isRepeatable(item) {
Expand Down Expand Up @@ -308,7 +305,8 @@
const editButton = cloneNode.querySelector(Review.selectors.editButton);
if (editButton) {
editButton.setAttribute(Review.selectors.fieldId, item.id);
editButton.setAttribute('aria-label', item?.label?.value);
const currentItemLabel = item?.label?.value;
editButton.setAttribute('aria-label', Granite.I18n.get('Edit') + (currentItemLabel ? " " + currentItemLabel : ""));
if (item.enabled === false) {
editButton.setAttribute('disabled', true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ describe("Form with Review component with repeatablity", () => {
cy.get(`.${bemBlock}__container .${bemBlock}__panel`).eq(0).within(() => {
cy.get(`.${bemBlock}__label-container`).should('exist');
cy.get(`.${bemBlock}__label`).contains('Personal Information');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Personal Information');

cy.get(`.${bemBlock}__content`).should('exist').within(() => {
cy.get(`.${bemBlock}__field`).eq(0).within(() => {
Expand Down Expand Up @@ -122,7 +125,10 @@ describe("Form with Review component with repeatablity", () => {
cy.get(`.${bemBlock}__content`).should('exist').within(() => {
cy.get(`.${bemBlock}__label-container`).should('exist');
cy.get(`.${bemBlock}__label`).contains('Address');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Address');

cy.get(`.${bemBlock}__content`).should('exist').within(() => {
cy.get(`.${bemBlock}__field`).eq(0).within(() => {
Expand Down
35 changes: 28 additions & 7 deletions ui.tests/test-module/specs/review/review.runtime.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,19 @@ describe("Form with Review component", () => {
cy.get(`.${bemBlock}__field`).eq(0).within(() => {
cy.get(`.${bemBlock}__label`).contains('First name');
cy.get(`.${bemBlock}__value`).contains('john');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'First name');
});

cy.get(`.${bemBlock}__field`).eq(1).within(() => {
cy.get(`.${bemBlock}__label`).contains('Last name');
cy.get(`.${bemBlock}__value`).contains('deo');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Last name');
});

cy.get(`.${bemBlock}__field`).eq(2).within(() => {
Expand All @@ -85,31 +91,46 @@ describe("Form with Review component", () => {
cy.get(`.${bemBlock}__field`).eq(3).within(() => {
cy.get(`.${bemBlock}__label`).contains('Email Address');
cy.get(`.${bemBlock}__value`).contains('[email protected]');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Email Address');
});

cy.get(`.${bemBlock}__field`).eq(4).within(() => {
cy.get(`.${bemBlock}__label`).contains('Mobile Number');
cy.get(`.${bemBlock}__value`).contains('+91987654321');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Mobile Number');
});

cy.get(`.${bemBlock}__field`).eq(5).within(() => {
cy.get(`.${bemBlock}__label`).contains('DOB');
cy.get(`.${bemBlock}__value`).contains('2020-10-10');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'DOB');
});

cy.get(`.${bemBlock}__field`).eq(6).within(() => {
cy.get(`.${bemBlock}__label`).contains('Gender');
cy.get(`.${bemBlock}__value`).contains('Male');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Gender');
});

cy.get(`.${bemBlock}__field`).eq(7).within(() => {
cy.get(`.${bemBlock}__label`).contains('Interest');
cy.get(`.${bemBlock}__value`).contains('Music , Football');
cy.get(`.${bemBlock}__edit-button`).should('have.attr', 'data-cmp-visible', 'true');
cy.get(`.${bemBlock}__edit-button`)
.should('have.attr', 'data-cmp-visible', 'true')
.should('have.attr', 'aria-label')
.and('contain', 'Interest');
});
});
});
Expand Down
Loading