本文整理汇总了TypeScript中@ephox/agar.Assertions.assertDomEq方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Assertions.assertDomEq方法的具体用法?TypeScript Assertions.assertDomEq怎么用?TypeScript Assertions.assertDomEq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Assertions
的用法示例。
在下文中一共展示了Assertions.assertDomEq方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');
const iframeContainerElement = SelectorFind.descendant(body, '#' + editor.id + '_iframecontainer').getOrDie('No elm');
Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
Assertions.assertDomEq('Should be expected iframe container element element', iframeContainerElement, Element.fromDom(editor.contentAreaContainer));
}))
示例2:
return Chain.op(function (blockBoundaryOption) {
const expectedFromBlock = Hierarchy.follow(Element.fromDom(viewBlock.get()), fromBlockPath).getOrDie();
const expectedToBlock = Hierarchy.follow(Element.fromDom(viewBlock.get()), toBlockPath).getOrDie();
const blockBoundary = blockBoundaryOption.getOrDie();
Assertions.assertDomEq('Should be expected from block', expectedFromBlock, blockBoundary.from().block());
Assertions.assertDomEq('Should be expected to block', expectedToBlock, blockBoundary.to().block());
});
示例3:
Logger.t('getParentCaretContainer', Step.sync(function () {
const body = Element.fromHtml('<div><span id="_mce_caret">a</span></div>');
const caret = Element.fromDom(body.dom().firstChild);
Assertions.assertDomEq('Should be caret element on child', caret, Element.fromDom(CaretFormat.getParentCaretContainer(body.dom(), caret.dom().firstChild)));
Assertions.assertDomEq('Should be caret element on self', caret, Element.fromDom(CaretFormat.getParentCaretContainer(body.dom(), caret.dom())));
Assertions.assertEq('Should not be caret element', null, CaretFormat.getParentCaretContainer(body, Element.fromTag('span').dom()));
Assertions.assertEq('Should not be caret element', null, CaretFormat.getParentCaretContainer(caret.dom(), caret.dom()));
})),
示例4:
return Chain.op(function (rng: any) {
const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
Assertions.assertDomEq('Should be expected start container', startContainer, Element.fromDom(rng.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, rng.startOffset);
Assertions.assertDomEq('Should be expected end container', endContainer, Element.fromDom(rng.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, rng.endOffset);
});
示例5:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
const editorElement = Traverse.nextSibling(targetElement).getOrDie('No elm');
Assertions.assertDomEq('Should be expected element', editorElement, Element.fromDom(editor.editorContainer));
Assertions.assertDomEq('Should be expected element', editorElement, Element.fromDom(editor.contentAreaContainer));
Assertions.assertDomEq('Should be expected element', targetElement, Element.fromDom(editor.getElement()));
}))
示例6: function
const assertRawRange = function (element, rng, startPath, startOffset, endPath, endOffset) {
const startContainer = Hierarchy.follow(element, startPath).getOrDie();
const endContainer = Hierarchy.follow(element, endPath).getOrDie();
Assertions.assertDomEq('Should be expected start container', startContainer, Element.fromDom(rng.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, rng.startOffset);
Assertions.assertDomEq('Should be expected end container', endContainer, Element.fromDom(rng.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, rng.endOffset);
};
示例7:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');
Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
Assertions.assertDomEq('Should be expected editor body element', targetElement, Element.fromDom(editor.getBody()));
Assertions.assertDomEq('Should be expected editor target element', targetElement, Element.fromDom(editor.getElement()));
Assertions.assertEq('Should be undefined for inline mode', undefined, editor.contentAreaContainer);
}))
示例8: function
const assertRange = function (root, range, startPath, startOffset, endPath, endOffset) {
const sc = Hierarchy.follow(Element.fromDom(root), startPath).getOrDie();
const ec = Hierarchy.follow(Element.fromDom(root), endPath).getOrDie();
const actualRange = range.getOrDie('Should be some');
Assertions.assertDomEq('Should be expected start container', sc, Element.fromDom(actualRange.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, actualRange.startOffset);
Assertions.assertDomEq('Should be expected end container', ec, Element.fromDom(actualRange.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, actualRange.endOffset);
};
示例9:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
const nextElement = Traverse.nextSibling(targetElement);
Assertions.assertEq('Should be null since inline has no editorContainer', null, editor.editorContainer);
Assertions.assertDomEq('Should be expected editor body element', targetElement, Element.fromDom(editor.getBody()));
Assertions.assertDomEq('Should be expected editor target element', targetElement, Element.fromDom(editor.getElement()));
Assertions.assertEq('Should be undefined for inline mode', undefined, editor.contentAreaContainer);
Assertions.assertEq('Should be no element after target', true, nextElement.isNone());
}))