diff --git a/packages/cookie-consent/src/vaadin-cookie-consent.js b/packages/cookie-consent/src/vaadin-cookie-consent.js index 5b6fc148559..ba5683313fc 100644 --- a/packages/cookie-consent/src/vaadin-cookie-consent.js +++ b/packages/cookie-consent/src/vaadin-cookie-consent.js @@ -177,6 +177,10 @@ class CookieConsent extends ElementMixin(PolymerElement) { name: this.cookieName, }, position: this.position, + elements: { + messagelink: `${this.message} ${this.learnMore}`, + dismiss: `${this.dismiss}`, + }, }); const popup = this._getPopup(); diff --git a/packages/cookie-consent/test/cookie-consent.test.js b/packages/cookie-consent/test/cookie-consent.test.js index 6e1655b7c6b..8fc9a8ffd2f 100644 --- a/packages/cookie-consent/test/cookie-consent.test.js +++ b/packages/cookie-consent/test/cookie-consent.test.js @@ -33,7 +33,7 @@ describe('vaadin-cookie-consent', () => { }); }); - describe('cooke consent window', () => { + describe('cookie consent window', () => { let consent, ccWindow; beforeEach(async () => { @@ -126,4 +126,36 @@ describe('vaadin-cookie-consent', () => { expect(link.href).to.be.equal('https://example.com/'); }); }); + + describe('accessibility', () => { + let consent, ccWindow; + + beforeEach(async () => { + consent = fixtureSync(''); + + // Force cookie consent to appear. + consent._show(); + + // By default the cookie consent dialog has a 20 ms delay after it + // is initialized and before it starts the fade-in animation. + await aTimeout(50); + + ccWindow = document.querySelector('.cc-window'); + }); + + it('learn more link should not have role', () => { + const link = ccWindow.querySelector('.cc-link'); + expect(link.hasAttribute('role')).to.be.false; + }); + + it('learn more link should not have aria-label', () => { + const link = ccWindow.querySelector('.cc-link'); + expect(link.hasAttribute('aria-label')).to.be.false; + }); + + it('dismiss link should not have aria-label', () => { + const link = ccWindow.querySelector('.cc-dismiss'); + expect(link.hasAttribute('aria-label')).to.be.false; + }); + }); });