FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
collection
/
components
/
ui
/
radio
/
test
Edit File: sc-radio.e2e.js
import{newE2EPage}from"@stencil/core/testing";describe("sc-radio",(()=>{let a,e,t,i;const s="sc-radio";beforeEach((async()=>{a=await newE2EPage(),await a.setContent(`<${s}></${s}>`),e=await a.find(`${s}`),t=await a.find(`${s} >>> .radio`),i=await a.find(`${s} >>> input`)})),it("renders",(async()=>{const a=await newE2EPage();await a.setContent("<sc-radio></sc-radio>");const e=await a.find(s);expect(e).toHaveClass("hydrated")})),it("Should be clickable",(async()=>{i=await a.find(`${s} >>> input`);const e=await a.spyOnEvent("scBlur"),o=await a.spyOnEvent("scFocus");expect(t).toHaveClass("radio"),expect(t).not.toHaveClasses(["radio--checked","radio--focused"]),await i.click(),await a.waitForChanges(),t=await a.find(`${s} >>> .radio`),expect(t).toHaveClass("radio"),expect(t).toHaveClasses(["radio--checked","radio--focused"]),expect(o).toHaveReceivedEvent(),await a.$eval(s,(a=>a.blur())),await a.waitForChanges(),t=await a.find(`${s} >>> .radio`),expect(t).not.toHaveClass("radio--focused"),expect(e).toHaveReceivedEvent()})),it("Can be disabled",(async()=>{i=await a.find(`${s} >>> input`),expect(i).not.toHaveAttribute("disabled"),e.setProperty("disabled",!0),await a.waitForChanges(),t=await a.find(`${s} >>> .radio`),i=await a.find(`${s} >>> input`),expect(t).toHaveClasses(["radio","radio--disabled"]),expect(i).toHaveAttribute("disabled")}))}));
Save
Back