-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into Add-css-variable-for-suggestions-hover-state
- Loading branch information
Showing
119 changed files
with
440 additions
and
39 deletions.
There are no files selected for viewing
Binary file added
BIN
+1.57 KB
...s/Email-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/email-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...enshots/Email-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.84 KB
...s/Email-Field---Max-Length-Behaviour/darwin/Mobile-Safari/email-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.92 KB
...enshots/Email-Field---Max-Length-Behaviour/darwin/Mobile-Safari/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.58 KB
...nshots/Email-Field---Max-Length-Behaviour/darwin/chromium/email-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.63 KB
.../screenshots/Email-Field---Max-Length-Behaviour/darwin/chromium/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.75 KB
...enshots/Email-Field---Max-Length-Behaviour/darwin/firefox/email-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.86 KB
...s/screenshots/Email-Field---Max-Length-Behaviour/darwin/firefox/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.82 KB
...eenshots/Email-Field---Max-Length-Behaviour/darwin/webkit/email-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.9 KB
...ts/screenshots/Email-Field---Max-Length-Behaviour/darwin/webkit/email-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.72 KB
...Number-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/number-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.62 KB
...shots/Number-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/number-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.99 KB
...Number-Field---Max-Length-Behaviour/darwin/Mobile-Safari/number-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.92 KB
...shots/Number-Field---Max-Length-Behaviour/darwin/Mobile-Safari/number-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.71 KB
...hots/Number-Field---Max-Length-Behaviour/darwin/chromium/number-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.63 KB
...creenshots/Number-Field---Max-Length-Behaviour/darwin/chromium/number-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.89 KB
...shots/Number-Field---Max-Length-Behaviour/darwin/firefox/number-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.86 KB
...screenshots/Number-Field---Max-Length-Behaviour/darwin/firefox/number-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.97 KB
...nshots/Number-Field---Max-Length-Behaviour/darwin/webkit/number-field-value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.9 KB
.../screenshots/Number-Field---Max-Length-Behaviour/darwin/webkit/number-field.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.94 KB
...hots/Password-Field---Behaviour/darwin/Mobile-Chrome/password-field-initial.png
Binary file not shown.
Binary file removed
BIN
-2.05 KB
...Password-Field---Behaviour/darwin/Mobile-Chrome/password-field-value-update.png
Binary file not shown.
Binary file removed
BIN
-1.96 KB
...hots/Password-Field---Behaviour/darwin/Mobile-Safari/password-field-initial.png
Binary file not shown.
Binary file removed
BIN
-2.09 KB
...Password-Field---Behaviour/darwin/Mobile-Safari/password-field-value-update.png
Binary file not shown.
Binary file removed
BIN
-1.94 KB
...reenshots/Password-Field---Behaviour/darwin/chromium/password-field-initial.png
Binary file not shown.
Binary file removed
BIN
-2.02 KB
...hots/Password-Field---Behaviour/darwin/chromium/password-field-value-update.png
Diff not rendered.
Binary file removed
BIN
-1.79 KB
...creenshots/Password-Field---Behaviour/darwin/firefox/password-field-initial.png
Diff not rendered.
Binary file removed
BIN
-1.99 KB
...shots/Password-Field---Behaviour/darwin/firefox/password-field-value-update.png
Diff not rendered.
Binary file removed
BIN
-1.98 KB
...screenshots/Password-Field---Behaviour/darwin/webkit/password-field-initial.png
Diff not rendered.
Binary file removed
BIN
-2.16 KB
...nshots/Password-Field---Behaviour/darwin/webkit/password-field-value-update.png
Diff not rendered.
Binary file modified
BIN
-276 Bytes
(90%)
...Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Chrome/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
-283 Bytes
(90%)
...Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Chrome/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
-276 Bytes
(90%)
...word-Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Chrome/password-field.png
Oops, something went wrong.
Binary file modified
BIN
+134 Bytes
(110%)
...Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Safari/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
+84 Bytes
(100%)
...Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Safari/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+134 Bytes
(110%)
...word-Field---Custom-Icon-Slot-Behaviour/darwin/Mobile-Safari/password-field.png
Oops, something went wrong.
Binary file modified
BIN
-215 Bytes
(92%)
...word-Field---Custom-Icon-Slot-Behaviour/darwin/chromium/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
-236 Bytes
(92%)
...word-Field---Custom-Icon-Slot-Behaviour/darwin/chromium/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
-252 Bytes
(91%)
.../Password-Field---Custom-Icon-Slot-Behaviour/darwin/chromium/password-field.png
Oops, something went wrong.
Binary file modified
BIN
+30 Bytes
(100%)
...sword-Field---Custom-Icon-Slot-Behaviour/darwin/firefox/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
+59 Bytes
(100%)
...sword-Field---Custom-Icon-Slot-Behaviour/darwin/firefox/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+42 Bytes
(100%)
...s/Password-Field---Custom-Icon-Slot-Behaviour/darwin/firefox/password-field.png
Oops, something went wrong.
Binary file modified
BIN
+67 Bytes
(100%)
...ssword-Field---Custom-Icon-Slot-Behaviour/darwin/webkit/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
+49 Bytes
(100%)
...ssword-Field---Custom-Icon-Slot-Behaviour/darwin/webkit/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+134 Bytes
(110%)
...ts/Password-Field---Custom-Icon-Slot-Behaviour/darwin/webkit/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.25 KB
...word-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/password-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.42 KB
...s/Password-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.43 KB
...word-Field---Max-Length-Behaviour/darwin/Mobile-Safari/password-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.55 KB
...s/Password-Field---Max-Length-Behaviour/darwin/Mobile-Safari/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.23 KB
.../Password-Field---Max-Length-Behaviour/darwin/chromium/password-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.43 KB
...nshots/Password-Field---Max-Length-Behaviour/darwin/chromium/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.42 KB
...s/Password-Field---Max-Length-Behaviour/darwin/firefox/password-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.52 KB
...enshots/Password-Field---Max-Length-Behaviour/darwin/firefox/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.39 KB
...ts/Password-Field---Max-Length-Behaviour/darwin/webkit/password-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.53 KB
...eenshots/Password-Field---Max-Length-Behaviour/darwin/webkit/password-field.png
Oops, something went wrong.
Binary file modified
BIN
-195 Bytes
(90%)
...sword-Field---Visual-and-Behaviour/darwin/Mobile-Chrome/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
-204 Bytes
(90%)
...sword-Field---Visual-and-Behaviour/darwin/Mobile-Chrome/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
-201 Bytes
(90%)
...word-Field---Visual-and-Behaviour/darwin/Mobile-Chrome/password-field-value.png
Oops, something went wrong.
Binary file modified
BIN
-195 Bytes
(90%)
...s/Password-Field---Visual-and-Behaviour/darwin/Mobile-Chrome/password-field.png
Oops, something went wrong.
Binary file modified
BIN
+49 Bytes
(100%)
...sword-Field---Visual-and-Behaviour/darwin/Mobile-Safari/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
+47 Bytes
(100%)
...sword-Field---Visual-and-Behaviour/darwin/Mobile-Safari/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+85 Bytes
(100%)
...word-Field---Visual-and-Behaviour/darwin/Mobile-Safari/password-field-value.png
Oops, something went wrong.
Binary file modified
BIN
+49 Bytes
(100%)
...s/Password-Field---Visual-and-Behaviour/darwin/Mobile-Safari/password-field.png
Oops, something went wrong.
Binary file modified
BIN
-173 Bytes
(91%)
...s/Password-Field---Visual-and-Behaviour/darwin/chromium/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
-178 Bytes
(91%)
...s/Password-Field---Visual-and-Behaviour/darwin/chromium/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
-177 Bytes
(91%)
.../Password-Field---Visual-and-Behaviour/darwin/chromium/password-field-value.png
Oops, something went wrong.
Binary file modified
BIN
-196 Bytes
(90%)
...nshots/Password-Field---Visual-and-Behaviour/darwin/chromium/password-field.png
Oops, something went wrong.
Binary file modified
BIN
+143 Bytes
(110%)
...ts/Password-Field---Visual-and-Behaviour/darwin/firefox/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
+130 Bytes
(110%)
...ts/Password-Field---Visual-and-Behaviour/darwin/firefox/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+84 Bytes
(100%)
...s/Password-Field---Visual-and-Behaviour/darwin/firefox/password-field-value.png
Oops, something went wrong.
Binary file modified
BIN
+172 Bytes
(110%)
...enshots/Password-Field---Visual-and-Behaviour/darwin/firefox/password-field.png
Oops, something went wrong.
Binary file modified
BIN
-18 Bytes
(99%)
...ots/Password-Field---Visual-and-Behaviour/darwin/webkit/password-field-hide.png
Oops, something went wrong.
Binary file modified
BIN
-38 Bytes
(98%)
...ots/Password-Field---Visual-and-Behaviour/darwin/webkit/password-field-show.png
Oops, something went wrong.
Binary file modified
BIN
+9 Bytes
(100%)
...ts/Password-Field---Visual-and-Behaviour/darwin/webkit/password-field-value.png
Oops, something went wrong.
Binary file modified
BIN
-30 Bytes
(99%)
...eenshots/Password-Field---Visual-and-Behaviour/darwin/webkit/password-field.png
Oops, something went wrong.
Binary file added
BIN
+2.19 KB
...Search-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/search-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.13 KB
...shots/Search-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/search-field.png
Oops, something went wrong.
Binary file added
BIN
+2.32 KB
...Search-Field---Max-Length-Behaviour/darwin/Mobile-Safari/search-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.36 KB
...shots/Search-Field---Max-Length-Behaviour/darwin/Mobile-Safari/search-field.png
Oops, something went wrong.
Binary file added
BIN
+2.16 KB
...hots/Search-Field---Max-Length-Behaviour/darwin/chromium/search-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.13 KB
...creenshots/Search-Field---Max-Length-Behaviour/darwin/chromium/search-field.png
Oops, something went wrong.
Binary file added
BIN
+2.24 KB
...shots/Search-Field---Max-Length-Behaviour/darwin/firefox/search-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.27 KB
...screenshots/Search-Field---Max-Length-Behaviour/darwin/firefox/search-field.png
Oops, something went wrong.
Binary file added
BIN
+2.32 KB
...nshots/Search-Field---Max-Length-Behaviour/darwin/webkit/search-field-value.png
Oops, something went wrong.
Binary file added
BIN
+2.35 KB
.../screenshots/Search-Field---Max-Length-Behaviour/darwin/webkit/search-field.png
Oops, something went wrong.
Binary file added
BIN
+1.7 KB
...ots/Text-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/text-field-value.png
Oops, something went wrong.
Binary file added
BIN
+1.62 KB
...reenshots/Text-Field---Max-Length-Behaviour/darwin/Mobile-Chrome/text-field.png
Oops, something went wrong.
Binary file added
BIN
+1.94 KB
...ots/Text-Field---Max-Length-Behaviour/darwin/Mobile-Safari/text-field-value.png
Oops, something went wrong.
Binary file added
BIN
+1.92 KB
...reenshots/Text-Field---Max-Length-Behaviour/darwin/Mobile-Safari/text-field.png
Oops, something went wrong.
Binary file added
BIN
+1.67 KB
...eenshots/Text-Field---Max-Length-Behaviour/darwin/chromium/text-field-value.png
Oops, something went wrong.
Binary file added
BIN
+1.63 KB
...ts/screenshots/Text-Field---Max-Length-Behaviour/darwin/chromium/text-field.png
Oops, something went wrong.
Binary file added
BIN
+1.84 KB
...reenshots/Text-Field---Max-Length-Behaviour/darwin/firefox/text-field-value.png
Oops, something went wrong.
Binary file added
BIN
+1.86 KB
...sts/screenshots/Text-Field---Max-Length-Behaviour/darwin/firefox/text-field.png
Oops, something went wrong.
Binary file added
BIN
+1.92 KB
...creenshots/Text-Field---Max-Length-Behaviour/darwin/webkit/text-field-value.png
Oops, something went wrong.
Binary file added
BIN
+1.9 KB
...ests/screenshots/Text-Field---Max-Length-Behaviour/darwin/webkit/text-field.png
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,37 @@ test(`Email Field - Visual and Behaviour`, async ({ page }) => { | |
}); | ||
}); | ||
|
||
test(`Email Field - Max Length Behaviour`, async ({ page }) => { | ||
await withCoverage(page, async () => { | ||
await page.goto('/components/email-field/'); | ||
await page.evaluate(() => document.fonts.ready); | ||
|
||
const container = page.locator('.Max_Length'); | ||
const emailField = container.locator('[data-testid]').first(); | ||
emailField.evaluate(async (t: EmailField) => { | ||
t.value = ''; | ||
t.maxLength = 4; | ||
await t.updateComplete; | ||
}); | ||
|
||
// Confirm that the component matches the provided screenshot. | ||
await expect(emailField).toHaveScreenshot('email-field.png'); | ||
|
||
const inputFn = await mockEventListener(emailField, 'input'); | ||
|
||
const inputField = emailField.locator('#inputField'); | ||
|
||
const typedValue = '[email protected]'; | ||
const value = 'mail'; | ||
await inputField.type(typedValue); | ||
|
||
await expect(emailField).toHaveScreenshot('email-field-value.png'); | ||
await expect(inputField).toHaveValue(value); | ||
|
||
await expect(inputFn).toBeCalledTimes(typedValue.length); | ||
}); | ||
}); | ||
|
||
test('Email Field - Label Behaviour', testLabelBehaviour('omni-email-field')); | ||
test('Email Field - Hint Behaviour', testHintBehaviour('omni-email-field')); | ||
test('Email Field - Error Behaviour', testErrorBehaviour('omni-email-field')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { OmniFormElement } from '../core/OmniFormElement.js'; | |
* <omni-email-field | ||
* label="Enter a value" | ||
* value="[email protected]" | ||
* max-length: 5 | ||
* hint="Required" | ||
* error="Field level error message" | ||
* disabled> | ||
|
@@ -50,6 +51,12 @@ export class EmailField extends OmniFormElement { | |
*/ | ||
@property({ type: Boolean, reflect: true, attribute: 'no-native-keyboard' }) noNativeKeyboard?: boolean; | ||
|
||
/** | ||
* Maximum character input length. | ||
* @attr [max-length] | ||
*/ | ||
@property({ type: Number, reflect: true, attribute: 'max-length' }) maxLength?: number; | ||
|
||
override connectedCallback() { | ||
super.connectedCallback(); | ||
this.addEventListener('input', this._keyInput.bind(this), { | ||
|
@@ -60,6 +67,15 @@ export class EmailField extends OmniFormElement { | |
}); | ||
} | ||
|
||
// If a value is bound when the component is first updated slice the value based on the max length. | ||
protected override async firstUpdated(): Promise<void> { | ||
if (this.value !== null && this.value !== undefined) { | ||
if (this.maxLength) { | ||
this._inputElement!.value = String(this.value).slice(0, this.maxLength); | ||
} | ||
} | ||
} | ||
|
||
override focus(options?: FocusOptions | undefined): void { | ||
if (this._inputElement) { | ||
this._inputElement.focus(options); | ||
|
@@ -76,6 +92,12 @@ export class EmailField extends OmniFormElement { | |
|
||
_keyInput() { | ||
const input = this._inputElement as HTMLInputElement; | ||
// If the input has a value and the max length property is set then slice the value according to the max length. | ||
if (input?.value && this.maxLength) { | ||
if (input.value.length > this.maxLength) { | ||
input.value = input.value.slice(0, this.maxLength); | ||
} | ||
} | ||
this.value = input.value; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.