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