Skip to content

Commit

Permalink
Refactoring Change Input Components snapshot test (#7060)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdvg authored Nov 12, 2024
2 parents faf7344 + 423e6d7 commit cfe2c82
Show file tree
Hide file tree
Showing 46 changed files with 7,591 additions and 1,583 deletions.

Large diffs are not rendered by default.

33 changes: 5 additions & 28 deletions packages/components/src/components/combobox/test/snapshot.spec.tsx
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'],
});

Large diffs are not rendered by default.

This file was deleted.

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,
});
Loading

0 comments on commit cfe2c82

Please sign in to comment.