Skip to content

Commit

Permalink
commented out avatar to test action
Browse files Browse the repository at this point in the history
  • Loading branch information
DE7924 committed Dec 4, 2024
1 parent 3919f2d commit 020eeaf
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions src/test/avatar/avatar.test.ts
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
import { fixture, html, expect } from "@open-wc/testing";
import type { ZetaAvatar } from "../../components/avatar/avatar.js";
import "../../components/avatar/avatar.js";
// import { fixture, html, expect } from "@open-wc/testing";
// import type { ZetaAvatar } from "../../components/avatar/avatar.js";
// import "../../components/avatar/avatar.js";

import type { ZetaIcon } from "../../components/icon/icon.js";
import type { ZetaIconIndicator } from "../../components/badges/indicators/indicators.js";
import { getSlotText } from "../utils.js";
// import type { ZetaIcon } from "../../components/icon/icon.js";
// import type { ZetaIconIndicator } from "../../components/badges/indicators/indicators.js";
// import { getSlotText } from "../utils.js";

describe("zeta-avatar", () => {
// let subject: ZetaAvatar;
// describe("zeta-avatar", () => {
// // let subject: ZetaAvatar;

// const createComponent = (template = `<zeta-avatar></zeta-avatar>`) => {
// // prettier-ignore
// return fixture<ZetaAvatar>(html`${unsafeStatic(template)}`);
// };
// // const createComponent = (template = `<zeta-avatar></zeta-avatar>`) => {
// // // prettier-ignore
// // return fixture<ZetaAvatar>(html`${unsafeStatic(template)}`);
// // };

// beforeEach(async () => {
// subject = await createComponent();
// });
// // beforeEach(async () => {
// // subject = await createComponent();
// // });

// describe("Accessibility Tests", () => {});
// // describe("Accessibility Tests", () => {});

describe("Content Tests", () => {
it("renders the avatar with a custom size", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar size="xl"></zeta-avatar>`);
await expect(avatar.size).to.equal("xl");
});
// describe("Content Tests", () => {
// it("renders the avatar with a custom size", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar size="xl"></zeta-avatar>`);
// await expect(avatar.size).to.equal("xl");
// });

it("renders the avatar with the ring", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar show-ring></zeta-avatar>`);
return expect(avatar.showRing).to.be.true;
});
// it("renders the avatar with the ring", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar show-ring></zeta-avatar>`);
// return expect(avatar.showRing).to.be.true;
// });

it("renders the avatar without the ring", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar></zeta-avatar>`);
return expect(avatar.showRing).to.be.false;
});
// it("renders the avatar without the ring", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar></zeta-avatar>`);
// return expect(avatar.showRing).to.be.false;
// });

it("renders the avatar with the close icon", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar show-close></zeta-avatar>`);
return expect(avatar.showClose).to.be.true;
});
// it("renders the avatar with the close icon", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar show-close></zeta-avatar>`);
// return expect(avatar.showClose).to.be.true;
// });

it("renders the avatar without the close icon", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar></zeta-avatar>`);
return expect(avatar.showClose).to.be.false;
});
// it("renders the avatar without the close icon", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar></zeta-avatar>`);
// return expect(avatar.showClose).to.be.false;
// });

it("renders the avatar with an image", async () => {
const url = "https://example.com/image.jpg";
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><img src=${url} /></zeta-avatar>`);
const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#CONTENT_SLOT");
const img = slot?.assignedElements()[0] as HTMLImageElement;
// it("renders the avatar with an image", async () => {
// const url = "https://example.com/image.jpg";
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><img src=${url} /></zeta-avatar>`);
// const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#CONTENT_SLOT");
// const img = slot?.assignedElements()[0] as HTMLImageElement;

expect(img).to.exist;
return await expect(img?.src).to.equal(url);
});
// expect(img).to.exist;
// return await expect(img?.src).to.equal(url);
// });

it("renders the avatar with an icon", async () => {
const iconName = "user";
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><zeta-icon>${iconName}</zeta-icon></zeta-avatar>`);
const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#CONTENT_SLOT");
const icon = slot?.assignedElements()[0] as ZetaIcon;
// it("renders the avatar with an icon", async () => {
// const iconName = "user";
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><zeta-icon>${iconName}</zeta-icon></zeta-avatar>`);
// const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#CONTENT_SLOT");
// const icon = slot?.assignedElements()[0] as ZetaIcon;

expect(icon).to.exist;
await expect(getSlotText(icon)).to.equal(iconName);
});
// expect(icon).to.exist;
// await expect(getSlotText(icon)).to.equal(iconName);
// });

it("renders the badge on the avatar", async () => {
const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><zeta-icon-indicator icon="star" slot="status"></zeta-icon-indicator></zeta-avatar>`);
const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#STATUS_SLOT");
// it("renders the badge on the avatar", async () => {
// const avatar: ZetaAvatar = await fixture(html`<zeta-avatar><zeta-icon-indicator icon="star" slot="status"></zeta-icon-indicator></zeta-avatar>`);
// const slot: HTMLSlotElement | null | undefined = avatar.shadowRoot?.querySelector("#STATUS_SLOT");

const badge = slot?.assignedElements()[0] as ZetaIconIndicator;
expect(badge).to.exist;
});
});
// const badge = slot?.assignedElements()[0] as ZetaIconIndicator;
// expect(badge).to.exist;
// });
// });

// describe("Dimensions Tests", () => {});
// // describe("Dimensions Tests", () => {});

// describe("Styling Tests", () => {});
// // describe("Styling Tests", () => {});

// describe("Interaction Tests", () => {});
// // describe("Interaction Tests", () => {});

// describe("Golden Tests", () => {});
// // describe("Golden Tests", () => {});

// describe("Performance Tests", () => {});
});
// // describe("Performance Tests", () => {});
// });

0 comments on commit 020eeaf

Please sign in to comment.