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


TypeScript QUnit.module函数代码示例

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


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

示例1: module

module('Acceptance | Settings | Relays', function(hooks) {
  setupApplicationTest(hooks);
  clearLocalStorage(hooks);
  setupRelayConnectionMocks(hooks);

  let path = '/settings/danger-zone';

  module('when not logged in', function(hooks) {
    hooks.beforeEach(async function() {
      await visit(path);
    });

    test('is redirected to setup', function(assert) {
      assert.equal(currentURL(), '/setup/new');
    });
  });

  module('when logged in', function(hooks) {
    setupCurrentUser(hooks);

    hooks.beforeEach(async function() {
      await visit(path);
    });

    test('delete messages button is visible', function(assert) {
      assert.ok(page.deleteMessages.isVisible, 'button is visible');
    });
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:29,代码来源:-acceptance-test.ts

示例2: module

  module('image / thumbnail preview', function() {
    module('there is no image in the og data', function(hooks) {
      hooks.beforeEach(async function(this: TestContext) {
        this.set('data', {});
        await render(hbs`{{chat-history/message/embedded-resource/metadata-preview}}`);
      });

      test('no image is shown', function(assert) {
        const img = find('img');

        assert.notOk(img);
      });
    });

    module('there is an image in the og data', function(hooks) {
      hooks.beforeEach(async function(this: TestContext) {
        this.set('data', {
          image: 'https://something',
        });

        await render(hbs`
                     {{chat-history/message/embedded-resource/metadata-preview
                      ogData=data
                     }}
                     `);
      });

      test('an image tag is present', function(assert) {
        const img = find('img');

        assert.ok(img, 'the html tag is present');
        assert.equal(img!.getAttribute('alt'), 'Thumbnail', 'has alt text');
      });
    });
  });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:35,代码来源:-integration-test.ts

示例3: module

          module('the view has settled', function(hooks) {
            hooks.beforeEach(async function() {
              await settled();
            });

            test('there is 1 message in the history window', function(assert) {
              const result = chat.messages.all().length;

              assert.equal(result, 1);
              assert.equal(page.messages.length, 1, 'there is 1 message in the history window');
            });

            test('the message is shown, but with an error', function(assert) {
              const messages = chat.messages.all();
              const confirmations = chat.messages.confirmationsFor(messages[0]);
              const loader = chat.messages.loaderFor(messages[0]);
              const text = confirmations.map(c => c.textContent).join();

              assert.notOk(loader, 'loader is no longer present');
              assert.ok(text.includes('could not be delivered'));

              percySnapshot(assert as any);
            });

            module('resend is clicked', function() {
              skip('implement tests for resending');
            });

            module('auto-resend is clicked', function(hooks) {
              hooks.beforeEach(async function() {
                await page.messages.objectAt(0).confirmations.autosend();
              });

              test('the message is queued for resend', async function(assert) {
                const store = getService<StoreService>('store');
                const messages = await store.query('message', { queueForResend: true });

                assert.equal(messages.length, 1, 'there should only be one queued message');

                percySnapshot(assert as any);
              });

              test('the confirmation action area shows that autosend is now pending', function(assert) {
                const text = page.messages.objectAt(0).confirmations.text;

                assert.notOk(
                  text.match(/resend automatically/),
                  'does not show the resend automatically link'
                );

                assert.ok(text.match(/autosend pending/), 'shows that autosend is pending');
              });
            });
          });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:54,代码来源:-acceptance-test.ts

示例4: module

  module('is not logged in and visits /login', function(hooks) {
    hooks.beforeEach(async function() {
      await visit('/login');
    });

    test('is not redirected', function(assert) {
      assert.equal(currentURL(), '/login');
      percySnapshot(assert as any);
    });

    behaviors.invalid.clickLogin();

    module('the name field is filled in', function(hooks) {
      hooks.beforeEach(async function() {
        await loginForm.typeName('NullVoxPopuli');
      });

      behaviors.invalid.clickLogin();
    });

    module('the mnemonic is filled in', function(hooks) {
      hooks.beforeEach(async function() {
        await loginForm.typeMnemonic('this is fake');
      });

      behaviors.invalid.clickLogin();
    });

    module('both name and mnemonic are filled in', function() {
      module('with valid values', function(hooks) {
        hooks.beforeEach(async function() {
          const mnemonic = await mnemonicFromNaClBoxPrivateKey(samplePrivateKey);
          await loginForm.typeName('NullVoxPopuli');
          await loginForm.typeMnemonic(mnemonic);
          await loginForm.submit();
        });

        test('redirects to chat', function(assert) {
          assert.equal(currentURL(), '/chat');
          percySnapshot(assert as any);
        });

        test('sets the "me" user', function(assert) {
          const store = getService<DS.Store>('store');
          const known = store.peekAll('user');

          assert.equal(known.length, 1);
          assert.equal(known.toArray()[0].id, 'me');
        });
      });
    });
  });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:52,代码来源:acceptance-test.ts

示例5: module

module('Acceptance | Logout', function(hooks) {
  setupApplicationTest(hooks);
  clearLocalStorage(hooks);
  setupRelayConnectionMocks(hooks);

  module('When not logged in', function(hooks) {
    hooks.beforeEach(async function() {
      stubService('currentUser', {
        isLoggedIn: false,
        load() {},
        exists: () => false,
      });

      await visit('/logout');
    });

    test('redirects to setup', function(assert) {
      assert.equal(currentURL(), '/setup/new');
      assertExternal(assert as any);
    });
  });

  module('When logged in', function(hooks) {
    setupCurrentUser(hooks);

    hooks.beforeEach(async function() {
      await visit('/');
    });

    module('user dropdown is open', function(hooks) {
      hooks.beforeEach(async function() {
        await app.userDropdown.open();
      });

      test('shows the logout button', function(assert) {
        assert.ok(app.userDropdown.logoutButton());
        assertExternal(assert as any);
      });

      module('clicking logout', function(hooks) {
        hooks.beforeEach(async function() {
          await app.userDropdown.clickLogout();
        });

        test('navigates to the logout warning page', function(assert) {
          assert.equal(currentURL(), '/logout');
          assertExternal(assert as any);
        });
      });
    });
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:52,代码来源:logout-test.ts

示例6: module

  module('When in a short viewport', function(hooks) {
    hooks.beforeEach(function() {
      (app.scrollContainer()!.style as any) = 'height: 300px';
    });

    hooks.afterEach(function() {
      (app.scrollContainer()!.style as any) = '';
    });

    module('When scrolled to the bottom', function(hooks) {
      hooks.beforeEach(async function() {
        await app.footer.faq().scrollIntoView(false);
        await triggerEvent(window as any, 'scroll');
      });

      test('the top of the page is not visible', function(assert) {
        const position = app.scrollContainer().scrollTop;

        assert.notEqual(position, 0, 'the scroll container is not at the top');
      });

      module('Clicking to another page', function(hooks) {
        hooks.beforeEach(async function() {
          await app.footer.clickFaq();
        });

        test('the top of the page is visible', function(assert) {
          const position = app.scrollContainer().scrollTop;

          assert.equal(position, 0, 'the scroll container is at the top');
        });
      });
    });
  });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:34,代码来源:navigation-scroll-to-top-test.ts


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