Skip to content

Commit

Permalink
Fix Test: Fix incorrect import paths / Fix selec / Fix split-button
Browse files Browse the repository at this point in the history
Refs: #6254
  • Loading branch information
anicyne committed May 3, 2024
1 parent 070d709 commit e7a0510
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LinkButtonProps } from '@public-ui/schema';
import type { LinkButtonProps } from '../../../schema';
import { KolLinkWcTag } from '../../../core/component-names';

export const getLinkButtonHtml = (props: LinkButtonProps): string => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getLinkButtonHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { LinkButtonProps } from '@public-ui/schema';
import type { LinkButtonProps } from '../../../schema';
import { KolLinkButton } from '../component';

executeTests<LinkButtonProps>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mixMembers } from 'stencil-awesome-test';

import type { LinkGroupProps } from '@public-ui/schema';
import type { LinkGroupProps } from '../../../schema';

export const getLinkGroupHtml = (props: LinkGroupProps): string => {
props = mixMembers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getLinkGroupHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { LinkGroupProps } from '@public-ui/schema';
import type { LinkGroupProps } from '../../../schema';
import { KolLinkGroup } from '../component';

executeTests<LinkGroupProps>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getModalHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { ModalProps } from '@public-ui/schema';
import type { ModalProps } from '../../../schema';
import { KolModal } from '../component';

executeTests<ModalProps>(
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/nav/test/html.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mixMembers } from 'stencil-awesome-test';

import { KolButtonTag, KolButtonWcTag, KolLinkWcTag } from '../../../core/component-names';

import type { ButtonOrLinkOrTextWithChildrenProps, LinkProps, LinkWithChildrenProps, NavProps } from '@public-ui/schema';
import type { ButtonOrLinkOrTextWithChildrenProps, LinkProps, LinkWithChildrenProps, NavProps } from '../../../schema';
import { translate } from '../../../i18n';

export const getNavHtml = (props: NavProps): string => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getNavHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { NavProps } from '@public-ui/schema';
import type { NavProps } from '../../../schema';
import { KolNav } from '../component';

executeTests<NavProps>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PaginationProps, PaginationStates } from '@public-ui/schema';
import type { PaginationProps, PaginationStates } from '../../../schema';
import { mixMembers } from 'stencil-awesome-test';
import { translate } from '../../../i18n';
import { JSX } from '@stencil/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getPaginationHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { PaginationProps } from '@public-ui/schema';
import type { PaginationProps } from '../../../schema';
import { KolPagination } from '../component';

executeTests<PaginationProps>(
Expand Down
33 changes: 18 additions & 15 deletions packages/components/src/components/select/test/html.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mixMembers } from 'stencil-awesome-test';
import { nonce } from '../../../utils/dev.utils';

import { type SelectProps, type SelectStates, showExpertSlot, type W3CInputValue, type Option } from '@public-ui/schema';
import { type SelectProps, type SelectStates, showExpertSlot, type W3CInputValue, type Option } from '../../../schema';
import { KolInputTag } from '../../../core/component-names';

export const getSelectHtml = (props: SelectProps): string => {
Expand Down Expand Up @@ -51,21 +51,24 @@ export const getSelectHtml = (props: SelectProps): string => {
}
</span>
<div slot="input">
<form>
<input type="submit" hidden="" />
<select ${state._required ? ' required=""' : ''} ${state._multiple ? ' multiple=""' : ''} autocapitalize="off" autocorrect="off" id="id-nonce" spellcheck="false">
${state._options
.map((option, index) => {
const key = `-${index}`;
return `
<option
${option.disabled ? 'disabled=""' : ''}
value="${key}"
${isSelected(state._value, (option as unknown as Option<W3CInputValue>).value) || (state._multiple === false && index === 0) ? 'selected=""' : ''}
>
${option.label}
</option>`;
})
.join('')}
</select>
${state._options
.map((option, index) => {
const key = `-${index}`;
return `
<option
${option.disabled ? 'disabled=""' : ''}
value="${key}"
${isSelected(state._value, (option as unknown as Option<W3CInputValue>).value) || (state._multiple === false && index === 0) ? 'selected=""' : ''}
>
${option.label}
</option>`;
})
.join('')}
</select>
<form>
</div>
</${KolInputTag}t>
</mock:shadow-root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { newSpecPage } from '@stencil/core/testing';

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

import type { SelectProps } from '@public-ui/schema';
import type { SelectProps } from '../../../schema';
import type { SpecPage } from '@stencil/core/testing';
import { KolSelect } from '../component';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LinkProps, SkipNavProps, SkipNavStates } from '@public-ui/schema';
import type { LinkProps, SkipNavProps, SkipNavStates } from '../../../schema';
import { mixMembers } from 'stencil-awesome-test';
import { KolLinkWcTag } from '../../../core/component-names';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getSkipNavHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { SkipNavProps } from '@public-ui/schema';
import type { SkipNavProps } from '../../../schema';
import { KolSkipNav } from '../component';

executeTests<SkipNavProps>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { SplitButtonProps, SplitButtonStates } from '@public-ui/schema';
import type { SplitButtonProps, SplitButtonStates } from '../../../schema';
import { mixMembers } from 'stencil-awesome-test';
import { KolButtonWcTag } from '../../../core/component-names';
import { translate } from '../../../i18n';

export const getSplitButtonHtml = (props: SplitButtonProps): string => {
const state = mixMembers<SplitButtonProps, SplitButtonStates>(
Expand All @@ -11,7 +12,7 @@ export const getSplitButtonHtml = (props: SplitButtonProps): string => {
);

const variant = typeof props._variant === 'string' ? props._variant : 'normal';

const i18nDropdownLabel = 'kol-split-button-dropdown-label';
return `
<kol-split-button class="kol-split-button">
<mock:shadow-root>
Expand All @@ -32,7 +33,7 @@ export const getSplitButtonHtml = (props: SplitButtonProps): string => {
${props._disabled ? `_disabled=""` : ''}
_hidelabel=""
_icons="codicon codicon-triangle-down"
_label="dropdown ${state._show ? 'schließen' : 'öffnen'}"
_label="${state._show ? translate(`${i18nDropdownLabel}-close`) : translate(`${i18nDropdownLabel}-open`)}"
class="secondary-button"
>
</${KolButtonWcTag}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getSplitButtonHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { SplitButtonProps } from '@public-ui/schema';
import type { SplitButtonProps } from '../../../schema';
import { KolSplitButton } from '../component';

executeTests<SplitButtonProps>(
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/tabs/test/html.mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TabButtonProps, TabsProps, TabsStates } from '@public-ui/schema';
import type { TabButtonProps, TabsProps, TabsStates } from '../../../schema';
import { mixMembers } from 'stencil-awesome-test';
import { KolButtonGroupWcTag, KolButtonWcTag } from '../../../core/component-names';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { newSpecPage } from '@stencil/core/testing';
import { getTabsHtml } from './html.mock';

import type { SpecPage } from '@stencil/core/testing';
import type { TabsProps } from '@public-ui/schema';
import type { TabsProps } from '../../../schema';
import { KolTabs } from '../component';

executeTests<TabsProps>(
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/textarea/test/html.mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mixMembers } from 'stencil-awesome-test';
import { showExpertSlot } from '@public-ui/schema';
import { showExpertSlot } from '../../../schema';

import type { TextareaProps, TextareaStates } from '@public-ui/schema';
import type { TextareaProps, TextareaStates } from '../../../schema';
import { getRenderStates } from '../../input/controller';
import { nonce } from '../../../utils/dev.utils';
import { KolInputTag } from '../../../core/component-names';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { newSpecPage } from '@stencil/core/testing';

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

import type { TextareaProps } from '@public-ui/schema';
import type { TextareaProps } from '../../../schema';
import type { SpecPage } from '@stencil/core/testing';
import { KolTextarea } from '../component';

Expand Down

0 comments on commit e7a0510

Please sign in to comment.