How to use the @open-wc/testing-helpers.unsafeStatic function in @open-wc/testing-helpers

To help you get started, we’ve selected a few @open-wc/testing-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github corpusculejs / corpuscule / packages / form / __tests__ / form.ts View on Github external
@form()
      class Test extends CustomElement {
        @gear() public readonly formApi!: FormApi;
        @gear() public readonly state!: FormState;

        @option()
        public initialValues: object = {
          bar: 2,
          foo: 1,
        };

        @option()
        public onSubmit(): void {}
      }

      const tag = unsafeStatic(defineCE(Test));
      await fixture(
        html`<${tag} .initialValues="${{
          bar: 3,
          foo: 3,
        }}">`,
      );

      expect(formSpyObject.initialize).toHaveBeenCalledWith({
        bar: 3,
        foo: 3,
      });
    });
github corpusculejs / corpuscule / packages / form / __tests__ / field.ts View on Github external
@option()
        public onSubmit(): void {}
      }

      @field()
      class Field extends CustomElement {
        @gear() public readonly formApi!: FormApi;
        @gear() public readonly input!: FieldInputProps;
        @gear() public readonly meta!: FieldMetaProps;

        @option() public readonly name: string = 'test';
      }

      const formTag = unsafeStatic(defineCE(Form));
      const fieldTag = unsafeStatic(defineCE(Field));

      const validate = value => (value ? undefined : 'Required');

      await fixture(html`
        <${formTag}>
          <${fieldTag} .validate="${validate}">
        
      `);

      expect(scheduler).not.toHaveBeenCalled();
    });
github corpusculejs / corpuscule / packages / form / __tests__ / field.ts View on Github external
@gear() public readonly state!: FormState;

        @option()
        public onSubmit(): void {}
      }

      @field()
      class Field extends CustomElement {
        @gear() public readonly formApi!: FormApi;
        @gear() public readonly input!: FieldInputProps;
        @gear() public readonly meta!: FieldMetaProps;

        @option() public readonly name: string = 'test';
      }

      const formTag = unsafeStatic(defineCE(Form));
      const fieldTag = unsafeStatic(defineCE(Field));

      const validate = value => (value ? undefined : 'Required');

      await fixture(html`
        <${formTag}>
          <${fieldTag} .validate="${validate}">
        
      `);

      expect(scheduler).not.toHaveBeenCalled();
    });