本文整理汇总了TypeScript中ember-qunit.moduleFor函数的典型用法代码示例。如果您正苦于以下问题:TypeScript moduleFor函数的具体用法?TypeScript moduleFor怎么用?TypeScript moduleFor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了moduleFor函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: moduleFor
import { later } from '@ember/runloop';
import { moduleFor, test } from 'ember-qunit';
moduleFor('service:resize', 'Unit | Service | resize', {
// Specify the other units that are required for this test.
// needs: ['service:foo']
});
test('it fires "didResize" when the window is resized', function(assert) {
const service = this.subject({
heightSensitive: true,
widthSensitive: false,
});
let didResizeCallCount = 0;
service.on('didResize', () => {
didResizeCallCount++;
});
const evt = new Event('resize');
window.dispatchEvent(evt);
assert.equal(didResizeCallCount, 0, 'didResize called 0 time on event firing');
service.incrementProperty('_oldHeight', -20);
window.dispatchEvent(evt);
assert.equal(didResizeCallCount, 1, 'didResize called 1 time on event firing');
service.set('heightSensitive', false);
service.incrementProperty('_oldHeight', -20);
window.dispatchEvent(evt);
assert.equal(didResizeCallCount, 1, 'didResize shouldn\'t be called again if heightSensitive is false');
开发者ID:mike-north,项目名称:ember-resize,代码行数:30,代码来源:resize-test.ts
示例2: moduleForComponent
import { test, skip, moduleFor, moduleForModel, moduleForComponent, setResolver } from 'ember-qunit';
moduleForComponent('x-foo', {
integration: true
});
moduleForComponent('x-foo', {
unit: true,
needs: ['helper:pluralize-string']
});
moduleForModel('user', {
needs: ['model:child']
});
moduleFor('controller:home');
moduleFor('component:x-foo', 'Some description');
moduleFor('component:x-foo', 'TestModule callbacks', {
beforeSetup() {
},
beforeEach(assert) {
this.registry.register('helper:i18n', {});
this.register('service:i18n', {});
this.inject.service('i18n');
this.inject.service('i18n', { as: 'i18n' });
this.factory('object:user').create();
assert.ok(true);
},
开发者ID:AdaskoTheBeAsT,项目名称:DefinitelyTyped,代码行数:31,代码来源:ember-qunit-tests.ts
注:本文中的ember-qunit.moduleFor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论