本文整理汇总了TypeScript中@ephox/katamari.Option.getOrDie方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Option.getOrDie方法的具体用法?TypeScript Option.getOrDie怎么用?TypeScript Option.getOrDie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Option
的用法示例。
在下文中一共展示了Option.getOrDie方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return Chain.op(function (posOption: Option<any>) {
const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), path).getOrDie();
const pos = posOption.getOrDie('Needs to return a caret');
Assertions.assertDomEq('Should be the expected container', container, Element.fromDom(pos.container()));
Assertions.assertEq('Should be the expected offset', offset, pos.offset());
});
示例2: actionName
return Chain.op(function (actionOption: Option<any>) {
const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), elementPath).getOrDie();
const action = actionOption.getOrDie();
Assertions.assertEq('Should be expected action type', 'moveToPosition', actionName(action));
Assertions.assertDomEq('Should be expected container', container, Element.fromDom(actionValue(action).container()));
Assertions.assertEq('Should be expected offset', offset, actionValue(action).offset());
});
示例3:
return Chain.op(function (blockBoundaryOption: Option<any>) {
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());
});
示例4:
return Chain.op(function (input: Option<any>) {
const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
const fc = Hierarchy.follow(Element.fromDom(viewBlock.get()), finishPath).getOrDie();
const bookmarkRng = input.getOrDie('no bookmark!');
Assertions.assertDomEq('sc', sc, bookmarkRng.start());
Assertions.assertEq('soffset', startOffset, bookmarkRng.soffset());
Assertions.assertDomEq('fc', fc, bookmarkRng.finish());
Assertions.assertEq('foffset', finishOffset, bookmarkRng.foffset());
});
示例5:
return Chain.op(function (position: Option<any>) {
const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), expectedPath).getOrDie();
Assertions.assertDomEq('Should be expected container', container, Element.fromDom(position.getOrDie().container()));
Assertions.assertEq('Should be expected offset', expectedOffset, position.getOrDie().offset());
});
示例6:
return Chain.op(function (actualBlock: Option<any>) {
const expectedBlock = Hierarchy.follow(Element.fromDom(viewBlock.get()), elementPath).getOrDie();
Assertions.assertDomEq('Should be the expected block element', expectedBlock, actualBlock.getOrDie());
});
示例7:
return Chain.op(function (cellOption: Option<any>) {
const cell = cellOption.getOrDie('x');
const expectedContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), path).getOrDie();
Assertions.assertDomEq('Should be the expected element', expectedContainer, Element.fromDom(cell));
});