From 032499e7f6697afc6a4f94338e6ee07c648bbaef Mon Sep 17 00:00:00 2001 From: Daniel LaLiberte Date: Mon, 23 Jan 2023 15:24:59 -0500 Subject: [PATCH] Update shoelace to 2.0.0-beta.88. Fix chromedash-textarea.js incompatibilities (#2685) * Update shoelace to 2.0.0-beta.88. Fix textarea problems. * Upgrade lit-analyzer to 1.2.1. Remove debug output. --- client-src/elements/chromedash-textarea.js | 11 ++--- .../elements/chromedash-textarea_test.js | 40 +++++++++++------- package-lock.json | 42 +++++++++---------- package.json | 4 +- 4 files changed, 53 insertions(+), 44 deletions(-) diff --git a/client-src/elements/chromedash-textarea.js b/client-src/elements/chromedash-textarea.js index 48d834d7..a920f3b1 100644 --- a/client-src/elements/chromedash-textarea.js +++ b/client-src/elements/chromedash-textarea.js @@ -26,7 +26,7 @@ export class ChromedashTextarea extends SlTextarea { /** * Checks whether the value conforms to custom validation constraints. * @param {string} value - * @return {boolean} + * @return {boolean} Return true if value is valid. */ customCheckValidity(value) { if (this.multiple) { @@ -54,24 +54,25 @@ export class ChromedashTextarea extends SlTextarea { const valueRegex = new RegExp('^' + this.pattern + '$', ''); return valueRegex.test(value); } - // Otherwise, assume it is valid. + // Otherwise, assume it is valid. What about required? disabled? return true; } - checkValidity() { + validate() { const invalidMsg = this.customCheckValidity(this.input.value) ? '' : 'invalid'; this.setCustomValidity(invalidMsg); + this.reportValidity(); } firstUpdated() { - this.invalid = !this.checkValidity(); + this.validate(); } updated() { if (!this.input) { return; } - this.checkValidity(); + this.validate(); } } diff --git a/client-src/elements/chromedash-textarea_test.js b/client-src/elements/chromedash-textarea_test.js index 765cad60..ecee5b93 100644 --- a/client-src/elements/chromedash-textarea_test.js +++ b/client-src/elements/chromedash-textarea_test.js @@ -44,41 +44,49 @@ describe('chromedash-textarea', () => { describe('when using custom validation', () => { it('should be valid with multiple valid inputs', async () => { - let component = await fixture( - html``); assert.exists(component); await component.updateComplete; - assert.equal(component.invalid, false); + assert.equal(component.checkValidity(), true); + }); + it('should be valid with multiple valid inputs and extra whitespace', async () => { // Test with extra whitespace - component = await fixture( - html``); - assert.equal(component.invalid, false); + assert.exists(component); + await component.updateComplete; + assert.equal(component.checkValidity(), true); }); it('should be invalid with any invalid inputs', async () => { - let component = await fixture( - html``); assert.exists(component); - assert.equal(component.invalid, true); + await component.updateComplete; + assert.equal(component.checkValidity(), false); + }); + it('should be invalid with any invalid inputs and extra whitespace', async () => { // Test with extra whitespace - component = await fixture( - html``); assert.exists(component); - assert.equal(component.invalid, true); + await component.updateComplete; + assert.equal(component.checkValidity(), false); }); }); }); diff --git a/package-lock.json b/package-lock.json index 719d3e59..4dfa2708 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "@open-wc/testing": "^3.1.7", "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-node-resolve": "^15.0.1", - "@shoelace-style/shoelace": "^2.0.0-beta.87", + "@shoelace-style/shoelace": "^2.0.0-beta.88", "@web/test-runner": "^0.15.0", "@web/test-runner-playwright": "^0.9.0", "acorn": ">=8.8.1", @@ -2249,22 +2249,22 @@ } }, "node_modules/@shoelace-style/localize": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@shoelace-style/localize/-/localize-3.0.3.tgz", - "integrity": "sha512-BVYDsMTpSCjvC8akhTkcnl4WIgAv7AnRq8fSuNhdGDLjkpmN1ARdAXic5luAozoMVjft85ocOmEdT8z7MbXdmQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@shoelace-style/localize/-/localize-3.0.4.tgz", + "integrity": "sha512-HFY90KD+b1Td2otSBryCOpQjBEArIwlV6Tv4J4rC/E/D5wof2eLF6JUVrbiRNn8GRmwATe4YDAEK7NUD08xO1w==", "dev": true }, "node_modules/@shoelace-style/shoelace": { - "version": "2.0.0-beta.87", - "resolved": "https://registry.npmjs.org/@shoelace-style/shoelace/-/shoelace-2.0.0-beta.87.tgz", - "integrity": "sha512-EeoMVnjkO2BI0fePZsM/x5SJd1GmUHKo8IJTHJM9mH4fqUOtnzLSlv3bHr9YQ8Zl9Wj8/Jj0uvaNdQVm3ND6ig==", + "version": "2.0.0-beta.88", + "resolved": "https://registry.npmjs.org/@shoelace-style/shoelace/-/shoelace-2.0.0-beta.88.tgz", + "integrity": "sha512-AoT3jtD7Gh5jgEtvbyqgOL+VDmxlcW0UYpKBZ0FzfF7bV38UeZqosnfeXZzQXaP/U/s4BpgkSS0+ZpPuepjDtw==", "dev": true, "dependencies": { "@ctrl/tinycolor": "^3.5.0", "@floating-ui/dom": "^1.0.7", "@lit-labs/react": "^1.1.0", "@shoelace-style/animations": "^1.1.0", - "@shoelace-style/localize": "^3.0.3", + "@shoelace-style/localize": "^3.0.4", "lit": "^2.4.1", "qr-creator": "^1.0.0" }, @@ -13047,9 +13047,9 @@ } }, "node_modules/vscode-languageserver-textdocument": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.7.tgz", - "integrity": "sha512-bFJH7UQxlXT8kKeyiyu41r22jCZXG8kuuVVA33OEJn1diWOZK5n8zBSPZFHVBOu8kXZ6h0LIRhf5UnCo61J4Hg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==", "dev": true }, "node_modules/vscode-languageserver-types": { @@ -15219,22 +15219,22 @@ "dev": true }, "@shoelace-style/localize": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@shoelace-style/localize/-/localize-3.0.3.tgz", - "integrity": "sha512-BVYDsMTpSCjvC8akhTkcnl4WIgAv7AnRq8fSuNhdGDLjkpmN1ARdAXic5luAozoMVjft85ocOmEdT8z7MbXdmQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@shoelace-style/localize/-/localize-3.0.4.tgz", + "integrity": "sha512-HFY90KD+b1Td2otSBryCOpQjBEArIwlV6Tv4J4rC/E/D5wof2eLF6JUVrbiRNn8GRmwATe4YDAEK7NUD08xO1w==", "dev": true }, "@shoelace-style/shoelace": { - "version": "2.0.0-beta.87", - "resolved": "https://registry.npmjs.org/@shoelace-style/shoelace/-/shoelace-2.0.0-beta.87.tgz", - "integrity": "sha512-EeoMVnjkO2BI0fePZsM/x5SJd1GmUHKo8IJTHJM9mH4fqUOtnzLSlv3bHr9YQ8Zl9Wj8/Jj0uvaNdQVm3ND6ig==", + "version": "2.0.0-beta.88", + "resolved": "https://registry.npmjs.org/@shoelace-style/shoelace/-/shoelace-2.0.0-beta.88.tgz", + "integrity": "sha512-AoT3jtD7Gh5jgEtvbyqgOL+VDmxlcW0UYpKBZ0FzfF7bV38UeZqosnfeXZzQXaP/U/s4BpgkSS0+ZpPuepjDtw==", "dev": true, "requires": { "@ctrl/tinycolor": "^3.5.0", "@floating-ui/dom": "^1.0.7", "@lit-labs/react": "^1.1.0", "@shoelace-style/animations": "^1.1.0", - "@shoelace-style/localize": "^3.0.3", + "@shoelace-style/localize": "^3.0.4", "lit": "^2.4.1", "qr-creator": "^1.0.0" } @@ -23753,9 +23753,9 @@ } }, "vscode-languageserver-textdocument": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.7.tgz", - "integrity": "sha512-bFJH7UQxlXT8kKeyiyu41r22jCZXG8kuuVVA33OEJn1diWOZK5n8zBSPZFHVBOu8kXZ6h0LIRhf5UnCo61J4Hg==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.8.tgz", + "integrity": "sha512-1bonkGqQs5/fxGT5UchTgjGVnfysL0O8v1AYMBjqTbWQTFn721zaPGDYFkOKtfDgFiSgXM3KwaG3FMGfW4Ed9Q==", "dev": true }, "vscode-languageserver-types": { diff --git a/package.json b/package.json index 0d16c9fd..5d3bebb0 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@open-wc/testing": "^3.1.7", "@rollup/plugin-babel": "^6.0.3", "@rollup/plugin-node-resolve": "^15.0.1", - "@shoelace-style/shoelace": "^2.0.0-beta.87", + "@shoelace-style/shoelace": "^2.0.0-beta.88", "@web/test-runner": "^0.15.0", "@web/test-runner-playwright": "^0.9.0", "acorn": ">=8.8.1", @@ -94,8 +94,8 @@ "@polymer/iron-iconset-svg": "^3.0.1", "lit": "^2", "node-fetch": ">=3.3.0", - "sass": ">=1.57.1", "page": "^1.11.6", + "sass": ">=1.57.1", "urijs": ">=1.19.11", "yargs-parser": ">=21.1.1" },