chore(select-rich): test submitted state
This commit is contained in:
parent
530cb31089
commit
498cd346e3
2 changed files with 8 additions and 11 deletions
|
|
@ -1,18 +1,17 @@
|
||||||
import { ChoiceGroupMixin } from '@lion/choice-input';
|
import { ChoiceGroupMixin } from '@lion/choice-input';
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
|
getScopedTagName,
|
||||||
html,
|
html,
|
||||||
LitElement,
|
LitElement,
|
||||||
SlotMixin,
|
|
||||||
ScopedElementsMixin,
|
ScopedElementsMixin,
|
||||||
getScopedTagName,
|
SlotMixin,
|
||||||
} from '@lion/core';
|
} from '@lion/core';
|
||||||
import { FormControlMixin, FormRegistrarMixin, InteractionStateMixin } from '@lion/field';
|
import { FormControlMixin, FormRegistrarMixin, InteractionStateMixin } from '@lion/field';
|
||||||
import { formRegistrarManager } from '@lion/field/src/registration/formRegistrarManager.js';
|
import { formRegistrarManager } from '@lion/field/src/registration/formRegistrarManager.js';
|
||||||
import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
|
import { OverlayMixin, withDropdownConfig } from '@lion/overlays';
|
||||||
import { ValidateMixin } from '@lion/validate';
|
import { ValidateMixin } from '@lion/validate';
|
||||||
import './differentKeyNamesShimIE.js';
|
import './differentKeyNamesShimIE.js';
|
||||||
|
|
||||||
import { LionSelectInvoker } from './LionSelectInvoker.js';
|
import { LionSelectInvoker } from './LionSelectInvoker.js';
|
||||||
|
|
||||||
function uuid() {
|
function uuid() {
|
||||||
|
|
@ -87,10 +86,6 @@ export class LionSelectRich extends ScopedElementsMixin(
|
||||||
type: String,
|
type: String,
|
||||||
attribute: 'interaction-mode',
|
attribute: 'interaction-mode',
|
||||||
},
|
},
|
||||||
|
|
||||||
name: {
|
|
||||||
type: String,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
import { LitElement } from '@lion/core';
|
import { LitElement } from '@lion/core';
|
||||||
|
import { formFixture as fixture } from '@lion/field/test-helpers.js';
|
||||||
import { OverlayController } from '@lion/overlays';
|
import { OverlayController } from '@lion/overlays';
|
||||||
import { Required } from '@lion/validate';
|
import { Required } from '@lion/validate';
|
||||||
import { aTimeout, defineCE, expect, html, nextFrame, unsafeStatic } from '@open-wc/testing';
|
import { aTimeout, defineCE, expect, html, nextFrame, unsafeStatic } from '@open-wc/testing';
|
||||||
import { formFixture as fixture } from '@lion/field/test-helpers.js';
|
|
||||||
|
|
||||||
import { LionSelectRich } from '../index.js';
|
import { LionSelectRich } from '../index.js';
|
||||||
import '../lion-option.js';
|
import '../lion-option.js';
|
||||||
import '../lion-options.js';
|
import '../lion-options.js';
|
||||||
|
|
@ -189,9 +188,12 @@ describe('lion-select-rich', () => {
|
||||||
expect(el.hasFeedbackFor.includes('error')).to.be.true;
|
expect(el.hasFeedbackFor.includes('error')).to.be.true;
|
||||||
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
||||||
|
|
||||||
|
// test submitted prop explicitly, since we dont extend field, we add the prop manually
|
||||||
|
el.submitted = true;
|
||||||
|
await el.updateComplete;
|
||||||
|
expect(el.showsFeedbackFor.includes('error')).to.be.true;
|
||||||
|
|
||||||
el._listboxNode.children[1].checked = true;
|
el._listboxNode.children[1].checked = true;
|
||||||
// Set touched to true (needed for feedback show) because we simulate a user touching the select
|
|
||||||
el.touched = true;
|
|
||||||
await el.updateComplete;
|
await el.updateComplete;
|
||||||
expect(el.hasFeedbackFor.includes('error')).to.be.false;
|
expect(el.hasFeedbackFor.includes('error')).to.be.false;
|
||||||
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
expect(el.showsFeedbackFor.includes('error')).to.be.false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue