本文整理汇总了TypeScript中@dojo/framework/testing/harness.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: stub
it('should call pageChange with first page at scroll 0', () => {
const pageChangeStub = stub();
const page: any[] = [];
for (let i = 0; i < 100; i++) {
const item = { id: 'id' };
page.push(item);
}
const h = harness(() =>
w(Body, {
totalRows: 1000,
pageSize: 100,
height: 400,
pages: {
'page-1': page
},
columnConfig: [] as any,
fetcher: noop,
updater: noop,
pageChange: pageChangeStub,
onScroll: noop
})
);
h.trigger('@root', 'onscroll', {
target: {
scrollTop: 0,
scrollLeft: 0
}
});
h.expect(() => h.getRender());
assert.isTrue(pageChangeStub.calledWith(1));
});
示例2: harness
it('should render with a control div and only one widget if small', () => {
resizeGetStub = () => ({ isSmall: true, isMedium: false });
const h = harness(() => w(TestWidget, {}));
h.expect(() =>
v('div', { classes: css.root }, [
v('div', { key: 'controls', classes: css.controls }, [
w(Button, {
onClick: () => {
}
}, [
'Switch Demo Positions'
])
]),
v('div', { key: 'root' }, [
v('div', { classes: css.parentContainer }, [
w(ResizableSection, {
key: 0,
isSmall: true,
isMedium: false,
expand: () => {
},
shrink: () => {
},
columns: 2
}, [ w(Article, {}) ])
])
])
])
);
})
示例3: Promise
it('should request data when the bottom is visible', () => {
const loadStub = () => {
return Promise.resolve([v('div', {}, ['test'])]);
};
intersectionGetStub = () => {
return {
isIntersecting: true
};
};
const h = harness(() => w(TestWidget, {
onRequestItems: loadStub
}));
h.expect(() =>
v('div', {}, [
v('div', { key: 'bottom', classes: css.bottom })
])
);
return new Promise(resolve => {
setTimeout(() => {
h.expect(() =>
v('div', {}, [
v('div', {}, ['test']),
v('div', { key: 'bottom', classes: css.bottom })
])
);
resolve();
}, 10);
});
});
示例4: harness
it('accepts decimal values', () => {
const h = harness(() => w(Progress, {
max: 1,
value: 0.2
}));
h.expect(() => expectedVDom({ width: 20, output: '20%', value: 0.2, max: 1 }));
});
示例5: harness
it('should render the grid when the dimension are known', () => {
const h = harness(() =>
w(MockMetaMixin(Grid, mockMeta), {
fetcher: noop,
updater: noop,
columnConfig,
height: 250
})
);
h.expect(() =>
v('div', { key: 'root', classes: [css.root, fixedCss.rootFixed], role: 'table', 'aria-rowcount': null }, [
v('div', {
key: 'header',
scrollLeft: 0,
classes: [css.header, fixedCss.headerFixed, null],
row: 'rowgroup'
}, [
w(Header, {
key: 'header-row',
columnConfig,
sorter: noop,
sort: undefined,
filter: undefined,
filterer: noop,
classes: undefined,
theme: undefined,
filterRenderer: undefined,
sortRenderer: undefined
})
]),
w(Body, {
key: 'body',
pages: {},
totalRows: undefined,
pageSize: 100,
columnConfig,
pageChange: noop,
updater: noop,
fetcher: noop,
onScroll: noop,
height: 50,
classes: undefined,
theme: undefined
}),
v('div', { key: 'footer' }, [
w(Footer, {
key: 'footer-row',
total: undefined,
page: 1,
pageSize: 100,
classes: undefined,
theme: undefined
})
])
])
);
});