import{newE2EPage}from"@stencil/core/testing";describe("sc-button",(()=>{let t,a,e;const i="sc-button";beforeEach((async()=>{t=await newE2EPage(),await t.setContent(`<${i}></${i}>`),a=await t.find(`${i}`),e=await t.find(`${i} >>> .button`)})),it("renders",(async()=>{const t=await newE2EPage();await t.setContent("<sc-button></sc-button>");const a=await t.find("sc-button");expect(a).toHaveClass("hydrated")})),it("Has types",(async()=>{expect(e).toHaveClass("button--default"),await t.$eval(i,(t=>{t.type="primary"})),await t.waitForChanges(),expect(e).toHaveClass("button--primary"),await t.$eval(i,(t=>{t.type="success"})),await t.waitForChanges(),expect(e).toHaveClass("button--success"),await t.$eval(i,(t=>{t.type="info"})),await t.waitForChanges(),expect(e).toHaveClass("button--info"),await t.$eval(i,(t=>{t.type="warning"})),await t.waitForChanges(),expect(e).toHaveClass("button--warning"),await t.$eval(i,(t=>{t.type="danger"})),await t.waitForChanges(),expect(e).toHaveClass("button--danger"),await t.$eval(i,(t=>{t.type="text"})),await t.waitForChanges(),expect(e).toHaveClass("button--text")})),it("Has sizes",(async()=>{expect(e).toHaveClass("button--medium"),await t.$eval(i,(t=>{t.size="large"})),await t.waitForChanges(),expect(e).toHaveClass("button--large"),await t.$eval(i,(t=>{t.size="small"})),await t.waitForChanges(),expect(e).toHaveClass("button--small")})),it("Can be full",(async()=>{await t.$eval(i,(t=>{t.full=!0})),await t.waitForChanges(),expect(a.hasAttribute("full"))})),it("Can be disabled",(async()=>{expect(e).not.toHaveClass("button--disabled"),await t.$eval(i,(t=>{t.disabled=!0})),await t.waitForChanges(),expect(e).toHaveClass("button--disabled"),expect(e).toHaveAttribute("disabled")})),it("Can be loading",(async()=>{expect(e).not.toHaveClass("button--loading"),await t.$eval(i,(t=>{t.loading=!0})),await t.waitForChanges();const a=await t.find(`${i} >>> sc-spinner`);let s=await a.isVisible();expect(s).toBe(!0),expect(e).toHaveClass("button--loading")})),it("Can be pill",(async()=>{expect(e).not.toHaveClass("button--pill"),await t.$eval(i,(t=>{t.pill=!0})),await t.waitForChanges(),expect(e).toHaveClass("button--pill")})),it("Can be circle",(async()=>{expect(e).not.toHaveClass("button--circle"),await t.$eval(i,(t=>{t.circle=!0})),await t.waitForChanges(),expect(e).toHaveClass("button--circle")})),it("Can be type submit",(async()=>{expect(e.getAttribute("type")).toBe("button"),await t.$eval(i,(t=>{t.submit=!0})),await t.waitForChanges(),expect(e.getAttribute("type")).toBe("submit")})),it("Can have a name",(async()=>{expect(e.getAttribute("name")).toBe(null),await t.$eval(i,(t=>{t.name="Test"})),await t.waitForChanges(),expect(e.getAttribute("name")).toBe("Test")})),it("Can have a value",(async()=>{expect(e.getAttribute("value")).toBe(null),await t.$eval(i,(t=>{t.value="Test"})),await t.waitForChanges(),expect(e.getAttribute("value")).toBe("Test")})),it("Can be a link",(async()=>{expect(e.getAttribute("href")).toBe(null),await t.$eval(i,(t=>{t.href="https://google.com",t.target="_blank",t.download="test"})),await t.waitForChanges();const a=await t.find(`${i} >>> a.button`);let s=await a.isVisible();expect(s).toBe(!0),expect(a.getAttribute("href")).toBe("https://google.com"),expect(a.getAttribute("target")).toBe("_blank"),expect(a.getAttribute("download")).toBe("test")})),it("Can be focused and blurred",(async()=>{const a=await t.spyOnEvent("scBlur"),s=await t.spyOnEvent("scFocus");expect(e).not.toHaveClass("button--focused"),await e.focus(),await t.waitForChanges(),expect(e).toHaveClass("button--focused"),expect(s).toHaveReceivedEvent(),await t.$eval(i,(t=>t.blur())),await t.waitForChanges(),expect(e).not.toHaveClass("button--focused"),expect(a).toHaveReceivedEvent()}))}));