本文整理汇总了TypeScript中@ephox/agar.RawAssertions类的典型用法代码示例。如果您正苦于以下问题:TypeScript RawAssertions类的具体用法?TypeScript RawAssertions怎么用?TypeScript RawAssertions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RawAssertions类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getStyleValue
Logger.t('getStyleValue from image data', Step.sync(() => {
RawAssertions.assertEq('Should not produce any styles', '', getStyleValue(normalizeCss, defaultData()));
RawAssertions.assertEq('Should produce border width', 'border-width: 1px;', getStyleValue(normalizeCss, Merger.merge(defaultData(), { border: '1' })));
RawAssertions.assertEq('Should produce style', 'border-style: solid;', getStyleValue(normalizeCss, Merger.merge(defaultData(), { borderStyle: 'solid' })));
RawAssertions.assertEq('Should produce style & border', 'border-style: solid; border-width: 1px;', getStyleValue(normalizeCss, Merger.merge(defaultData(), { border: '1', borderStyle: 'solid' })));
RawAssertions.assertEq('Should produce compact border', 'border: 2px dotted red;', getStyleValue(normalizeCss, Merger.merge(defaultData(), { style: 'border: 1px solid red', border: '2', borderStyle: 'dotted' })));
})),
示例2: function
Logger.sync('getInfo ... ' + scenario.label + ', link: ' + scenario.linkHtml, function () {
editorState.start.set(Element.fromHtml(scenario.linkHtml).dom());
editorState.content.set(scenario.selection);
const info = LinkBridge.getInfo(editor);
RawAssertions.assertEq('Checking getInfo (link)', scenario.expected, Objects.narrow(info, [ 'url', 'text', 'target', 'title' ]));
RawAssertions.assertEq('Checking link is set', true, info.link.isSome());
});
示例3: Editor
UnitTest.test('Editor context menu settings test', () => {
const userItems = Settings.getContextMenu(new Editor('id', { contextmenu: 'link image' }, EditorManager));
RawAssertions.assertEq('Should pass user specified items though', ['link', 'image'], userItems);
const editor = new Editor('id', { }, EditorManager);
editor.ui.registry.addContextMenu('link', {
update: () => []
});
const defaultItems = Settings.getContextMenu(editor);
RawAssertions.assertEq('Should filter out non existing default items', ['link'], defaultItems);
});
示例4: function
UnitTest.test('atomic.tinymce.core.util.PredicateTest', () => {
const isAbove = function (target, value) {
return value() > target();
};
const isAbove5 = Fun.curry(isAbove, Fun.constant(5));
const isAbove10 = Fun.curry(isAbove, Fun.constant(10));
RawAssertions.assertEq('Should be extected and result', false, Predicate.and(isAbove10, isAbove5)(Fun.constant(10)));
RawAssertions.assertEq('Should be extected and result', true, Predicate.and(isAbove10, isAbove5)(Fun.constant(30)));
RawAssertions.assertEq('Should be extected or result', false, Predicate.or(isAbove10, isAbove5)(Fun.constant(5)));
RawAssertions.assertEq('Should be extected or result', true, Predicate.or(isAbove10, isAbove5)(Fun.constant(15)));
RawAssertions.assertEq('Should be extected or result', true, Predicate.or(isAbove5, isAbove10)(Fun.constant(15)));
});
示例5: function
UnitTest.test('atomic.tinymce.plugins.visualchars.HtmlTest', function () {
const nbsp = '\u00a0';
const shy = '\u00AD';
RawAssertions.assertEq(
'should return correct span',
'<span data-mce-bogus="1" class="mce-nbsp">' + nbsp + '</span>',
Html.wrapCharWithSpan(nbsp)
);
RawAssertions.assertEq(
'should return correct span',
'<span data-mce-bogus="1" class="mce-shy">' + shy + '</span>',
Html.wrapCharWithSpan(shy)
);
});
示例6:
return Step.sync(function () {
const elm = document.createElement('div');
elm.innerHTML = inputHtml;
TrimNode.trimNode(dom, elm.firstChild);
const actual = elm.innerHTML;
RawAssertions.assertEq('is correct trimmed html', expectedTrimmedHtml, actual);
});
示例7: Editor
const testContentCss = (label: string, expectedContentCss: string[], inputContentCss: string[] | string | boolean) => {
const editor = new Editor('id', {
content_css: inputContentCss
}, EditorManager);
appendContentCssFromSettings(editor);
RawAssertions.assertEq(label, expectedContentCss, editor.contentCSS);
};
示例8: function
UnitTest.test('atomic.tinymce.plugins.visualchars.DataTest', function () {
RawAssertions.assertEq(
'should return correst selector',
'span.mce-a,span.mce-b',
Data.charMapToSelector({ a: 'a', b: 'b' })
);
RawAssertions.assertEq(
'should return correct regexp',
'/[ab]/',
Data.charMapToRegExp({ a: 'a', b: 'b' }).toString()
);
RawAssertions.assertEq(
'should return correct global regexp',
'/[ab]/g',
Data.charMapToRegExp({ a: 'a', b: 'b' }, true).toString()
);
});
示例9: function
UnitTest.test('browser.tinymce.core.dom.TrimHtmlTest', function () {
const serializer = DomSerializer({}, new Editor('id', {}, EditorManager));
RawAssertions.assertEq('Should be unchanged', '<p id="a" data-mce-abc="1">a</p>', TrimHtml.trimInternal(serializer, '<p id="a" data-mce-abc="1">a</p>'));
RawAssertions.assertEq('Should not have internal attr', '<p>a</p>', TrimHtml.trimInternal(serializer, '<p data-mce-selected="1">a</p>'));
RawAssertions.assertEq('Should trim zwsp', '<p>ab</p>', TrimHtml.trimInternal(serializer, '<p>a' + Zwsp.ZWSP + 'b</p>'));
RawAssertions.assertEq('Should be unchanged', '<p id="a" data-mce-abc="1">a</p>', TrimHtml.trimExternal(serializer, '<p id="a" data-mce-abc="1">a</p>'));
RawAssertions.assertEq('Should not have internal attr', '<p>a</p>', TrimHtml.trimExternal(serializer, '<p data-mce-selected="1">a</p>'));
RawAssertions.assertEq('Should not have zwsp', '<p>ab</p>', TrimHtml.trimExternal(serializer, '<p>a' + Zwsp.ZWSP + 'b</p>'));
});