本文整理汇总了TypeScript中@ephox/mcagar.LegacyUnit.equalDom方法的典型用法代码示例。如果您正苦于以下问题:TypeScript LegacyUnit.equalDom方法的具体用法?TypeScript LegacyUnit.equalDom怎么用?TypeScript LegacyUnit.equalDom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/mcagar.LegacyUnit
的用法示例。
在下文中一共展示了LegacyUnit.equalDom方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('formatChanged complex format', function (editor) {
let newState, newArgs;
editor.formatter.register('complex', { inline: 'span', styles: { color: '%color' } });
editor.formatter.formatChanged('complex', function (state, args) {
newState = state;
newArgs = args;
}, true);
editor.getBody().innerHTML = '<p>text</p>';
LegacyUnit.setSelection(editor, 'p', 0, 'p', 4);
// Check apply
editor.formatter.apply('complex', { color: '#FF0000' });
editor.nodeChanged();
LegacyUnit.equal(newState, true);
LegacyUnit.equal(newArgs.format, 'complex');
LegacyUnit.equalDom(newArgs.node, editor.getBody().firstChild.firstChild);
LegacyUnit.equal(newArgs.parents.length, 2);
// Check remove
editor.formatter.remove('complex', { color: '#FF0000' });
editor.nodeChanged();
LegacyUnit.equal(newState, false);
LegacyUnit.equal(newArgs.format, 'complex');
LegacyUnit.equalDom(newArgs.node, editor.getBody().firstChild);
LegacyUnit.equal(newArgs.parents.length, 1);
});
示例2: function
suite.test('getEditingHost', function () {
setupHtml('<span contentEditable="true"><span contentEditable="false"></span></span>');
LegacyUnit.equalDom(CaretUtils.getEditingHost(getRoot(), getRoot()), getRoot());
LegacyUnit.equalDom(CaretUtils.getEditingHost(getRoot().firstChild, getRoot()), getRoot());
LegacyUnit.equalDom(CaretUtils.getEditingHost(getRoot().firstChild.firstChild, getRoot()), getRoot().firstChild);
});
示例3: function
suite.test('Constructor', function () {
setupHtml('abc');
LegacyUnit.equalDom(CaretPosition(getRoot(), 0).container(), getRoot());
LegacyUnit.strictEqual(CaretPosition(getRoot(), 1).offset(), 1);
LegacyUnit.equalDom(CaretPosition(getRoot().firstChild, 0).container(), getRoot().firstChild);
LegacyUnit.strictEqual(CaretPosition(getRoot().firstChild, 1).offset(), 1);
});
示例4: function
suite.test('getClientRects from array', function () {
const viewElm = setupHtml('<b>a</b><b>b</b>');
const clientRects = Dimensions.getClientRects(Arr.toArray(viewElm.childNodes));
LegacyUnit.strictEqual(clientRects.length, 2);
LegacyUnit.equalDom(clientRects[0].node, viewElm.childNodes[0]);
LegacyUnit.equalDom(clientRects[1].node, viewElm.childNodes[1]);
});
示例5: function
suite.test('resolve', function () {
setupHtml('<p>a<b>12<input></b></p>');
LegacyUnit.equalDom(NodePath.resolve(getRoot(), NodePath.create(getRoot(), getRoot().firstChild)), getRoot().firstChild);
LegacyUnit.equalDom(
NodePath.resolve(getRoot(), NodePath.create(getRoot(), getRoot().firstChild.firstChild)),
getRoot().firstChild.firstChild
);
LegacyUnit.equalDom(
NodePath.resolve(getRoot(), NodePath.create(getRoot(), getRoot().firstChild.lastChild.lastChild)),
getRoot().firstChild.lastChild.lastChild
);
});
示例6: function
suite.test('mceInsertContent HR at end of H1 with inline elements with P sibling', function (editor) {
editor.setContent('<h1><strong>abc</strong></h1><p>def</p>');
LegacyUnit.setSelection(editor, 'strong', 3);
editor.execCommand('mceInsertContent', false, '<hr>');
LegacyUnit.equalDom(editor.selection.getNode(), editor.getBody().lastChild);
LegacyUnit.equal(editor.selection.getNode().nodeName, 'P');
LegacyUnit.equal(getContent(editor), '<h1><strong>abc</strong></h1><hr /><p>def</p>');
});
示例7: done
imageScanner.findAll(viewBlock.get()).then(function (result) {
done();
const blobInfo = result[0].blobInfo;
LegacyUnit.equal(result.length, 3);
LegacyUnit.equal(typeof result[result.length - 1], 'string', 'Last item is not the image, but error message.');
LegacyUnit.equal('data:image/gif;base64,' + blobInfo.base64(), base64Src);
LegacyUnit.equalDom(result[0].image, viewBlock.get().firstChild);
});