From 2df061a17fdac54287313b7d45466f492b501f6c Mon Sep 17 00:00:00 2001 From: Joren Broekema Date: Wed, 4 Mar 2020 13:55:40 +0100 Subject: [PATCH] chore: cleanup, fix tests --- packages/button/test/lion-button.test.js | 15 +++++++-------- packages/input-amount/src/LionInputAmount.js | 16 ++++++---------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/button/test/lion-button.test.js b/packages/button/test/lion-button.test.js index cec060e31..b95c7cf96 100644 --- a/packages/button/test/lion-button.test.js +++ b/packages/button/test/lion-button.test.js @@ -1,16 +1,15 @@ -import { expect, fixture, html, aTimeout, oneEvent } from '@open-wc/testing'; -import sinon from 'sinon'; +import { browserDetection } from '@lion/core'; +import { aTimeout, expect, fixture, html, oneEvent } from '@open-wc/testing'; import { + down, + keyDownOn, + keyUpOn, makeMouseEvent, pressEnter, pressSpace, - down, up, - keyDownOn, - keyUpOn, } from '@polymer/iron-test-helpers/mock-interactions.js'; -import { browserDetection } from '@lion/core'; - +import sinon from 'sinon'; import '../lion-button.js'; function getTopElement(el) { @@ -225,7 +224,7 @@ describe('lion-button', () => { it('is accessible when disabled', async () => { const el = await fixture(`foo`); - await expect(el).to.be.accessible(); + await expect(el).to.be.accessible({ ignoredRules: ['color-contrast'] }); }); }); diff --git a/packages/input-amount/src/LionInputAmount.js b/packages/input-amount/src/LionInputAmount.js index 6cb1aae68..98b5f58c5 100644 --- a/packages/input-amount/src/LionInputAmount.js +++ b/packages/input-amount/src/LionInputAmount.js @@ -1,9 +1,9 @@ import { css } from '@lion/core'; -import { LocalizeMixin, getCurrencyName, localize } from '@lion/localize'; import { LionInput } from '@lion/input'; +import { getCurrencyName, localize, LocalizeMixin } from '@lion/localize'; import { IsNumber } from '@lion/validate'; -import { parseAmount } from './parsers.js'; import { formatAmount, formatCurrencyLabel } from './formatters.js'; +import { parseAmount } from './parsers.js'; /** * `LionInputAmount` is a class for an amount custom form element (``). @@ -41,7 +41,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) { // input[aria-labelledby] el.setAttribute('data-label', ''); - el.textContent = this.__getCurrencyLabel(); + el.textContent = this.__currencyLabel; return el; } return null; @@ -115,7 +115,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) { _onCurrencyChanged({ currency }) { if (this._isPrivateSlot('after')) { - this._currencyDisplayNode.textContent = this.__getCurrencyLabel(); + this._currencyDisplayNode.textContent = this.__currencyLabel; } this.formatOptions.currency = currency; this._calculateValues(); @@ -129,11 +129,7 @@ export class LionInputAmount extends LocalizeMixin(LionInput) { this._currencyDisplayNode.setAttribute('aria-label', getCurrencyName(this.currency)); } - __getCurrencyLabel() { - return formatCurrencyLabel(this.currency, this.__getLocale()); - } - - __getLocale() { - return this.locale || localize.locale; + get __currencyLabel() { + return formatCurrencyLabel(this.currency, localize.locale); } }