import{newE2EPage}from"@stencil/core/testing";describe("sc-form",(()=>{it("renders",(async()=>{const e=await newE2EPage();await e.setContent("<sc-form></sc-form>");const c=await e.find("sc-form");expect(c).toHaveClass("hydrated")})),it("Submits data",(async()=>{const e=await newE2EPage();await e.setContent('\n    <sc-form>\n      <sc-input name="name" value="Tester"></sc-input>\n      <button type="submit">Test</button>\n      <sc-button submit>Test CE</sc-button>\n    </sc-form>\n    ');const c=await e.find("sc-form"),s=await c.spyOnEvent("scFormSubmit"),t=await c.spyOnEvent("scSubmit"),a=await e.find("sc-button");await a.click(),await e.waitForChanges(),expect(t).toHaveReceivedEventTimes(1),expect(s).toHaveReceivedEventTimes(1)})),it("Serializes data",(async()=>{const e=await newE2EPage();await e.setContent('\n    <sc-form>\n      <sc-input name="ce_input" value="CE Input"></sc-input>\n      <sc-switch name="ce_switch" value="switch" checked></sc-switch>\n      <sc-radio-group>\n        <sc-radio value="CE Radio" name="ce_radio" checked></sc-radio>\n        <sc-radio value="Invalid" name="ce_radio"></sc-radio>\n      </sc-radio-group>\n      <sc-checkbox value="CE Checkbox" name="ce_checkbox" checked></sc-checkbox>\n      <sc-choices>\n        <sc-choice value="CE Choice" name="ce_choice" checked></sc-choice>\n        <sc-choice value="Invalid" name="ce_choice"></sc-choice>\n      </sc-choices>\n      <sc-choices>\n        <sc-choice value="CE Choice Check" name="ce_check_choice" checked type="checkbox"></sc-choice>\n        <sc-choice value="CE Choice Check 1" name="ce_check_choice_1" checked type="checkbox"></sc-choice>\n      </sc-choices>\n\n      <sc-select value="CE Select" name="ce_select"></sc-select>\n\n      \x3c!-- Order form fields --\x3e\n      <sc-customer-name value="Testy McTesterson"></sc-customer-name>\n      <sc-customer-email value="order@email.com"></sc-customer-email>\n      <sc-customer-phone value="0987654321"></sc-customer-phone>\n      <sc-order-shipping-address></sc-order-shipping-address>\n      <sc-order-tax-id-input></sc-order-tax-id-input>\n      <sc-order-password value="pass"></sc-order-password>\n    </sc-form>\n    ');const c=await e.find("sc-form"),s=await e.find("sc-order-shipping-address");s.setProperty("shippingEnabled",!0),await e.waitForChanges(),s.setProperty("shippingAddress",{id:"test",country:"US",city:"Monona",line_1:"303 Park Ave",line_2:null,postal_code:"12345",state:"WI"}),await e.waitForChanges();const t=await c.callMethod("getFormJson");expect(t).toEqual({ce_input:"CE Input",ce_switch:"switch",ce_radio:"CE Radio",ce_select:"CE Select",ce_checkbox:"CE Checkbox",ce_choice:"CE Choice",ce_check_choice:"CE Choice Check",ce_check_choice_1:"CE Choice Check 1",email:"order@email.com",name:"Testy McTesterson",phone:"0987654321",password:"pass","tax_identifier.number_type":"other"})}))}));