-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring Change Input Components snapshot test (#7060)
- Loading branch information
Showing
46 changed files
with
7,591 additions
and
1,583 deletions.
There are no files selected for viewing
119 changes: 96 additions & 23 deletions
119
packages/components/src/components/combobox/test/__snapshots__/snapshot.spec.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
33 changes: 5 additions & 28 deletions
33
packages/components/src/components/combobox/test/snapshot.spec.tsx
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 |
---|---|---|
@@ -1,33 +1,10 @@ | ||
import { KolComboboxTag } from '../../../core/component-names'; | ||
import type { ComboboxProps } from '../../../schema'; | ||
import { executeSnapshotTests } from '../../../utils/testing'; | ||
import { executeInputSnapshotTests } from '../../../utils/testing'; | ||
|
||
import { KolCombobox } from '../shadow'; | ||
|
||
const baseObj: ComboboxProps = { _label: 'Label', _suggestions: ['Frau', 'Herr', 'Divers'] }; | ||
|
||
executeSnapshotTests<ComboboxProps>( | ||
KolComboboxTag, | ||
[KolCombobox], | ||
[ | ||
{ ...baseObj }, | ||
{ ...baseObj, _hideError: false }, | ||
{ ...baseObj, _hideError: true }, | ||
{ | ||
...baseObj, | ||
_icons: { | ||
left: { | ||
icon: 'codicon codicon-arrow-left', | ||
}, | ||
right: { | ||
icon: 'codicon codicon-arrow-right', | ||
}, | ||
}, | ||
}, | ||
{ ...baseObj, _required: false }, | ||
{ ...baseObj, _required: true }, | ||
{ ...baseObj, _touched: false }, | ||
{ ...baseObj, _touched: true }, | ||
{ ...baseObj, _disabled: true }, | ||
], | ||
); | ||
executeInputSnapshotTests<ComboboxProps>(KolComboboxTag, [KolCombobox], { | ||
_value: 'Herr', | ||
_suggestions: ['Frau', 'Herr', 'Divers'], | ||
}); |
1,737 changes: 1,737 additions & 0 deletions
1,737
packages/components/src/components/input-checkbox/test/__snapshots__/snapshot.spec.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
packages/components/src/components/input-checkbox/test/html.mock.ts
This file was deleted.
Oops, something went wrong.
71 changes: 40 additions & 31 deletions
71
packages/components/src/components/input-checkbox/test/snapshot.spec.tsx
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 |
---|---|---|
@@ -1,35 +1,44 @@ | ||
import { executeTests } from 'stencil-awesome-test'; | ||
import { KolInputCheckboxTag } from '../../../core/component-names'; | ||
import type { InputCheckboxProps } from '../../../schema'; | ||
import { executeInputSnapshotTests } from '../../../utils/testing'; | ||
|
||
import { h } from '@stencil/core'; | ||
import { newSpecPage } from '@stencil/core/testing'; | ||
import { KolInputCheckbox } from '../shadow'; | ||
|
||
import { getInputCheckboxHtml } from './html.mock'; | ||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: false, | ||
_labelAlign: 'left', | ||
}); | ||
|
||
import type { SpecPage } from '@stencil/core/testing'; | ||
import type { InputCheckboxProps } from '../../../schema'; | ||
import { KolInputCheckbox } from '../shadow'; | ||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: true, | ||
_labelAlign: 'left', | ||
}); | ||
|
||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: true, | ||
_labelAlign: 'right', | ||
}); | ||
|
||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: false, | ||
_variant: 'switch', | ||
}); | ||
|
||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: true, | ||
_variant: 'switch', | ||
}); | ||
|
||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: false, | ||
_variant: 'button', | ||
}); | ||
|
||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_checked: true, | ||
_variant: 'button', | ||
}); | ||
|
||
executeTests<InputCheckboxProps>( | ||
'InputCheckbox', | ||
async (props): Promise<SpecPage> => { | ||
const page = await newSpecPage({ | ||
components: [KolInputCheckbox], | ||
template: () => <kol-input-checkbox {...props} />, | ||
}); | ||
return page; | ||
}, | ||
{ | ||
_label: ['Label'], | ||
_hideLabel: [true, false], | ||
_disabled: [true, false], | ||
_alert: [true, false], | ||
_required: [true, false], | ||
_touched: [true, false], | ||
_labelAlign: [undefined, 'left'], | ||
}, | ||
getInputCheckboxHtml, | ||
{ | ||
execMode: 'default', // ready | ||
needTimers: true, | ||
}, | ||
); | ||
executeInputSnapshotTests<InputCheckboxProps>(KolInputCheckboxTag, [KolInputCheckbox], { | ||
_indeterminate: true, | ||
}); |
Oops, something went wrong.