當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。