-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", () => {}); | ||
// }); |