Skip to content

Commit

Permalink
Refactore Snapshots Part 2
Browse files Browse the repository at this point in the history
Refs: #6963
  • Loading branch information
Makko74 committed Nov 7, 2024
1 parent 521c44e commit 47cb584
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ import { executeSnapshotTests } from '@testing';
import { KolAlert } from '../shadow';
import { KolAlertWc } from '../component';

// _alert: [false, true],
// _label: ['Überschrift'],
// _level: [1, 2, 3, 4, 5, 6],
// _type: ['default', 'error', 'info', 'success', 'warning'],

const baseObject = { _label: 'Überschrift' };
const baseArray = [true, false].map((_alert) => ({ ...baseObject, _alert }));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { KolButtonGroupTag } from '@component-names';
// import type { ButtonGroupAPI } from '@schema';
import type { ButtonGroupProps } from '@schema';
import { executeSnapshotTests } from '@testing';

import { KolButtonGroup } from '../shadow';
import { KolButtonGroupWc } from '../component';

executeSnapshotTests(KolButtonGroupTag, [KolButtonGroup, KolButtonGroupWc], [{}]);
executeSnapshotTests<ButtonGroupProps>(KolButtonGroupTag, [KolButtonGroup, KolButtonGroupWc], [{}]);
22 changes: 0 additions & 22 deletions packages/components/src/components/image/test/html.mock.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`kol-indented-text should render with 1`] = `
<kol-indented-text class="kol-indented-text">
<template shadowrootmode="open">
<kol-indented-text-wc class="kol-indented-text-wc">
<!---->
<div>
<slot></slot>
</div>
</kol-indented-text-wc>
</template>
</kol-indented-text>
`;
20 changes: 0 additions & 20 deletions packages/components/src/components/indented-text/test/html.mock.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
import { executeTests } from 'stencil-awesome-test';
import { KolIndentedTextTag } from '@component-names';
import type { IndentedTextProps } from '@schema';
import { executeSnapshotTests } from '@testing';

import { h } from '@stencil/core';
import { newSpecPage } from '@stencil/core/testing';

import { getIndentedTextHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { IndentedTextProps } from '../../../schema';
import { KolIndentedText } from '../shadow';
import { KolIndentedTextWc } from '../component';

executeTests<IndentedTextProps>(
'Heading',
async (props): Promise<SpecPage> => {
const page = await newSpecPage({
components: [KolIndentedText, KolIndentedTextWc],
template: () => <kol-indented-text {...props} />,
});
return page;
},
{},
getIndentedTextHtml,
{
execMode: 'default', // ready
},
);
executeSnapshotTests<IndentedTextProps>(KolIndentedTextTag, [KolIndentedText, KolIndentedTextWc], [{}]);
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@ import { executeSnapshotTests } from '@testing';

import { KolLinkButton } from '../shadow';

// _disabled: [true, false],
// _href: ['https://google.de'],
// _icons: ['codicon codicon-home'],
// _hideLabel: [false, true],
// _label: ['Label'],
// _target: ['_self', '_blank', 'egal'],
// _tooltipAlign: ['top', 'right', 'bottom', 'left'],
// _download: ['', 'download-file.zip'],

const baseObj = { _href: 'https://google.de', _icons: 'codicon codicon-home', _label: 'Label', _target: 'self' };

executeSnapshotTests<LinkButtonProps>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ import { executeSnapshotTests } from '@testing';
import { KolLink } from '../shadow';
import { KolLinkWc } from '../component';

// _disabled: [true, false],
// _href: ['https://google.de'],
// _icons: ['codicon codicon-home'],
// _hideLabel: [false, true],
// _label: ['Label'],
// _target: ['_self', '_blank', 'egal'],
// _tooltipAlign: ['top', 'right', 'bottom', 'left'],
// _download: ['', 'download-file.zip'],

const baseObj = { _href: 'https://google.de', _icons: 'codicon codicon-home', _label: 'Label', _target: 'self' };

executeSnapshotTests<LinkProps>(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`kol-span-wc should render with _label="Text" _accessKey="v" 1`] = `
<kol-span-wc class="kol-span-wc">
<!---->
<span>
<span class="span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
<span aria-hidden="true" class="access-key-hint">
v
</span>
</span>
</kol-span-wc>
`;

exports[`kol-span-wc should render with _label="Text" _hideLabel=true 1`] = `
<kol-span-wc class="hide-label kol-span-wc">
<!---->
<span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</kol-span-wc>
`;

exports[`kol-span-wc should render with _label="Text" _icons="codicon codicon-home" 1`] = `
<kol-span-wc class="kol-span-wc">
<!---->
<span>
<kol-icon _icons="codicon codicon-home" _label="" class="icon left"></kol-icon>
<span class="span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</kol-span-wc>
`;

exports[`kol-span-wc should render with _label="Text" 1`] = `
<kol-span-wc class="kol-span-wc">
<!---->
<span>
<span class="span-label">
Text
</span>
<span aria-hidden="true" class="span-label" hidden=""></span>
</span>
</kol-span-wc>
`;
32 changes: 7 additions & 25 deletions packages/components/src/components/span/test/snapshot.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
import { executeTests } from 'stencil-awesome-test';
import { KolSpanWcTag } from '@component-names';
import type { SpanProps } from '@schema';
import { executeSnapshotTests } from '@testing';

import { h } from '@stencil/core';
import { newSpecPage } from '@stencil/core/testing';

import type { SpecPage } from '@stencil/core/testing';
import type { SpanProps } from '../../../schema';
import { KolSpanWc } from '../component';
import { getSpanWcHtml } from './html.mock';

executeTests<SpanProps>(
'Span',
async (props): Promise<SpecPage> => {
const page = await newSpecPage({
components: [KolSpanWc],
template: () => <kol-span-wc {...props} />,
});
return page;
},
{
_icons: ['codicon codicon-home'],
_hideLabel: [true, false],
_label: ['Text', ''],
},
getSpanWcHtml,
{
execMode: 'default', // ready
},
executeSnapshotTests<SpanProps>(
KolSpanWcTag,
[KolSpanWc],
[{ _label: 'Text' }, { _label: 'Text', _accessKey: 'v' }, { _label: 'Text', _hideLabel: true }, { _label: 'Text', _icons: 'codicon codicon-home' }],
);
47 changes: 0 additions & 47 deletions packages/components/src/components/split-button/test/html.mock.ts

This file was deleted.

0 comments on commit 47cb584

Please sign in to comment.