-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(component-library): improve email field
- Loading branch information
Showing
8 changed files
with
745 additions
and
151 deletions.
There are no files selected for viewing
30 changes: 16 additions & 14 deletions
30
...s/component-library/src/components/form/_internal/mt-field-copyable/mt-field-copyable.vue
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,25 +8,6 @@ export default { | |
title: "Interaction Tests/Form/mt-email-field", | ||
} as MtEmailFieldMeta; | ||
|
||
export const TestInputValue: MtEmailFieldStory = { | ||
name: "Should keep input value", | ||
play: async ({ canvasElement, args }) => { | ||
const canvas = within(canvasElement); | ||
const TEST_EMAIL = "[email protected]"; | ||
|
||
await userEvent.type(canvas.getByRole("textbox"), TEST_EMAIL); | ||
await userEvent.click(canvas.getByText("hidden")); | ||
|
||
expect((canvas.getByRole("textbox") as HTMLInputElement).value).toBe(TEST_EMAIL); | ||
|
||
// Input to be called once for each letter | ||
|
||
expect(args.updateModelValue).toHaveBeenCalledTimes(18); | ||
|
||
expect(args.change).toHaveBeenCalledWith(TEST_EMAIL); | ||
}, | ||
}; | ||
|
||
export const VisualTestPrefix: MtEmailFieldStory = { | ||
name: "Should display prefix", | ||
args: { | ||
|
@@ -63,18 +44,6 @@ export const VisualTestHint: MtEmailFieldStory = { | |
}, | ||
}; | ||
|
||
export const TestLabel: MtEmailFieldStory = { | ||
name: "Should display label", | ||
args: { | ||
label: "label", | ||
}, | ||
play: ({ canvasElement, args }) => { | ||
const canvas = within(canvasElement); | ||
|
||
expect(canvas.getByText(args.label!)).toBeDefined(); | ||
}, | ||
}; | ||
|
||
export const VisualTestDisabled: MtEmailFieldStory = { | ||
name: "Should disable", | ||
args: { | ||
|
@@ -114,16 +83,17 @@ export const VisualTestError: MtEmailFieldStory = { | |
}, | ||
}; | ||
|
||
export const VisualTestValidationError: MtEmailFieldStory = { | ||
name: "Should validate email", | ||
export const VisualTestSmall: MtEmailFieldStory = { | ||
name: "Should display small", | ||
args: { | ||
modelValue: "admin@", | ||
small: true, | ||
}, | ||
play: ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
}; | ||
|
||
expect( | ||
canvas.getByText("Please enter a part following '@'. 'admin@' is incomplete."), | ||
).toBeDefined(); | ||
export const TestShouldCopyValue: MtEmailFieldStory = { | ||
name: "Should copy value", | ||
args: { | ||
modelValue: "Shopware", | ||
copyable: true, | ||
}, | ||
}; |
Oops, something went wrong.