diff --git a/package-lock.json b/package-lock.json index d60c0b1d..e71e329d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,9 +12,9 @@ "@floating-ui/dom": "^0.5.4", "@fontsource/rubik": "^4.5.9", "@lit-labs/react": "^1.1.0", - "@open-wc/form-control": "^0.4.1", - "@open-wc/form-helpers": "^0.1.2", - "element-internals-polyfill": "^1.1.15", + "@open-wc/form-control": "^0.5.1", + "@open-wc/form-helpers": "^0.2.1", + "element-internals-polyfill": "^1.2.3", "lit": "^2.2.3" }, "devDependencies": { @@ -3422,14 +3422,14 @@ "license": "MIT" }, "node_modules/@open-wc/form-control": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@open-wc/form-control/-/form-control-0.4.1.tgz", - "integrity": "sha512-9mUrlKgB9No56LtcOeG9sTy16r9aQsOR/9fKh3r9xtkAgaU6tK9nlI8u9z/6CHsvMeyumxuWjE5sypajVN7qBA==" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@open-wc/form-control/-/form-control-0.5.1.tgz", + "integrity": "sha512-5vsbHDDUUSDJghRUZ8nqY9mRk3jTCCdtSYQwvtLl7ums60G8scDmshFAiC+/dTky73P9jraHl0W3TbXdEf+ZZg==" }, "node_modules/@open-wc/form-helpers": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@open-wc/form-helpers/-/form-helpers-0.1.2.tgz", - "integrity": "sha512-nENxFIlvk5l/jjEmWjO8xpSKQmv9HT2E1QY++/pY5GsjsTxBOYRhiG6BSyjysLBb7hBvLWfCL05qefzie6Juqw==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@open-wc/form-helpers/-/form-helpers-0.2.1.tgz", + "integrity": "sha512-maurUwRrnIzKVDIdaK8+eXaa2xGaEKIEAA8k/QzMLk7KbpvG4QlqC4Y93wQ7R3258+IPd9ZfM02yeRLr7H1mRw==" }, "node_modules/@open-wc/scoped-elements": { "version": "2.0.1", @@ -12623,9 +12623,9 @@ "license": "ISC" }, "node_modules/element-internals-polyfill": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.15.tgz", - "integrity": "sha512-LwCoE6/Q2TEWo0ohm1v+hLeH4J72c7RlOO0U+pik1LIkeosrMB9qA9JZx6WkGcJcAsq/JnxhiWpd2ykwJH+uKA==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.2.3.tgz", + "integrity": "sha512-73KWRk5D3hYkaqK/XZtwTEabdwp5R6eo6vZvFMKpv995k1j8pV9FTeGhE8C/q6tN+wNQrRmj2BUMYHU884PGIA==" }, "node_modules/element-resize-detector": { "version": "1.2.4", @@ -30785,14 +30785,14 @@ "dev": true }, "@open-wc/form-control": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@open-wc/form-control/-/form-control-0.4.1.tgz", - "integrity": "sha512-9mUrlKgB9No56LtcOeG9sTy16r9aQsOR/9fKh3r9xtkAgaU6tK9nlI8u9z/6CHsvMeyumxuWjE5sypajVN7qBA==" + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@open-wc/form-control/-/form-control-0.5.1.tgz", + "integrity": "sha512-5vsbHDDUUSDJghRUZ8nqY9mRk3jTCCdtSYQwvtLl7ums60G8scDmshFAiC+/dTky73P9jraHl0W3TbXdEf+ZZg==" }, "@open-wc/form-helpers": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/@open-wc/form-helpers/-/form-helpers-0.1.2.tgz", - "integrity": "sha512-nENxFIlvk5l/jjEmWjO8xpSKQmv9HT2E1QY++/pY5GsjsTxBOYRhiG6BSyjysLBb7hBvLWfCL05qefzie6Juqw==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@open-wc/form-helpers/-/form-helpers-0.2.1.tgz", + "integrity": "sha512-maurUwRrnIzKVDIdaK8+eXaa2xGaEKIEAA8k/QzMLk7KbpvG4QlqC4Y93wQ7R3258+IPd9ZfM02yeRLr7H1mRw==" }, "@open-wc/scoped-elements": { "version": "2.0.1", @@ -37640,9 +37640,9 @@ "dev": true }, "element-internals-polyfill": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.1.15.tgz", - "integrity": "sha512-LwCoE6/Q2TEWo0ohm1v+hLeH4J72c7RlOO0U+pik1LIkeosrMB9qA9JZx6WkGcJcAsq/JnxhiWpd2ykwJH+uKA==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/element-internals-polyfill/-/element-internals-polyfill-1.2.3.tgz", + "integrity": "sha512-73KWRk5D3hYkaqK/XZtwTEabdwp5R6eo6vZvFMKpv995k1j8pV9FTeGhE8C/q6tN+wNQrRmj2BUMYHU884PGIA==" }, "element-resize-detector": { "version": "1.2.4", diff --git a/package.json b/package.json index 7c537f48..2fa60064 100644 --- a/package.json +++ b/package.json @@ -59,9 +59,9 @@ "@floating-ui/dom": "^0.5.4", "@fontsource/rubik": "^4.5.9", "@lit-labs/react": "^1.1.0", - "@open-wc/form-control": "^0.4.1", - "@open-wc/form-helpers": "^0.1.2", - "element-internals-polyfill": "^1.1.15", + "@open-wc/form-control": "^0.5.1", + "@open-wc/form-helpers": "^0.2.1", + "element-internals-polyfill": "^1.2.3", "lit": "^2.2.3" }, "engines": { diff --git a/src/components/drawer/bl-drawer.test.ts b/src/components/drawer/bl-drawer.test.ts index 5759de77..4b6f4018 100644 --- a/src/components/drawer/bl-drawer.test.ts +++ b/src/components/drawer/bl-drawer.test.ts @@ -75,13 +75,14 @@ describe('bl-drawer',() => { }); it('should render the caption, embedUrl if provided', async ()=>{ - const el = await fixture(html`
example content
`); + const embedUrl = '/?test=1'; + const el = await fixture(html`
example content
`); const caption = el.shadowRoot?.querySelector('#drawer-caption') as HTMLElement; const iframeEl = el.shadowRoot?.querySelector('iframe') as HTMLElement; expect(iframeEl).to.exist; - expect(iframeEl.attributes.getNamedItem('src')?.value).to.contain("some-url"); + expect(iframeEl.attributes.getNamedItem('src')?.value).to.contain(embedUrl); expect(caption).to.exist; expect(caption.innerText).to.equal('My Caption'); @@ -129,7 +130,6 @@ describe('bl-drawer',() => { setTimeout(async () => { const openEvent = await oneEvent(el,'bl-drawer-open'); expect(openEvent).to.exist; - expect(openEvent.detail.isOpen).to.equal(true); }); }); it('should fire bl-drawer-close when dialog closes',async ()=>{ @@ -141,7 +141,6 @@ describe('bl-drawer',() => { closeBtn?.click(); const openEvent = await oneEvent(el,'bl-drawer-close'); expect(openEvent).to.exist; - expect(openEvent.detail.isOpen).to.equal(false); }); }); }) diff --git a/src/components/textarea/bl-textarea.test.ts b/src/components/textarea/bl-textarea.test.ts index 887b58ba..1ba9a48c 100644 --- a/src/components/textarea/bl-textarea.test.ts +++ b/src/components/textarea/bl-textarea.test.ts @@ -202,7 +202,7 @@ describe('bl-textarea', () => { const ev = await oneEvent(el, 'bl-invalid'); expect(ev).to.exist; - expect(ev.detail['rangeOverflow']).to.equal(true); + expect(ev.detail['tooLong']).to.equal(true); }); }); describe('form integration', () => { diff --git a/src/components/textarea/bl-textarea.ts b/src/components/textarea/bl-textarea.ts index e6aceee7..f51e3f69 100644 --- a/src/components/textarea/bl-textarea.ts +++ b/src/components/textarea/bl-textarea.ts @@ -196,7 +196,7 @@ export default class BlTextarea extends FormControlMixin(LitElement) { @state() private dirty = false; render(): TemplateResult { - const maxLengthInvalid = this.internals.validity.rangeOverflow; + const maxLengthInvalid = this.internals.validity.tooLong; const invalidMessage = !this.checkValidity() ? html`

${this.validationMessage}

` : ``; diff --git a/src/utilities/form-control.ts b/src/utilities/form-control.ts index 6cfe9f7b..c3635004 100644 --- a/src/utilities/form-control.ts +++ b/src/utilities/form-control.ts @@ -1,4 +1,4 @@ -import {maxLengthValidator, requiredValidator} from "@open-wc/form-control"; +import { maxLengthValidator } from "@open-wc/form-control"; const validityStates: Array = [ @@ -25,15 +25,14 @@ export const innerInputValidators = validityStates.map(key => ({ export const textareaLengthValidator = { ...maxLengthValidator, isValid(instance: HTMLElement & { validationTarget: HTMLTextAreaElement }) { - if(instance.validationTarget && instance.attributes.getNamedItem('maxLength')){ - return (Number(instance.attributes.getNamedItem('maxlength')?.value) >= instance.validationTarget.value.length); + if(instance.validationTarget && instance.getAttribute('maxlength')){ + return (Number(instance.getAttribute('maxlength')) >= instance.validationTarget.value.length); } return true; } }; export const textAreaValidators = [ - ...innerInputValidators, - textareaLengthValidator, - requiredValidator + ...innerInputValidators, + textareaLengthValidator ]