chore: cleanup, fix tests
This commit is contained in:
parent
1bec11a267
commit
2df061a17f
2 changed files with 13 additions and 18 deletions
|
|
@ -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(`<lion-button disabled>foo</lion-button>`);
|
||||
await expect(el).to.be.accessible();
|
||||
await expect(el).to.be.accessible({ ignoredRules: ['color-contrast'] });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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 (`<lion-input-amount>`).
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue