本文整理匯總了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);
});