本文整理汇总了TypeScript中@ephox/bedrock.assert类的典型用法代码示例。如果您正苦于以下问题:TypeScript assert类的具体用法?TypeScript assert怎么用?TypeScript assert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了assert类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: clearHistory
UnitTest.test('HistoryTest', () => {
const filetype = 'test';
clearHistory();
assert.eq([], getHistory(filetype));
addToHistory('http://example.com', filetype);
assert.eq(['http://example.com'], getHistory(filetype));
// non-http/https urls will be silently discarded
addToHistory('#id', filetype);
assert.eq(['http://example.com'], getHistory(filetype));
// new urls will be put at the front
addToHistory('https://tiny.cloud', filetype);
assert.eq(['https://tiny.cloud', 'http://example.com'], getHistory(filetype));
// existing urls will be moved to the front
addToHistory('http://example.com', filetype);
assert.eq(['http://example.com', 'https://tiny.cloud'], getHistory(filetype));
// only 5 urls will be kept
for (let i = 1; i <= 5; i++) {
addToHistory('http://example.com/' + i + '/', filetype);
}
assert.eq(['http://example.com/5/', 'http://example.com/4/', 'http://example.com/3/', 'http://example.com/2/', 'http://example.com/1/'], getHistory(filetype));
// multiple types of history can be kept independently
const filetype2 = 'test2';
assert.eq([], getHistory(filetype2));
addToHistory('http://www.abc.net.au/news/', filetype2);
assert.eq(['http://www.abc.net.au/news/'], getHistory(filetype2));
assert.eq(['http://example.com/5/', 'http://example.com/4/', 'http://example.com/3/', 'http://example.com/2/', 'http://example.com/1/'], getHistory(filetype));
});
开发者ID:tinymce,项目名称:tinymce,代码行数:27,代码来源:HistoryTest.ts
示例2: function
const assertInfo = function (label, expected, info) {
assert.eq(
expected.current,
info.current,
'Test: ' + label + '. Expected current: ' + expected.current + ', but was: ' + info.current
);
assert.eq(
expected.values,
info.values,
'Test: ' + label + '. Expected values: ' + expected.values + ', but was: ' + info.values
);
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:12,代码来源:AsyncSmoothAnimationTest.ts
示例3:
Obj.each(expected.pattern, (value, key) => {
if (Obj.has<any, string>(pattern, key)) {
Assertions.assertEq('Pattern ' + (i + 1) + ' property `' + key + '` is not equal', value, pattern[key]);
} else {
assert.fail('Pattern ' + (i + 1) + ' property `' + key + '` is missing');
}
});
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:FindInlinePatternTest.ts
示例4: function
const testCalcSmallContentRect = function () {
const contentAreaRect = rect(0, 0, 25, 25);
const targetRect = rect(40, 0, 10, 10);
const panelRect = rect(0, 20, 50, 50);
const foundRect = Layout.calc(targetRect, contentAreaRect, panelRect);
assert.eq(foundRect, { rect: rect(20, 10, 50, 50), position: 'bc-tc' });
};
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:LayoutTest.ts
示例5: convertUnit
const check = (expected: Option<number>, size: Size, unit: SizeUnit) => {
const result = convertUnit(size, unit);
assert.eq(
true, expected.equals(result),
'Expected conversion of ' + JSON.stringify(size) +
' to ' + unit + ' = ' + result.toString()
);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:SizeInputConvertTest.ts
示例6: function
const testIsNumber = function () {
assert.eq(Type.isNumber('a'), false);
assert.eq(Type.isNumber(null), false);
assert.eq(Type.isNumber(undefined), false);
assert.eq(Type.isNumber(true), false);
assert.eq(Type.isNumber(0), true);
assert.eq(Type.isNumber([]), false);
assert.eq(Type.isNumber({}), false);
assert.eq(Type.isNumber(function () { }), false);
};
开发者ID:abstask,项目名称:tinymce,代码行数:10,代码来源:TypeTest.ts
注:本文中的@ephox/bedrock.assert类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论