/
dimamir
/
authentik
Обзор
Документация
Войти
/
dimamir
/
authentik
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
web/src/elements/tests/ak-array-input.test.ts
55 строк
2 KB
Ken Sternberg
web/admin: better footer links (#12004)
18 ноя 2024, 15:17
Не верифицирован
18 ноя 2024, 15:17
ac00386
Код
Авторство
О чём код?
import "@goauthentik/admin/admin-settings/AdminSettingsFooterLinks.js"; import { render } from "@goauthentik/elements/tests/utils.js"; import { $, expect } from "@wdio/globals"; import { html } from "lit"; import { FooterLink } from "@goauthentik/api"; import "../ak-array-input.js"; const sampleItems: FooterLink[] = [ { name: "authentik", href: "https://goauthentik.io" }, { name: "authentik docs", href: "https://docs.goauthentik.io/docs/" }, ]; describe("ak-array-input", () => { afterEach(async () => { await browser.execute(async () => { await document.body.querySelector("ak-array-input")?.remove(); if (document.body["_$litPart$"]) { // @ts-expect-error expression of type '"_$litPart$"' is added by Lit await delete document.body["_$litPart$"]; } }); }); const component = (items: FooterLink[] = []) => render( html` <ak-array-input id="ak-array-input" .items=${items} .newItem=${() => ({ name: "", href: "" })} .row=${(f?: FooterLink) => html`<ak-admin-settings-footer-link name="footerLink" .footerLink=${f}> </ak-admin-settings-footer-link>`} validate ></ak-array-input>`, ); it("should render an empty control", async () => { await component(); const link = await $("ak-array-input"); await browser.pause(500); await expect(await link.getProperty("isValid")).toStrictEqual(true); await expect(await link.getProperty("toJson")).toEqual([]); }); it("should render a populated component", async () => { await component(sampleItems); const link = await $("ak-array-input"); await browser.pause(500); await expect(await link.getProperty("isValid")).toStrictEqual(true); await expect(await link.getProperty("toJson")).toEqual(sampleItems); }); });