// Mockup https://www.figma.com/design/zsq2ahat30acTnumyy9aqC/00.Small-System?node-id=1104-23604&m=dev /* * Expect named slots (icon, label) or attributes (icon, label) * Can have a active attribute * Should emit a click event if defined */ import { html } from "lit"; import "~icons/mingcute/file-search-line"; describe("", () => { it("should mount", () => { cy.mount(html``); cy.get("tems-dropdown-item").should("exist"); }); const defaultLabel = "Label"; const defaultIcon = html``; const defaultIconAsSlot = html``; it("should display label", () => { cy.mount( html``, ); cy.get("tems-dropdown-item").contains(defaultLabel); }); it("should handle active attribute", () => { cy.mount( html``, ); cy.get("tems-dropdown-item") .find("button") .should("have.css", "background-color", "rgb(255, 255, 255)"); cy.mount( html``, ); cy.get("tems-dropdown-item") .find("button") .should("have.css", "background-color", "rgb(255, 33, 242)"); }); it("should handle icon attribute", () => { cy.mount( html``, ); cy.get("tems-dropdown-item") .find("button") .find("icon-mingcute-file-search-line") .should("exist"); }); it("should accept slots", () => { cy.mount( html`${defaultLabel}`, ); cy.get("tems-dropdown-item").find("button").find("slot").should("exist"); }); it("should accept named slots", () => { cy.mount( html`${defaultLabel}`, ); cy.get("tems-dropdown-item") .find("button") .find("slot[name='label']") .should("exist"); cy.mount( html`${defaultIconAsSlot}`, ); cy.get("tems-dropdown-item") .find("button") .find("slot[name='icon']") .should("exist"); cy.mount( html`${defaultLabel}${defaultIconAsSlot}`, ); cy.get("tems-dropdown-item").find("button").as("button"); cy.get("@button").find("slot[name='label']").should("exist"); cy.get("@button").find("slot[name='label']").should("exist"); }); });