当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript testing.TestWindow类代码示例

本文整理汇总了TypeScript中@stencil/core/testing.TestWindow的典型用法代码示例。如果您正苦于以下问题:TypeScript TestWindow类的具体用法?TypeScript TestWindow怎么用?TypeScript TestWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TestWindow类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: beforeEach

 beforeEach(async () => {
   window = new TestWindow();
   element = await window.load({
     components: [MadnessEnjineer],
     html: '<madness-enjineer></madness-enjineer>'
   });
 });
开发者ID:MadnessLabs,项目名称:MadnessEnjineer,代码行数:7,代码来源:madness-enjineer.spec.ts

示例2: beforeEach

 beforeEach(async () => {
   testWindow = new TestWindow();
   element = await testWindow.load({
     components: [MyComponent],
     html: '<my-component></my-component>'
   });
 });
开发者ID:franktopel,项目名称:stencil-component-starter,代码行数:7,代码来源:my-component.spec.ts

示例3: it

  it('should pass properties down to <input>', async () => {
    const win = new TestWindow();
    const el = await win.load({
      components: [Toggle],
      html: '<ion-toggle disabled checked value="coding" name="primary"></ion-toggle>'
    }) as HTMLIonToggleElement;

    expect(el.disabled).toBe(true);
    expect(el.checked).toBe(true);
    expect(el.value).toBe('coding');
    expect(el.name).toBe('primary');

    const input = getInput(el);
    expect(input).toHaveProperties({
      disabled: true,
      checked: true,
      value: 'coding',
      name: 'primary'
    });

    el.disabled = false;
    el.checked = false;
    el.value = 'design';
    el.name = 'secondary';

    await win.flush();
    expect(input.disabled).toBe(false);
    expect(input.checked).toBe(false);
    expect(input.value).toBe('design');
    expect(input.name).toBe('secondary');
  });
开发者ID:GHernansanz,项目名称:ionic,代码行数:31,代码来源:toggle.spec.ts

示例4: describe

  describe('rendering', () => {
    let element: HTMLMyComponentElement;
    let testWindow: TestWindow;
    beforeEach(async () => {
      testWindow = new TestWindow();
      element = await testWindow.load({
        components: [MyComponent],
        html: '<my-component></my-component>'
      });
    });

    it('should work without parameters', () => {
      expect(element.textContent.trim()).toEqual('Hello, World! I\'m');
    });

    it('should work with a first name', async () => {
      element.first = 'Peter';
      await testWindow.flush();
      expect(element.textContent.trim()).toEqual('Hello, World! I\'m Peter');
    });

    it('should work with a last name', async () => {
      element.last = 'Parker';
      await testWindow.flush();
      expect(element.textContent.trim()).toEqual('Hello, World! I\'m  Parker');
    });

    it('should work with both a first and a last name', async () => {
      element.first = 'Peter';
      element.last = 'Parker';
      await testWindow.flush();
      expect(element.textContent.trim()).toEqual('Hello, World! I\'m Peter Parker');
    });
  });
开发者ID:franktopel,项目名称:stencil-component-starter,代码行数:34,代码来源:my-component.spec.ts

示例5: it

 it('should work with both a first and a last name', async () => {
   element.first = 'Peter';
   element.last = 'Parker';
   await testWindow.flush();
   expect(element.textContent.trim()).toEqual('Hello, World! I\'m Peter Parker');
 });
开发者ID:franktopel,项目名称:stencil-component-starter,代码行数:6,代码来源:my-component.spec.ts


注:本文中的@stencil/core/testing.TestWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。