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