From 498cd346e36e13ebbf9eee72d9659ef24d3ffd5d Mon Sep 17 00:00:00 2001 From: Joren Broekema Date: Tue, 24 Mar 2020 14:29:48 +0100 Subject: [PATCH] chore(select-rich): test submitted state --- packages/select-rich/src/LionSelectRich.js | 9 ++------- packages/select-rich/test/lion-select-rich.test.js | 10 ++++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index 1f4efe594..02be21dd1 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -1,18 +1,17 @@ import { ChoiceGroupMixin } from '@lion/choice-input'; import { css, + getScopedTagName, html, LitElement, - SlotMixin, ScopedElementsMixin, - getScopedTagName, + SlotMixin, } from '@lion/core'; import { FormControlMixin, FormRegistrarMixin, InteractionStateMixin } from '@lion/field'; import { formRegistrarManager } from '@lion/field/src/registration/formRegistrarManager.js'; import { OverlayMixin, withDropdownConfig } from '@lion/overlays'; import { ValidateMixin } from '@lion/validate'; import './differentKeyNamesShimIE.js'; - import { LionSelectInvoker } from './LionSelectInvoker.js'; function uuid() { @@ -87,10 +86,6 @@ export class LionSelectRich extends ScopedElementsMixin( type: String, attribute: 'interaction-mode', }, - - name: { - type: String, - }, }; } diff --git a/packages/select-rich/test/lion-select-rich.test.js b/packages/select-rich/test/lion-select-rich.test.js index 274577688..8483d8e55 100644 --- a/packages/select-rich/test/lion-select-rich.test.js +++ b/packages/select-rich/test/lion-select-rich.test.js @@ -1,9 +1,8 @@ import { LitElement } from '@lion/core'; +import { formFixture as fixture } from '@lion/field/test-helpers.js'; import { OverlayController } from '@lion/overlays'; import { Required } from '@lion/validate'; 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 '../lion-option.js'; import '../lion-options.js'; @@ -189,9 +188,12 @@ describe('lion-select-rich', () => { expect(el.hasFeedbackFor.includes('error')).to.be.true; 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; - // Set touched to true (needed for feedback show) because we simulate a user touching the select - el.touched = true; await el.updateComplete; expect(el.hasFeedbackFor.includes('error')).to.be.false; expect(el.showsFeedbackFor.includes('error')).to.be.false;