diff --git a/web/src/elements/stories/Alert.test.ts b/web/src/elements/stories/Alert.test.ts deleted file mode 100644 index 099f6345c2..0000000000 --- a/web/src/elements/stories/Alert.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { $, expect } from "@wdio/globals"; - -import { html, render } from "lit"; - -import "../Alert.js"; -import { Level } from "../Alert.js"; - -describe("ak-alert", () => { - it("should render an alert with the enum", async () => { - render(html`This is an alert`, document.body); - - await expect(await $("ak-alert").$(">>>div")).not.toHaveElementClass("pf-m-inline"); - await expect(await $("ak-alert").$(">>>div")).toHaveElementClass("pf-c-alert"); - await expect(await $("ak-alert").$(">>>div")).toHaveElementClass("pf-m-info"); - await expect(await $("ak-alert").$(">>>.pf-c-alert__title")).toHaveText("This is an alert"); - }); - - it("should render an alert with the attribute", async () => { - render(html`This is an alert`, document.body); - await expect(await $("ak-alert").$(">>>div")).toHaveElementClass("pf-m-info"); - await expect(await $("ak-alert").$(">>>.pf-c-alert__title")).toHaveText("This is an alert"); - }); - - it("should render an alert with an inline class and the default level", async () => { - render(html`This is an alert`, document.body); - await expect(await $("ak-alert").$(">>>div")).toHaveElementClass("pf-m-warning"); - await expect(await $("ak-alert").$(">>>div")).toHaveElementClass("pf-m-inline"); - await expect(await $("ak-alert").$(">>>.pf-c-alert__title")).toHaveText("This is an alert"); - }); -}); diff --git a/web/src/elements/stories/Divider.test.ts b/web/src/elements/stories/Divider.test.ts deleted file mode 100644 index 3f87da04d9..0000000000 --- a/web/src/elements/stories/Divider.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ensureCSSStyleSheet } from "@goauthentik/elements/utils/ensureCSSStyleSheet.js"; -import { $, expect } from "@wdio/globals"; - -import { TemplateResult, html, render as litRender } from "lit"; - -import AKGlobal from "@goauthentik/common/styles/authentik.css"; -import PFBase from "@patternfly/patternfly/patternfly-base.css"; - -import "../Divider.js"; - -const render = (body: TemplateResult) => { - document.adoptedStyleSheets = [ - ...document.adoptedStyleSheets, - ensureCSSStyleSheet(PFBase), - ensureCSSStyleSheet(AKGlobal), - ]; - return litRender(body, document.body); -}; - -describe("ak-divider", () => { - it("should render the divider", async () => { - render(html``); - const empty = await $("ak-divider"); - await expect(empty).toExist(); - }); - - it("should render the divider with the specified text", async () => { - render(html`Your Message Here`); - const span = await $("ak-divider").$("span"); - await expect(span).toExist(); - await expect(span).toHaveText("Your Message Here"); - }); -}); diff --git a/web/src/elements/stories/EmptyState.test.ts b/web/src/elements/stories/EmptyState.test.ts deleted file mode 100644 index 35c2cdacfc..0000000000 --- a/web/src/elements/stories/EmptyState.test.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { ensureCSSStyleSheet } from "@goauthentik/elements/utils/ensureCSSStyleSheet.js"; -import { $, expect } from "@wdio/globals"; - -import { msg } from "@lit/localize"; -import { TemplateResult, html, render as litRender } from "lit"; - -import AKGlobal from "@goauthentik/common/styles/authentik.css"; -import PFBase from "@patternfly/patternfly/patternfly-base.css"; - -import "../EmptyState.js"; - -const render = (body: TemplateResult) => { - document.adoptedStyleSheets = [ - ...document.adoptedStyleSheets, - ensureCSSStyleSheet(PFBase), - ensureCSSStyleSheet(AKGlobal), - ]; - return litRender(body, document.body); -}; - -describe("ak-empty-state", () => { - it("should render the default loader", async () => { - render(html` `); - - const empty = await $("ak-empty-state").$(">>>.pf-c-empty-state__icon"); - await expect(empty).toExist(); - - const header = await $("ak-empty-state").$(">>>.pf-c-title"); - await expect(header).toHaveText("Loading"); - }); - - it("should handle standard boolean", async () => { - render(html` `); - - const empty = await $("ak-empty-state").$(">>>.pf-c-empty-state__icon"); - await expect(empty).toExist(); - - const header = await $("ak-empty-state").$(">>>.pf-c-title"); - await expect(header).toHaveText("Loading"); - }); - - it("should render a static empty state", async () => { - render(html` `); - - const empty = await $("ak-empty-state").$(">>>.pf-c-empty-state__icon"); - await expect(empty).toExist(); - await expect(empty).toHaveClass("fa-question-circle"); - - const header = await $("ak-empty-state").$(">>>.pf-c-title"); - await expect(header).toHaveText("No messages found"); - }); - - it("should render a slotted message", async () => { - render( - html` -

Try again with a different filter

-
`, - ); - - const message = await $("ak-empty-state").$(">>>.pf-c-empty-state__body").$(">>>p"); - await expect(message).toHaveText("Try again with a different filter"); - }); -}); diff --git a/web/src/elements/stories/Expand.test.ts b/web/src/elements/stories/Expand.test.ts deleted file mode 100644 index 3fe64a911d..0000000000 --- a/web/src/elements/stories/Expand.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { ensureCSSStyleSheet } from "@goauthentik/elements/utils/ensureCSSStyleSheet.js"; -import { $, expect } from "@wdio/globals"; - -import { TemplateResult, html, render as litRender } from "lit"; - -import AKGlobal from "@goauthentik/common/styles/authentik.css"; -import PFBase from "@patternfly/patternfly/patternfly-base.css"; - -import "../Expand.js"; - -const render = (body: TemplateResult) => { - document.adoptedStyleSheets = [ - ...document.adoptedStyleSheets, - ensureCSSStyleSheet(PFBase), - ensureCSSStyleSheet(AKGlobal), - ]; - return litRender(body, document.body); -}; - -describe("ak-expand", () => { - it("should render the expansion content hidden by default", async () => { - render(html`

This is the expanded text

`); - const text = await $("ak-expand").$(">>>.pf-c-expandable-section__content"); - await expect(text).not.toBeDisplayed(); - }); - - it("should render the expansion content visible on demand", async () => { - render(html`

This is the expanded text

`); - const paragraph = await $("ak-expand").$(">>>p"); - await expect(paragraph).toExist(); - await expect(paragraph).toBeDisplayed(); - await expect(paragraph).toHaveText("This is the expanded text"); - }); - - it("should respond to the click event", async () => { - render(html`

This is the expanded text

`); - let content = await $("ak-expand").$(">>>.pf-c-expandable-section__content"); - await expect(content).toExist(); - await expect(content).not.toBeDisplayed(); - const control = await $("ak-expand").$(">>>button"); - - await control.click(); - content = await $("ak-expand").$(">>>.pf-c-expandable-section__content"); - await expect(content).toExist(); - await expect(content).toBeDisplayed(); - - await control.click(); - content = await $("ak-expand").$(">>>.pf-c-expandable-section__content"); - await expect(content).toExist(); - await expect(content).not.toBeDisplayed(); - }); -}); diff --git a/web/src/elements/stories/Label.test.ts b/web/src/elements/stories/Label.test.ts deleted file mode 100644 index 99ba4ef922..0000000000 --- a/web/src/elements/stories/Label.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { $, expect } from "@wdio/globals"; - -import { html, render } from "lit"; - -import "../Label.js"; -import { PFColor } from "../Label.js"; - -describe("ak-label", () => { - it("should render a label with the enum", async () => { - render(html`This is a label`, document.body); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass("pf-c-label"); - await expect(await $("ak-label").$(">>>span.pf-c-label")).not.toHaveElementClass( - "pf-m-compact", - ); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass("pf-m-red"); - await expect(await $("ak-label").$(">>>i.fas")).toHaveElementClass("fa-times"); - await expect(await $("ak-label").$(">>>.pf-c-label__content")).toHaveText( - "This is a label", - ); - }); - - it("should render a label with the attribute", async () => { - render(html`This is a label`, document.body); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass("pf-m-green"); - await expect(await $("ak-label").$(">>>.pf-c-label__content")).toHaveText( - "This is a label", - ); - }); - - it("should render a compart label with the default level", async () => { - render(html`This is a label`, document.body); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass("pf-m-grey"); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass( - "pf-m-compact", - ); - await expect(await $("ak-label").$(">>>i.fas")).toHaveElementClass("fa-info-circle"); - await expect(await $("ak-label").$(">>>.pf-c-label__content")).toHaveText( - "This is a label", - ); - }); - - it("should render a compact label with an icon and the default level", async () => { - render(html`This is a label`, document.body); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass("pf-m-grey"); - await expect(await $("ak-label").$(">>>span.pf-c-label")).toHaveElementClass( - "pf-m-compact", - ); - await expect(await $("ak-label").$(">>>.pf-c-label__content")).toHaveText( - "This is a label", - ); - await expect(await $("ak-label").$(">>>i.fas")).toHaveElementClass("fa-coffee"); - }); -});