Skip to content

Commit

Permalink
chore(wdio): migrate slot-no-default to wdio (#5573)
Browse files Browse the repository at this point in the history
port the `test/karma/test-app/slot-no-default` test suite to webdriverio

git history has been preserved as much as possible here, using `git mv`
to move files from the `karma` dir to `wdio/` in all possible cases.
however, git may fail to mark some files as 'moved' if we change a file
enough that it exceeds git's "sameness threshold".

STENCIL-1191
  • Loading branch information
rwaskiewicz authored Mar 22, 2024
1 parent 903ce14 commit 05205f8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 55 deletions.
13 changes: 0 additions & 13 deletions test/karma/test-app/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ export namespace Components {
}
interface SlotNgIf {
}
interface SlotNoDefault {
}
interface SlotReplaceWrapper {
"href"?: string;
}
Expand Down Expand Up @@ -159,12 +157,6 @@ declare global {
prototype: HTMLSlotNgIfElement;
new (): HTMLSlotNgIfElement;
};
interface HTMLSlotNoDefaultElement extends Components.SlotNoDefault, HTMLStencilElement {
}
var HTMLSlotNoDefaultElement: {
prototype: HTMLSlotNoDefaultElement;
new (): HTMLSlotNoDefaultElement;
};
interface HTMLSlotReplaceWrapperElement extends Components.SlotReplaceWrapper, HTMLStencilElement {
}
var HTMLSlotReplaceWrapperElement: {
Expand Down Expand Up @@ -213,7 +205,6 @@ declare global {
"slot-nested-default-order-child": HTMLSlotNestedDefaultOrderChildElement;
"slot-nested-default-order-parent": HTMLSlotNestedDefaultOrderParentElement;
"slot-ng-if": HTMLSlotNgIfElement;
"slot-no-default": HTMLSlotNoDefaultElement;
"slot-replace-wrapper": HTMLSlotReplaceWrapperElement;
"slot-replace-wrapper-root": HTMLSlotReplaceWrapperRootElement;
"stencil-sibling": HTMLStencilSiblingElement;
Expand Down Expand Up @@ -258,8 +249,6 @@ declare namespace LocalJSX {
}
interface SlotNgIf {
}
interface SlotNoDefault {
}
interface SlotReplaceWrapper {
"href"?: string;
}
Expand Down Expand Up @@ -289,7 +278,6 @@ declare namespace LocalJSX {
"slot-nested-default-order-child": SlotNestedDefaultOrderChild;
"slot-nested-default-order-parent": SlotNestedDefaultOrderParent;
"slot-ng-if": SlotNgIf;
"slot-no-default": SlotNoDefault;
"slot-replace-wrapper": SlotReplaceWrapper;
"slot-replace-wrapper-root": SlotReplaceWrapperRoot;
"stencil-sibling": StencilSibling;
Expand Down Expand Up @@ -318,7 +306,6 @@ declare module "@stencil/core" {
"slot-nested-default-order-child": LocalJSX.SlotNestedDefaultOrderChild & JSXBase.HTMLAttributes<HTMLSlotNestedDefaultOrderChildElement>;
"slot-nested-default-order-parent": LocalJSX.SlotNestedDefaultOrderParent & JSXBase.HTMLAttributes<HTMLSlotNestedDefaultOrderParentElement>;
"slot-ng-if": LocalJSX.SlotNgIf & JSXBase.HTMLAttributes<HTMLSlotNgIfElement>;
"slot-no-default": LocalJSX.SlotNoDefault & JSXBase.HTMLAttributes<HTMLSlotNoDefaultElement>;
"slot-replace-wrapper": LocalJSX.SlotReplaceWrapper & JSXBase.HTMLAttributes<HTMLSlotReplaceWrapperElement>;
"slot-replace-wrapper-root": LocalJSX.SlotReplaceWrapperRoot & JSXBase.HTMLAttributes<HTMLSlotReplaceWrapperRootElement>;
"stencil-sibling": LocalJSX.StencilSibling & JSXBase.HTMLAttributes<HTMLStencilSiblingElement>;
Expand Down
12 changes: 0 additions & 12 deletions test/karma/test-app/slot-no-default/index.html

This file was deleted.

30 changes: 0 additions & 30 deletions test/karma/test-app/slot-no-default/karma.spec.ts

This file was deleted.

28 changes: 28 additions & 0 deletions test/wdio/slot-no-default/cmp.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { h } from '@stencil/core';
import { render } from '@wdio/browser-runner/stencil';

describe('slot-no-default', () => {
beforeEach(async () => {
render({
template: () => (
<slot-no-default>
<a slot="a-slot-name">A-Show</a>
<header slot="header-slot-name">Header-No-Show</header>
<main>Default-Slot-No-Show</main>
<nav slot="nav-slot-name">Nav-Show</nav>
<footer slot="footer-slot-name">Footer-Show</footer>
</slot-no-default>
),
});

await $('slot-no-default').waitForExist();
});

it('only renders slots that have a location', async () => {
await expect($('slot-no-default a')).not.toHaveAttribute('hidden');
await expect($('slot-no-default header')).toHaveAttribute('hidden', 'true');
await expect($('slot-no-default main')).toHaveAttribute('hidden', 'true');
await expect($('slot-no-default nav')).not.toHaveAttribute('hidden');
await expect($('slot-no-default footer')).not.toHaveAttribute('hidden');
});
});
File renamed without changes.

0 comments on commit 05205f8

Please sign in to comment.