jest.mock("@store/checkouts/store",(()=>({__esModule:!0,default:{state:{live:{},test:{}},set:jest.fn(),get:jest.fn(),onChange:jest.fn(),on:jest.fn(),dispose:jest.fn()},state:{live:{},test:{}},set:jest.fn(),get:jest.fn(),onChange:jest.fn(),on:jest.fn(),dispose:jest.fn()})));import{h}from"@stencil/core";import{newSpecPage}from"@stencil/core/testing";import{ScOrderTaxIdInput}from"../sc-order-tax-id-input";import{state as checkoutState,dispose as disposeCheckout}from"../../../../../store/checkout/index";beforeEach((()=>{disposeCheckout()})),describe("sc-order-tax-id-input",(()=>{it("renders",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],html:"<sc-order-tax-id-input></sc-order-tax-id-input>"});expect(t.root).toMatchSnapshot()})),it("Renders UK VAT Tax Type",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",null)});checkoutState.checkout={id:"test",shipping_address:{country:"GB"}},await t.waitForChanges(),expect(t.root).toMatchSnapshot()})),it("Renders EU VAT Tax Type",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",null)});checkoutState.checkout={id:"test",shipping_address:{country:"DE"}},await t.waitForChanges(),expect(t.root).toMatchSnapshot()})),it("Renders CA Tax Type",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",null)});checkoutState.checkout={id:"test",shipping_address:{country:"CA"}},await t.waitForChanges(),expect(t.root).toMatchSnapshot()})),it("Renders AU Tax Type",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",null)});checkoutState.checkout={id:"test",shipping_address:{country:"AU"}},await t.waitForChanges(),expect(t.root).toMatchSnapshot()})),it("Defaults to type and number first",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",null)});checkoutState.checkout={id:"test",shipping_address:{country:"AU"},tax_identifier:{number:"123",number_type:"eu_vat"}},await t.waitForChanges(),expect(t.root).toMatchSnapshot()})),it("Renders with Help Text",(async()=>{const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",{helpText:"Enter your tax identifier"})});expect(t.root).toMatchSnapshot()})),it("Should be required when required prop is true",(async()=>{const t=(await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",{required:!0})})).root.shadowRoot.querySelector("sc-tax-id-input");expect(t.getAttribute("required")).not.toBeNull()})),it("Should respect EU VAT protocol when required is false and eu_vat is selected",(async()=>{checkoutState.taxProtocol={eu_vat_required:!0},checkoutState.checkout={id:"test",tax_identifier:{number_type:"eu_vat"}};const t=await newSpecPage({components:[ScOrderTaxIdInput],template:()=>h("sc-order-tax-id-input",{required:!1})});await t.waitForChanges();const e=t.root.shadowRoot.querySelector("sc-tax-id-input");expect(e.getAttribute("required")).not.toBeNull()}))}));