@atlaskit/editor-core 150.0.3 → 151.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/cjs/actions/index.js +5 -23
  3. package/dist/cjs/create-editor/ErrorBoundary.js +113 -79
  4. package/dist/cjs/create-editor/ReactEditorView.js +145 -31
  5. package/dist/cjs/create-editor/create-plugins-list.js +8 -2
  6. package/dist/cjs/editor.js +101 -40
  7. package/dist/cjs/labs/next/presets/cxhtml.js +2 -1
  8. package/dist/cjs/plugins/analytics/types/enums.js +3 -1
  9. package/dist/cjs/plugins/base/index.js +4 -3
  10. package/dist/cjs/plugins/base/pm-plugins/frozen-editor.js +66 -36
  11. package/dist/cjs/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  12. package/dist/cjs/plugins/card/index.js +13 -2
  13. package/dist/cjs/plugins/card/nodeviews/embedCard.js +1 -0
  14. package/dist/cjs/plugins/card/pm-plugins/main.js +7 -2
  15. package/dist/cjs/plugins/card/pm-plugins/util/resolve.js +10 -3
  16. package/dist/cjs/plugins/code-bidi-warning/index.js +25 -0
  17. package/dist/cjs/plugins/code-bidi-warning/plugin-key.js +11 -0
  18. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +43 -0
  19. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +118 -0
  20. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/reducer.js +12 -0
  21. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/types.js +5 -0
  22. package/dist/cjs/plugins/code-block/index.js +10 -6
  23. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  24. package/dist/cjs/plugins/code-block/pm-plugins/main.js +12 -3
  25. package/dist/cjs/plugins/code-block/toolbar.js +1 -1
  26. package/dist/cjs/plugins/emoji/styles.js +1 -1
  27. package/dist/cjs/plugins/extension/pm-plugins/main.js +1 -4
  28. package/dist/cjs/plugins/extension/toolbar.js +28 -23
  29. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +9 -3
  30. package/dist/cjs/plugins/find-replace/ui/Find.js +27 -7
  31. package/dist/cjs/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  32. package/dist/cjs/plugins/hyperlink/pm-plugins/keymap.js +3 -3
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  34. package/dist/cjs/plugins/hyperlink/utils.js +6 -69
  35. package/dist/cjs/plugins/index.js +8 -0
  36. package/dist/cjs/plugins/media/index.js +14 -3
  37. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +24 -10
  38. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +179 -0
  39. package/dist/cjs/plugins/media/pm-plugins/main.js +18 -9
  40. package/dist/cjs/plugins/media/toolbar/index.js +49 -17
  41. package/dist/cjs/plugins/media/toolbar/utils.js +20 -2
  42. package/dist/cjs/plugins/media/utils/media-files.js +67 -1
  43. package/dist/cjs/plugins/panel/index.js +2 -3
  44. package/dist/cjs/plugins/panel/message.js +47 -0
  45. package/dist/cjs/plugins/panel/toolbar.js +64 -84
  46. package/dist/cjs/plugins/panel/utils.js +2 -2
  47. package/dist/cjs/plugins/paste/linkify-md-plugin.js +3 -3
  48. package/dist/cjs/plugins/rank.js +1 -1
  49. package/dist/cjs/plugins/status/styles.js +1 -1
  50. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  51. package/dist/cjs/profiler/render-count.js +82 -0
  52. package/dist/cjs/ui/Appearance/Comment/Comment.js +6 -5
  53. package/dist/cjs/utils/react-hooks/use-component-renderer-tracking/index.js +55 -19
  54. package/dist/cjs/version-wrapper.js +1 -1
  55. package/dist/cjs/version.json +1 -1
  56. package/dist/es2019/actions/index.js +6 -28
  57. package/dist/es2019/create-editor/ErrorBoundary.js +73 -60
  58. package/dist/es2019/create-editor/ReactEditorView.js +130 -23
  59. package/dist/es2019/create-editor/create-plugins-list.js +9 -3
  60. package/dist/es2019/editor.js +74 -35
  61. package/dist/es2019/labs/next/presets/cxhtml.js +2 -1
  62. package/dist/es2019/plugins/analytics/types/enums.js +3 -1
  63. package/dist/es2019/plugins/base/index.js +4 -3
  64. package/dist/es2019/plugins/base/pm-plugins/frozen-editor.js +63 -35
  65. package/dist/es2019/plugins/block-type/ui/ToolbarBlockType/styled.js +2 -1
  66. package/dist/es2019/plugins/card/index.js +7 -2
  67. package/dist/es2019/plugins/card/nodeviews/embedCard.js +1 -0
  68. package/dist/es2019/plugins/card/pm-plugins/main.js +9 -2
  69. package/dist/es2019/plugins/card/pm-plugins/util/resolve.js +12 -5
  70. package/dist/es2019/plugins/code-bidi-warning/index.js +15 -0
  71. package/dist/es2019/plugins/code-bidi-warning/plugin-key.js +2 -0
  72. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +31 -0
  73. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +88 -0
  74. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  75. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  76. package/dist/es2019/plugins/code-block/index.js +6 -1
  77. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +16 -4
  78. package/dist/es2019/plugins/code-block/pm-plugins/main.js +50 -39
  79. package/dist/es2019/plugins/code-block/toolbar.js +1 -1
  80. package/dist/es2019/plugins/emoji/styles.js +2 -0
  81. package/dist/es2019/plugins/extension/pm-plugins/main.js +1 -4
  82. package/dist/es2019/plugins/extension/toolbar.js +30 -25
  83. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  84. package/dist/es2019/plugins/find-replace/ui/Find.js +27 -6
  85. package/dist/es2019/plugins/hyperlink/HyperlinkToolbarAppearance.js +1 -1
  86. package/dist/es2019/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  87. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  88. package/dist/es2019/plugins/hyperlink/utils.js +3 -59
  89. package/dist/es2019/plugins/index.js +2 -1
  90. package/dist/es2019/plugins/media/index.js +13 -4
  91. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +16 -7
  92. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +88 -0
  93. package/dist/es2019/plugins/media/pm-plugins/main.js +20 -11
  94. package/dist/es2019/plugins/media/toolbar/index.js +44 -15
  95. package/dist/es2019/plugins/media/toolbar/utils.js +16 -0
  96. package/dist/es2019/plugins/media/utils/media-files.js +68 -2
  97. package/dist/es2019/plugins/panel/index.js +3 -4
  98. package/dist/es2019/plugins/panel/message.js +38 -0
  99. package/dist/es2019/plugins/panel/toolbar.js +52 -71
  100. package/dist/es2019/plugins/panel/utils.js +2 -2
  101. package/dist/es2019/plugins/paste/linkify-md-plugin.js +2 -2
  102. package/dist/es2019/plugins/rank.js +1 -1
  103. package/dist/es2019/plugins/status/styles.js +5 -0
  104. package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  105. package/dist/es2019/profiler/render-count.js +60 -0
  106. package/dist/es2019/ui/Appearance/Comment/Comment.js +4 -2
  107. package/dist/es2019/utils/react-hooks/use-component-renderer-tracking/index.js +51 -18
  108. package/dist/es2019/version-wrapper.js +1 -1
  109. package/dist/es2019/version.json +1 -1
  110. package/dist/esm/actions/index.js +6 -24
  111. package/dist/esm/create-editor/ErrorBoundary.js +113 -78
  112. package/dist/esm/create-editor/ReactEditorView.js +146 -31
  113. package/dist/esm/create-editor/create-plugins-list.js +9 -3
  114. package/dist/esm/editor.js +100 -40
  115. package/dist/esm/labs/next/presets/cxhtml.js +2 -1
  116. package/dist/esm/plugins/analytics/types/enums.js +3 -1
  117. package/dist/esm/plugins/base/index.js +4 -3
  118. package/dist/esm/plugins/base/pm-plugins/frozen-editor.js +64 -36
  119. package/dist/esm/plugins/block-type/ui/ToolbarBlockType/styled.js +3 -1
  120. package/dist/esm/plugins/card/index.js +13 -2
  121. package/dist/esm/plugins/card/nodeviews/embedCard.js +1 -0
  122. package/dist/esm/plugins/card/pm-plugins/main.js +7 -2
  123. package/dist/esm/plugins/card/pm-plugins/util/resolve.js +12 -5
  124. package/dist/esm/plugins/code-bidi-warning/index.js +17 -0
  125. package/dist/esm/plugins/code-bidi-warning/plugin-key.js +2 -0
  126. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +30 -0
  127. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +96 -0
  128. package/dist/esm/plugins/code-bidi-warning/pm-plugins/reducer.js +3 -0
  129. package/dist/esm/plugins/code-bidi-warning/pm-plugins/types.js +1 -0
  130. package/dist/esm/plugins/code-block/index.js +10 -6
  131. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +16 -5
  132. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  133. package/dist/esm/plugins/code-block/toolbar.js +1 -1
  134. package/dist/esm/plugins/emoji/styles.js +1 -1
  135. package/dist/esm/plugins/extension/pm-plugins/main.js +1 -4
  136. package/dist/esm/plugins/extension/toolbar.js +28 -23
  137. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +9 -4
  138. package/dist/esm/plugins/find-replace/ui/Find.js +27 -7
  139. package/dist/esm/plugins/hyperlink/HyperlinkToolbarAppearance.js +2 -2
  140. package/dist/esm/plugins/hyperlink/pm-plugins/keymap.js +1 -1
  141. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +7 -4
  142. package/dist/esm/plugins/hyperlink/utils.js +3 -59
  143. package/dist/esm/plugins/index.js +2 -1
  144. package/dist/esm/plugins/media/index.js +14 -4
  145. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -10
  146. package/dist/esm/plugins/media/nodeviews/mediaInline.js +147 -0
  147. package/dist/esm/plugins/media/pm-plugins/main.js +19 -11
  148. package/dist/esm/plugins/media/toolbar/index.js +47 -19
  149. package/dist/esm/plugins/media/toolbar/utils.js +15 -1
  150. package/dist/esm/plugins/media/utils/media-files.js +60 -2
  151. package/dist/esm/plugins/panel/index.js +3 -4
  152. package/dist/esm/plugins/panel/message.js +38 -0
  153. package/dist/esm/plugins/panel/toolbar.js +57 -77
  154. package/dist/esm/plugins/panel/utils.js +2 -2
  155. package/dist/esm/plugins/paste/linkify-md-plugin.js +2 -2
  156. package/dist/esm/plugins/rank.js +1 -1
  157. package/dist/esm/plugins/status/styles.js +1 -1
  158. package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +18 -2
  159. package/dist/esm/profiler/render-count.js +57 -0
  160. package/dist/esm/ui/Appearance/Comment/Comment.js +6 -5
  161. package/dist/esm/utils/react-hooks/use-component-renderer-tracking/index.js +53 -20
  162. package/dist/esm/version-wrapper.js +1 -1
  163. package/dist/esm/version.json +1 -1
  164. package/dist/types/create-editor/ErrorBoundary.d.ts +6 -6
  165. package/dist/types/create-editor/ReactEditorView.d.ts +15 -3
  166. package/dist/types/editor.d.ts +2 -0
  167. package/dist/types/plugins/analytics/index.d.ts +1 -1
  168. package/dist/types/plugins/analytics/types/enums.d.ts +4 -2
  169. package/dist/types/plugins/analytics/types/events.d.ts +7 -2
  170. package/dist/types/plugins/analytics/types/general-events.d.ts +4 -1
  171. package/dist/types/plugins/analytics/types/index.d.ts +1 -1
  172. package/dist/types/plugins/analytics/types/insert-events.d.ts +6 -1
  173. package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +1 -0
  174. package/dist/types/plugins/base/index.d.ts +1 -0
  175. package/dist/types/plugins/base/pm-plugins/frozen-editor.d.ts +3 -2
  176. package/dist/types/plugins/card/pm-plugins/main.d.ts +2 -3
  177. package/dist/types/plugins/card/pm-plugins/util/resolve.d.ts +2 -1
  178. package/dist/types/plugins/card/types.d.ts +6 -0
  179. package/dist/types/plugins/code-bidi-warning/index.d.ts +3 -0
  180. package/dist/types/plugins/code-bidi-warning/plugin-key.d.ts +2 -0
  181. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +3 -0
  182. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +7 -0
  183. package/dist/types/plugins/code-bidi-warning/pm-plugins/reducer.d.ts +3 -0
  184. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +5 -0
  185. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +11 -2
  186. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +5 -1
  187. package/dist/types/plugins/extension/types.d.ts +0 -2
  188. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  189. package/dist/types/plugins/floating-toolbar/types.d.ts +1 -1
  190. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +1 -1
  191. package/dist/types/plugins/hyperlink/HyperlinkToolbarAppearance.d.ts +1 -1
  192. package/dist/types/plugins/hyperlink/utils.d.ts +0 -21
  193. package/dist/types/plugins/index.d.ts +1 -0
  194. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +27 -0
  195. package/dist/types/plugins/media/pm-plugins/main.d.ts +2 -2
  196. package/dist/types/plugins/media/toolbar/utils.d.ts +2 -0
  197. package/dist/types/plugins/media/utils/media-files.d.ts +8 -0
  198. package/dist/types/plugins/panel/message.d.ts +37 -0
  199. package/dist/types/plugins/panel/toolbar.d.ts +4 -37
  200. package/dist/types/plugins/panel/types.d.ts +1 -0
  201. package/dist/types/profiler/render-count.d.ts +14 -0
  202. package/dist/types/types/feature-flags.d.ts +17 -0
  203. package/dist/types/ui/LinkSearch/types.d.ts +1 -0
  204. package/dist/types/utils/react-hooks/use-component-renderer-tracking/index.d.ts +17 -1
  205. package/package.json +21 -18
  206. package/dist/cjs/plugins/caption/nodeviews/index.test.js +0 -135
  207. package/dist/cjs/plugins/caption/pm-plugins/keymap.test.js +0 -203
  208. package/dist/cjs/plugins/caption/pm-plugins/main.test.js +0 -141
  209. package/dist/cjs/plugins/code-block/language-list.test.js +0 -74
  210. package/dist/cjs/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -101
  211. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -98
  212. package/dist/cjs/plugins/media/commands/captions.test.js +0 -149
  213. package/dist/cjs/plugins/media/commands/linking.test.js +0 -296
  214. package/dist/cjs/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -50
  215. package/dist/cjs/plugins/panel/toolbar.test.js +0 -250
  216. package/dist/cjs/ui/ColorPickerButton/index.test.js +0 -123
  217. package/dist/cjs/ui/PortalProvider/index.test.js +0 -139
  218. package/dist/es2019/plugins/caption/nodeviews/index.test.js +0 -122
  219. package/dist/es2019/plugins/caption/pm-plugins/keymap.test.js +0 -193
  220. package/dist/es2019/plugins/caption/pm-plugins/main.test.js +0 -132
  221. package/dist/es2019/plugins/code-block/language-list.test.js +0 -69
  222. package/dist/es2019/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -83
  223. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  224. package/dist/es2019/plugins/media/commands/captions.test.js +0 -126
  225. package/dist/es2019/plugins/media/commands/linking.test.js +0 -208
  226. package/dist/es2019/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  227. package/dist/es2019/plugins/panel/toolbar.test.js +0 -200
  228. package/dist/es2019/ui/ColorPickerButton/index.test.js +0 -88
  229. package/dist/es2019/ui/PortalProvider/index.test.js +0 -115
  230. package/dist/esm/plugins/caption/nodeviews/index.test.js +0 -125
  231. package/dist/esm/plugins/caption/pm-plugins/keymap.test.js +0 -195
  232. package/dist/esm/plugins/caption/pm-plugins/main.test.js +0 -124
  233. package/dist/esm/plugins/code-block/language-list.test.js +0 -71
  234. package/dist/esm/plugins/extension/ui/SaveIndicator/SaveIndicator.test.js +0 -92
  235. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.test.js +0 -85
  236. package/dist/esm/plugins/media/commands/captions.test.js +0 -135
  237. package/dist/esm/plugins/media/commands/linking.test.js +0 -268
  238. package/dist/esm/plugins/media/ui/CaptionPlaceholder/index.test.js +0 -41
  239. package/dist/esm/plugins/panel/toolbar.test.js +0 -230
  240. package/dist/esm/ui/ColorPickerButton/index.test.js +0 -107
  241. package/dist/esm/ui/PortalProvider/index.test.js +0 -129
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
6
-
7
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
-
9
- var _react = _interopRequireDefault(require("react"));
10
-
11
- var _react2 = require("@testing-library/react");
12
-
13
- var _reactIntl = require("react-intl");
14
-
15
- var _SaveIndicator = require("./SaveIndicator");
16
-
17
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
18
-
19
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
20
-
21
- jest.useFakeTimers();
22
-
23
- function setup() {
24
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
25
-
26
- var onSaveStarted = function onSaveStarted() {};
27
-
28
- var result = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_reactIntl.IntlProvider, {
29
- locale: "en"
30
- }, /*#__PURE__*/_react.default.createElement(_SaveIndicator.SaveIndicator, (0, _extends2.default)({
31
- duration: 2000
32
- }, props), function (_ref) {
33
- var _onSaveStarted = _ref.onSaveStarted;
34
- onSaveStarted = _onSaveStarted;
35
- return /*#__PURE__*/_react.default.createElement("div", {
36
- "data-testid": "my-component"
37
- });
38
- })));
39
- return _objectSpread(_objectSpread({}, result), {}, {
40
- onSaveStarted: onSaveStarted
41
- });
42
- }
43
-
44
- describe('Extension Context Panel - Save Indicator', function () {
45
- it('should call the render function ', function () {
46
- var renderFunction = jest.fn().mockImplementation(function () {
47
- return /*#__PURE__*/_react.default.createElement("div", {
48
- "data-testid": "my-component"
49
- });
50
- });
51
-
52
- var _render = (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_reactIntl.IntlProvider, {
53
- locale: "en"
54
- }, /*#__PURE__*/_react.default.createElement(_SaveIndicator.SaveIndicator, {
55
- duration: 1000
56
- }, renderFunction))),
57
- queryByTestId = _render.queryByTestId;
58
-
59
- expect(queryByTestId('my-component')).not.toBeNull();
60
- });
61
- it('should show the save indicator when is saving ', function () {
62
- var _setup = setup(),
63
- onSaveStarted = _setup.onSaveStarted,
64
- queryByTestId = _setup.queryByTestId;
65
-
66
- (0, _react2.act)(function () {
67
- onSaveStarted();
68
- });
69
- expect(queryByTestId('save-indicator-content')).not.toBeNull();
70
- });
71
- it('should hide once the duration is over ', function () {
72
- jest.clearAllTimers();
73
- var duration = 2000;
74
-
75
- var _setup2 = setup({
76
- duration: duration
77
- }),
78
- onSaveStarted = _setup2.onSaveStarted,
79
- queryByTestId = _setup2.queryByTestId;
80
-
81
- (0, _react2.act)(function () {
82
- onSaveStarted();
83
- });
84
- (0, _react2.act)(function () {
85
- jest.advanceTimersByTime(duration);
86
- });
87
- expect(queryByTestId('save-indicator-content')).toBeNull();
88
- });
89
- it('should not show the save indicator after saving when visible is false ', function () {
90
- var _setup3 = setup({
91
- visible: false
92
- }),
93
- onSaveStarted = _setup3.onSaveStarted,
94
- queryByTestId = _setup3.queryByTestId;
95
-
96
- (0, _react2.act)(function () {
97
- onSaveStarted();
98
- });
99
- expect(queryByTestId('save-indicator-content')).toBeNull();
100
- });
101
- });
@@ -1,98 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _react = _interopRequireDefault(require("react"));
6
-
7
- var _enzyme = require("@atlaskit/editor-test-helpers/enzyme");
8
-
9
- var _createProsemirrorEditor = require("@atlaskit/editor-test-helpers/create-prosemirror-editor");
10
-
11
- var _docBuilder = require("@atlaskit/editor-test-helpers/doc-builder");
12
-
13
- var _EmojiPickerButton = require("./EmojiPickerButton");
14
-
15
- var _panel = _interopRequireDefault(require("../../panel"));
16
-
17
- var _editorCommon = require("@atlaskit/editor-common");
18
-
19
- var _getTestEmojiResource = require("@atlaskit/util-data-test/get-test-emoji-resource");
20
-
21
- var _testUtils = require("react-dom/test-utils");
22
-
23
- describe('emoji-picker-button', function () {
24
- var createEditor = (0, _createProsemirrorEditor.createProsemirrorEditorFactory)();
25
- var wrapper;
26
- var onChangeMock;
27
- var providerFactory = new _editorCommon.ProviderFactory();
28
- var panelPreset = new _createProsemirrorEditor.Preset().add([_panel.default, {
29
- UNSAFE_allowCustomPanel: true
30
- }]);
31
- beforeEach(function () {
32
- var _createEditor = createEditor({
33
- doc: (0, _docBuilder.doc)((0, _docBuilder.panel)({
34
- panelType: 'info'
35
- })((0, _docBuilder.p)('{<>}'))),
36
- preset: panelPreset,
37
- providerFactory: providerFactory
38
- }),
39
- editorView = _createEditor.editorView;
40
-
41
- providerFactory.setProvider('emojiProvider', Promise.resolve((0, _getTestEmojiResource.getTestEmojiResource)()));
42
- onChangeMock = jest.fn();
43
- wrapper = (0, _enzyme.mountWithIntl)( /*#__PURE__*/_react.default.createElement(_EmojiPickerButton.EmojiPickerButton, {
44
- view: editorView,
45
- providerFactory: providerFactory,
46
- onChange: onChangeMock
47
- }));
48
- });
49
- afterEach(function () {
50
- providerFactory.removeProvider('emojiProvider');
51
- wrapper && wrapper.unmount();
52
- });
53
- it('should render a button', function () {
54
- expect(wrapper.find('button')).toHaveLength(1); // ensure no popup is rendered
55
-
56
- expect(wrapper.find('Popup')).toHaveLength(0);
57
- });
58
- it('should show a EmojiPicker popup after clicking button', function () {
59
- // popup still not shown before the click
60
- wrapper.find('button').simulate('click'); // show the popup
61
-
62
- expect(wrapper.find('Popup')).toHaveLength(1);
63
- });
64
- it('should close EmojiPicker popup after clicking outside', function () {
65
- // clicking on the button to open the popup
66
- wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
67
-
68
- expect(wrapper.find('Popup')).toHaveLength(1);
69
- var emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling click outside
70
-
71
- (0, _testUtils.act)(function () {
72
- emojiPicker.props.handleClickOutside();
73
- });
74
- wrapper.update(); // make sure popup is hidden
75
-
76
- expect(wrapper.find('Popup')).toHaveLength(0);
77
- });
78
- it('should hide popup and call onChange after selecting an emoji', function () {
79
- // click the button
80
- wrapper.find('button').simulate('click'); // make sure the popup and picker are shown
81
-
82
- expect(wrapper.find('Popup')).toHaveLength(1);
83
- var emojiPicker = wrapper.find('EmojiPickerInternal').instance(); // calling mock callback
84
-
85
- (0, _testUtils.act)(function () {
86
- emojiPicker.props.onSelection({
87
- shortName: ':smiley:'
88
- });
89
- }); // make sure the on change callback is called
90
-
91
- expect(onChangeMock).toBeCalledWith({
92
- shortName: ':smiley:'
93
- });
94
- wrapper.update(); // make sure popup is hidden
95
-
96
- expect(wrapper.find('Popup')).toHaveLength(0);
97
- });
98
- });
@@ -1,149 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
-
9
- var _createEditor = require("@atlaskit/editor-test-helpers/create-editor");
10
-
11
- var _docBuilder = require("@atlaskit/editor-test-helpers/doc-builder");
12
-
13
- var analyticsUtils = _interopRequireWildcard(require("../../analytics/utils"));
14
-
15
- var _captions = require("./captions");
16
-
17
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
-
19
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
-
21
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
22
-
23
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24
-
25
- describe('Caption plugin', function () {
26
- var createEditor = (0, _createEditor.createEditorFactory)();
27
-
28
- var editor = function editor(doc) {
29
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30
- return createEditor(_objectSpread({
31
- doc: doc
32
- }, opts));
33
- };
34
-
35
- it('should insert the caption node and select it', function () {
36
- var _editor = editor((0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
37
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
38
- type: 'file',
39
- collection: 'MediaServicesSample'
40
- })()), (0, _docBuilder.p)('Line two')), {
41
- editorProps: {
42
- media: {
43
- allowMediaSingle: true,
44
- featureFlags: {
45
- captions: true
46
- }
47
- }
48
- }
49
- }),
50
- editorView = _editor.editorView;
51
-
52
- (0, _captions.insertAndSelectCaptionFromMediaSinglePos)(0, editorView.state.doc.child(0))(editorView.state, editorView.dispatch);
53
- expect(editorView.state).toEqualDocumentAndSelection((0, _docBuilder.doc)((0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
54
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
55
- type: 'file',
56
- collection: 'MediaServicesSample'
57
- })(), (0, _docBuilder.caption)('{<>}')), (0, _docBuilder.p)('Line two')));
58
- });
59
- it('should not insert the caption node when it exists already', function () {
60
- var _editor2 = editor((0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
61
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
62
- type: 'file',
63
- collection: 'MediaServicesSample'
64
- })(), (0, _docBuilder.caption)('test')), (0, _docBuilder.p)('Line two')), {
65
- editorProps: {
66
- media: {
67
- allowMediaSingle: true,
68
- featureFlags: {
69
- captions: true
70
- }
71
- }
72
- }
73
- }),
74
- editorView = _editor2.editorView;
75
-
76
- expect((0, _captions.insertAndSelectCaptionFromMediaSinglePos)(0, editorView.state.doc.child(0))(editorView.state, editorView.dispatch)).toBeFalsy();
77
- });
78
- it('create an added analytic for captions', function () {
79
- var addAnalyticsSpy = jest.spyOn(analyticsUtils, 'addAnalytics');
80
-
81
- var _editor3 = editor((0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
82
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
83
- type: 'file',
84
- collection: 'MediaServicesSample'
85
- })()), (0, _docBuilder.p)('Line two')), {
86
- editorProps: {
87
- media: {
88
- allowMediaSingle: true,
89
- featureFlags: {
90
- captions: true
91
- }
92
- }
93
- }
94
- }),
95
- editorView = _editor3.editorView;
96
-
97
- (0, _captions.insertAndSelectCaptionFromMediaSinglePos)(0, editorView.state.doc.child(0))(editorView.state, editorView.dispatch);
98
- expect(addAnalyticsSpy).toBeCalled();
99
- expect(addAnalyticsSpy.mock.calls[0][2]).toEqual({
100
- action: 'added',
101
- actionSubject: 'mediaSingle',
102
- actionSubjectId: 'caption',
103
- eventType: 'track'
104
- });
105
- });
106
- it('should move selection to an existing caption node', function () {
107
- var _editor4 = editor((0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
108
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
109
- type: 'file',
110
- collection: 'MediaServicesSample'
111
- })(), (0, _docBuilder.caption)('hello world')), (0, _docBuilder.p)('Line two')), {
112
- editorProps: {
113
- media: {
114
- allowMediaSingle: true,
115
- featureFlags: {
116
- captions: true
117
- }
118
- }
119
- }
120
- }),
121
- editorView = _editor4.editorView;
122
-
123
- (0, _captions.selectCaptionFromMediaSinglePos)(0, editorView.state.doc.child(0))(editorView.state, editorView.dispatch);
124
- expect(editorView.state).toEqualDocumentAndSelection((0, _docBuilder.doc)((0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
125
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
126
- type: 'file',
127
- collection: 'MediaServicesSample'
128
- })(), (0, _docBuilder.caption)('hello world{<>}')), (0, _docBuilder.p)('Line two')));
129
- });
130
- it('should not move selection to a non existing caption node', function () {
131
- var _editor5 = editor((0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
132
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
133
- type: 'file',
134
- collection: 'MediaServicesSample'
135
- })()), (0, _docBuilder.p)('Line two')), {
136
- editorProps: {
137
- media: {
138
- allowMediaSingle: true,
139
- featureFlags: {
140
- captions: true
141
- }
142
- }
143
- }
144
- }),
145
- editorView = _editor5.editorView;
146
-
147
- expect((0, _captions.selectCaptionFromMediaSinglePos)(0, editorView.state.doc.child(0))(editorView.state, editorView.dispatch)).toBeFalsy();
148
- });
149
- });
@@ -1,296 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
8
-
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
-
11
- var _docBuilder = require("@atlaskit/editor-test-helpers/doc-builder");
12
-
13
- var _mediaTestHelpers = require("@atlaskit/media-test-helpers");
14
-
15
- var _createProsemirrorEditor = require("@atlaskit/editor-test-helpers/create-prosemirror-editor");
16
-
17
- var _sendKeyToPm = _interopRequireDefault(require("@atlaskit/editor-test-helpers/send-key-to-pm"));
18
-
19
- var _editorCommon = require("@atlaskit/editor-common");
20
-
21
- var _hyperlink = _interopRequireDefault(require("../../hyperlink"));
22
-
23
- var _ = _interopRequireDefault(require("../"));
24
-
25
- var _actions = require("../pm-plugins/linking/actions");
26
-
27
- var _checkMediaType = require("../utils/check-media-type");
28
-
29
- var _linking = require("../pm-plugins/linking");
30
-
31
- var linking = _interopRequireWildcard(require("./linking"));
32
-
33
- var _types = require("../../analytics/types");
34
-
35
- var analyticUtils = _interopRequireWildcard(require("../../analytics/utils"));
36
-
37
- var commands = _interopRequireWildcard(require("../../../commands"));
38
-
39
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
-
41
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
42
-
43
- var setUrlToMedia = linking.setUrlToMedia,
44
- showLinkingToolbarWithMediaTypeCheck = linking.showLinkingToolbarWithMediaTypeCheck,
45
- unlink = linking.unlink;
46
- jest.mock('../utils/check-media-type', function () {
47
- return {
48
- checkMediaType: jest.fn()
49
- };
50
- });
51
- describe('image linking', function () {
52
- var createEditor = (0, _createProsemirrorEditor.createProsemirrorEditorFactory)();
53
- var preset = new _createProsemirrorEditor.Preset();
54
- var mediaProvider = Promise.resolve({
55
- viewMediaClientConfig: (0, _mediaTestHelpers.getDefaultMediaClientConfig)()
56
- });
57
-
58
- var providerFactory = _editorCommon.ProviderFactory.create({
59
- mediaProvider: mediaProvider
60
- });
61
-
62
- preset.add([_.default, {
63
- allowMediaSingle: true,
64
- allowLinking: true
65
- }]).add(_hyperlink.default);
66
-
67
- var editor = function editor(doc) {
68
- return createEditor({
69
- doc: doc,
70
- preset: preset,
71
- providerFactory: providerFactory
72
- });
73
- };
74
-
75
- var document = (0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
76
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
77
- type: 'file',
78
- collection: 'MediaServicesSample'
79
- })()), (0, _docBuilder.mediaSingle)()((0, _docBuilder.media)({
80
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
81
- type: 'file',
82
- collection: 'MediaServicesSample'
83
- })()));
84
- var mockDispatch = jest.fn();
85
- afterEach(function () {
86
- mockDispatch.mockClear();
87
- });
88
- describe('analytics', function () {
89
- var FIRST_CALL = 0;
90
- var ANALYTIC_PAYLOAD = 2;
91
- var analyticUtilsSpy = jest.spyOn(analyticUtils, 'addAnalytics');
92
- beforeEach(function () {
93
- analyticUtilsSpy.mockReset();
94
- });
95
- afterAll(function () {
96
- jest.resetAllMocks();
97
- });
98
- it('should call analytic when creating a link', function () {
99
- var _editor = editor(document),
100
- editorView = _editor.editorView;
101
-
102
- setUrlToMedia('http://google.com', _types.INPUT_METHOD.MANUAL)(editorView.state, mockDispatch, editorView);
103
- expect(analyticUtilsSpy).toBeCalled();
104
- expect(analyticUtilsSpy.mock.calls[FIRST_CALL][ANALYTIC_PAYLOAD]).toEqual({
105
- action: 'added',
106
- actionSubject: 'media',
107
- actionSubjectId: 'link',
108
- attributes: expect.objectContaining({
109
- inputMethod: 'manual'
110
- }),
111
- eventType: 'track'
112
- });
113
- });
114
- describe('existing links', function () {
115
- var googleUrl = 'http://google.com';
116
- var documentWithMediaWithLink = (0, _docBuilder.doc)('{<node>}', (0, _docBuilder.mediaSingle)()((0, _docBuilder.a)({
117
- href: googleUrl
118
- })((0, _docBuilder.media)({
119
- id: 'a559980d-cd47-43e2-8377-27359fcb905f',
120
- type: 'file',
121
- collection: 'MediaServicesSample'
122
- })())));
123
- it('should add edit analytic when modifying link', function () {
124
- var _editor2 = editor(documentWithMediaWithLink),
125
- editorView = _editor2.editorView;
126
-
127
- setUrlToMedia('http://random-url.com', _types.INPUT_METHOD.MANUAL)(editorView.state, editorView.dispatch, editorView);
128
- expect(analyticUtilsSpy).toHaveBeenCalledTimes(1);
129
- expect(analyticUtilsSpy.mock.calls[FIRST_CALL][ANALYTIC_PAYLOAD]).toEqual({
130
- action: 'edited',
131
- actionSubject: 'media',
132
- actionSubjectId: 'link',
133
- eventType: 'track'
134
- });
135
- });
136
- it('should delete analytic when removing a link', function () {
137
- var _editor3 = editor(documentWithMediaWithLink),
138
- editorView = _editor3.editorView;
139
-
140
- unlink(editorView.state, editorView.dispatch, editorView);
141
- expect(analyticUtilsSpy).toBeCalledTimes(1);
142
- expect(analyticUtilsSpy.mock.calls[FIRST_CALL][ANALYTIC_PAYLOAD]).toEqual({
143
- action: 'deleted',
144
- actionSubject: 'media',
145
- actionSubjectId: 'link',
146
- eventType: 'track'
147
- });
148
- });
149
- it("shouldn't call an analytic if the url was modified to the same url", function () {
150
- var _editor4 = editor(documentWithMediaWithLink),
151
- editorView = _editor4.editorView;
152
-
153
- setUrlToMedia(googleUrl, _types.INPUT_METHOD.MANUAL)(editorView.state, mockDispatch, editorView);
154
- expect(analyticUtilsSpy).not.toBeCalled();
155
- });
156
- });
157
- describe('errors', function () {
158
- beforeAll(function () {
159
- jest.spyOn(commands, 'createToggleBlockMarkOnRange').mockImplementation(function () {
160
- throw new Error('This error should be caught');
161
- });
162
- });
163
- it("should call analytic if there's an error creating a link", function () {
164
- var _editor5 = editor(document),
165
- editorView = _editor5.editorView;
166
-
167
- try {
168
- setUrlToMedia('http://google.com', _types.INPUT_METHOD.MANUAL)(editorView.state, mockDispatch, editorView);
169
- } catch (e) {// noop
170
- }
171
-
172
- expect(analyticUtilsSpy.mock.calls[FIRST_CALL][ANALYTIC_PAYLOAD]).toEqual({
173
- action: 'errored',
174
- actionSubject: 'media',
175
- actionSubjectId: 'link',
176
- attributes: {
177
- action: 'added'
178
- },
179
- eventType: 'track'
180
- });
181
- });
182
- });
183
- });
184
- describe('show linking toolbar', function () {
185
- describe('selected media is an image', function () {
186
- beforeAll(function () {
187
- _checkMediaType.checkMediaType.mockReturnValue(Promise.resolve('image'));
188
- });
189
- it('call dispatch with correct param with a media is selected', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
190
- var _editor6, editorView, result, expectTransaction;
191
-
192
- return _regenerator.default.wrap(function _callee$(_context) {
193
- while (1) {
194
- switch (_context.prev = _context.next) {
195
- case 0:
196
- _editor6 = editor(document), editorView = _editor6.editorView;
197
- _context.next = 3;
198
- return (0, _mediaTestHelpers.flushPromises)();
199
-
200
- case 3:
201
- result = showLinkingToolbarWithMediaTypeCheck(editorView.state, mockDispatch, editorView);
202
- expectTransaction = editorView.state.tr.setMeta(_linking.mediaLinkingPluginKey, {
203
- type: _actions.MediaLinkingActionsTypes.showToolbar
204
- });
205
- _context.next = 7;
206
- return (0, _mediaTestHelpers.flushPromises)();
207
-
208
- case 7:
209
- expect(result).toEqual(true);
210
- expect(mockDispatch).toHaveBeenCalledWith(expectTransaction);
211
-
212
- case 9:
213
- case "end":
214
- return _context.stop();
215
- }
216
- }
217
- }, _callee);
218
- })));
219
- it('does not call dispatch when selection is not a media single node', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
220
- var _editor7, editorView, result;
221
-
222
- return _regenerator.default.wrap(function _callee2$(_context2) {
223
- while (1) {
224
- switch (_context2.prev = _context2.next) {
225
- case 0:
226
- _editor7 = editor(document), editorView = _editor7.editorView;
227
- result = showLinkingToolbarWithMediaTypeCheck(editorView.state, mockDispatch, editorView);
228
- _context2.next = 4;
229
- return (0, _mediaTestHelpers.flushPromises)();
230
-
231
- case 4:
232
- expect(result).toEqual(false);
233
- expect(mockDispatch).not.toHaveBeenCalled();
234
-
235
- case 6:
236
- case "end":
237
- return _context2.stop();
238
- }
239
- }
240
- }, _callee2);
241
- })));
242
- it('does not call dispatch when selection has changed', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
243
- var _editor8, editorView, result;
244
-
245
- return _regenerator.default.wrap(function _callee3$(_context3) {
246
- while (1) {
247
- switch (_context3.prev = _context3.next) {
248
- case 0:
249
- _editor8 = editor(document), editorView = _editor8.editorView;
250
- result = showLinkingToolbarWithMediaTypeCheck(editorView.state, mockDispatch, editorView);
251
- (0, _sendKeyToPm.default)(editorView, 'ArrowDown');
252
- _context3.next = 5;
253
- return (0, _mediaTestHelpers.flushPromises)();
254
-
255
- case 5:
256
- expect(result).toEqual(false);
257
- expect(mockDispatch).not.toHaveBeenCalled();
258
-
259
- case 7:
260
- case "end":
261
- return _context3.stop();
262
- }
263
- }
264
- }, _callee3);
265
- })));
266
- });
267
- describe('selected media is a video', function () {
268
- beforeAll(function () {
269
- _checkMediaType.checkMediaType.mockReturnValue(Promise.resolve('video'));
270
- });
271
- it('does not call dispatch', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
272
- var _editor9, editorView, result;
273
-
274
- return _regenerator.default.wrap(function _callee4$(_context4) {
275
- while (1) {
276
- switch (_context4.prev = _context4.next) {
277
- case 0:
278
- _editor9 = editor(document), editorView = _editor9.editorView;
279
- result = showLinkingToolbarWithMediaTypeCheck(editorView.state, mockDispatch, editorView);
280
- _context4.next = 4;
281
- return (0, _mediaTestHelpers.flushPromises)();
282
-
283
- case 4:
284
- expect(result).toEqual(false);
285
- expect(mockDispatch).not.toHaveBeenCalled();
286
-
287
- case 6:
288
- case "end":
289
- return _context4.stop();
290
- }
291
- }
292
- }, _callee4);
293
- })));
294
- });
295
- });
296
- });