當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Option.getOrDie方法代碼示例

本文整理匯總了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());
    });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:LineReaderTest.ts

示例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());
 });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:7,代碼來源:CefDeleteActionTest.ts

示例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());
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:8,代碼來源:BlockMergeBoundaryTest.ts

示例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());
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:11,代碼來源:SelectionBookmarkTest.ts

示例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());
    });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:6,代碼來源:MergeBlocksTest.ts

示例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());
 });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:4,代碼來源:DeleteUtilsTest.ts

示例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));
 });
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:5,代碼來源:TableCellsTest.ts


注:本文中的@ephox/katamari.Option.getOrDie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。