@inboxsdk/core 0.2.28-alpha.4 → 0.2.28-alpha.5
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.
- package/inboxsdk.js +1 -1
- package/package.json +5 -1
- package/src/inboxsdk-js/check-requirements.js +7 -3
- package/src/inboxsdk-js/header.js +1 -0
- package/src/inboxsdk-js/inboxsdk-NONREMOTE-INTEGRATED-PAGEWORLD.js +5 -6
- package/src/inboxsdk-js/inboxsdk-NONREMOTE.js +4 -3
- package/src/inboxsdk-js/inboxsdk-REMOTE.js +3 -1
- package/src/inboxsdk-js/inboxsdk-TEST.js +4 -3
- package/src/inboxsdk-js/inboxsdk.js +33 -39
- package/src/inboxsdk-js/loading/load-platform-implementation-DEV.js +15 -18
- package/src/injected-js/gmail/modify-suggestions.test.js +8 -9
- package/src/injected-js/gmail/setup-gmail-interceptor.js +340 -579
- package/src/injected-js/gmail/sync-compose-request-processor.test.js +39 -49
- package/src/injected-js/gmail/thread-identifier/click-and-get-popup-url.js +20 -33
- package/src/injected-js/gmail/thread-identifier/index.js +57 -93
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.js +22 -31
- package/src/injected-js/gmail/thread-identifier/thread-row-parser.test.js +12 -28
- package/src/injected-js/inbox/setupAjaxInterceptor.js +64 -121
- package/src/injected-js/inbox/setupClickAndGetNewIframeSrc.js +53 -66
- package/src/injected-js/inbox/setupComposeViewDraftIDFinder.js +20 -36
- package/src/injected-js/inbox/setupInboxFakeWindowResizeListener.js +13 -13
- package/src/injected-js/main.js +11 -24
- package/src/injected-js/message-metadata-holder.js +52 -82
- package/src/injected-js/setup-data-exposer.js +89 -148
- package/src/injected-js/setup-error-silencer.js +21 -21
- package/src/injected-js/setup-event-reemitter.js +30 -22
- package/src/injected-js/setupInboxCustomViewLinkFixer.js +24 -29
- package/src/injected-js/setupPushStateListener.js +18 -11
- package/src/injected-js/xhr-helper.js +62 -65
- package/src/injected-js/xhr-proxy-factory.js +195 -445
- package/src/injected-js/xhr-proxy-factory.test.js +824 -991
- package/src/platform-implementation-js/constants/router.js +14 -9
- package/src/platform-implementation-js/constants/toolbars.js +8 -3
- package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +13 -13
- package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +115 -136
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +13 -14
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +27 -48
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +31 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +10 -18
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +21 -28
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.js +33 -45
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/gmail-load-event.js +31 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +58 -65
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +40 -124
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-draft-by-message-id.test.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -80
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +19 -26
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +71 -147
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +91 -148
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +150 -166
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +70 -120
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +15 -15
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +44 -67
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +230 -379
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +121 -307
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +17 -24
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +41 -49
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +30 -40
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +28 -60
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +61 -133
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +30 -42
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +52 -46
- package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +354 -694
- package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +77 -93
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.js +35 -82
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.test.js +44 -94
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-global-icon-area.js +12 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-companion-thread-icon-area.js +17 -29
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/add-to-icon-area.js +26 -26
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/primary/index.js +391 -797
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view/monitor-top-banner-size-and-react.js +7 -9
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.js +60 -109
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-area-view.js +95 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.js +103 -211
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-attachment-card-view.test.js +61 -61
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +17 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-collapsible-section-view.js +188 -541
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-button.js +67 -135
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-compose-notice.js +27 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-inner-sidebar.js +7 -13
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-outer-sidebar.js +9 -22
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-recipient-row.js +36 -63
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/add-tooltip-to-button.js +38 -113
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-app-button-toolbars-are-closed.js +11 -16
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/ensure-grouping-is-open.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/focus.js +8 -11
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/from-manager.js +27 -47
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-additional-action-toolbar.js +11 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-address-changes-stream.js +59 -111
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-body-changes-stream.js +15 -14
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-formatting-area-offset-left.js +11 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-minimized-stream.js +18 -24
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/get-response-type-changes-stream.js +19 -23
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/insert-link-into-body.js +11 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/manage-button-grouping.js +141 -376
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/monitor-selection-range.js +17 -28
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/override-edit-subject.js +34 -70
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/position-formatting-toolbar.js +10 -17
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/size-fixer.js +83 -137
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view/update-insert-more-area-left.js +10 -19
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.js +632 -1190
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view/get-updated-contact.js +29 -38
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.js +327 -617
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.js +26 -49
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +188 -380
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.js +104 -194
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.js +382 -811
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view/add-icon-area.js +34 -58
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.js +330 -581
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-sidebar-view.test.js +123 -277
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view/width-manager.js +15 -35
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.js +216 -571
- package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.js +152 -336
- package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.js +87 -211
- package/src/platform-implementation-js/dom-driver/gmail/widgets/buttons/inbox-dropdown-button-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-action-button-view.js +20 -29
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-label-view.js +41 -76
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +45 -99
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +76 -128
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-tooltip-view.js +128 -319
- package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +45 -78
- package/src/platform-implementation-js/dom-driver/inbox/__mocks__/getSidebarClassnames.js +8 -4
- package/src/platform-implementation-js/dom-driver/inbox/addNavItem.js +36 -54
- package/src/platform-implementation-js/dom-driver/inbox/addRecipientRow.js +35 -53
- package/src/platform-implementation-js/dom-driver/inbox/createLink.js +13 -15
- package/src/platform-implementation-js/dom-driver/inbox/createLink.test.js +15 -18
- package/src/platform-implementation-js/dom-driver/inbox/custom-style.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/appToolbarLocation/parser.js +14 -20
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentCard/parser.js +14 -13
- package/src/platform-implementation-js/dom-driver/inbox/detection/attachmentOverlay/parser.js +35 -67
- package/src/platform-implementation-js/dom-driver/inbox/detection/chatSidebar/parser.js +16 -18
- package/src/platform-implementation-js/dom-driver/inbox/detection/compose/parser.js +68 -185
- package/src/platform-implementation-js/dom-driver/inbox/detection/message/parser.js +28 -56
- package/src/platform-implementation-js/dom-driver/inbox/detection/nativeDrawer/parser.js +12 -10
- package/src/platform-implementation-js/dom-driver/inbox/detection/searchBar/parser.js +16 -16
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread/parser.js +24 -35
- package/src/platform-implementation-js/dom-driver/inbox/detection/thread-row/parser.js +37 -89
- package/src/platform-implementation-js/dom-driver/inbox/getComposeViewDriverLiveSet.js +56 -78
- package/src/platform-implementation-js/dom-driver/inbox/getInboxMessageIdForInboxThreadId.js +26 -32
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.js +52 -109
- package/src/platform-implementation-js/dom-driver/inbox/getSidebarClassnames.test.js +7 -8
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.js +16 -20
- package/src/platform-implementation-js/dom-driver/inbox/gotoView.test.js +15 -16
- package/src/platform-implementation-js/dom-driver/inbox/inbox-butter-bar-driver.js +75 -83
- package/src/platform-implementation-js/dom-driver/inbox/inbox-driver.js +530 -822
- package/src/platform-implementation-js/dom-driver/inbox/inbox-page-communicator.js +48 -61
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.js +9 -12
- package/src/platform-implementation-js/dom-driver/inbox/inboxResponseProcessor.test.js +12 -19
- package/src/platform-implementation-js/dom-driver/inbox/makePageParserTree.js +24 -33
- package/src/platform-implementation-js/dom-driver/inbox/pageParserOptions.js +201 -388
- package/src/platform-implementation-js/dom-driver/inbox/registerSearchSuggestionsProvider.js +249 -265
- package/src/platform-implementation-js/dom-driver/inbox/setupCustomAutocompleteSelectionHandling.js +84 -152
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.js +55 -67
- package/src/platform-implementation-js/dom-driver/inbox/setupRouteViewDriverStream.test.js +43 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxLabelView.js +31 -56
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxMoleViewDriver.js +191 -294
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarButtonView.js +32 -45
- package/src/platform-implementation-js/dom-driver/inbox/views/InboxToolbarView.js +21 -39
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-sidebar-view.js +153 -240
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-button-view.js +75 -150
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-app-toolbar-tooltip-view.js +20 -37
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-card-view.js +60 -114
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-attachment-overlay-view.js +47 -65
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-backdrop.js +41 -52
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-chat-sidebar-view.js +27 -36
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-button-view.js +52 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-compose-view.js +465 -649
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.js +37 -58
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-custom-route-view.test.js +14 -26
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.js +118 -235
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dropdown-view.js +10 -11
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-dummy-route-view.js +28 -46
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-message-view.js +131 -202
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-modal-view.js +40 -80
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-route-view.js +35 -61
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-row-view.js +124 -221
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.js +125 -213
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-thread-view.test.js +104 -126
- package/src/platform-implementation-js/dom-driver/inbox/views/inbox-tooltip-view.js +36 -51
- package/src/platform-implementation-js/dom-driver/inbox/views/inboxNavItemView.js +158 -297
- package/src/platform-implementation-js/dom-driver/inbox/waitForAnimationClickBlockerGone.js +21 -35
- package/src/platform-implementation-js/driver-common/compose/getDiscardStream.js +24 -43
- package/src/platform-implementation-js/driver-common/compose/getPresendingStream.js +39 -68
- package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.js +14 -19
- package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.js +27 -35
- package/src/platform-implementation-js/driver-common/getRfcMessageIdForSyncMessageId.js +16 -22
- package/src/platform-implementation-js/driver-common/getThreadIdFromMessageId.js +14 -14
- package/src/platform-implementation-js/driver-common/inboxAjax.js +12 -7
- package/src/platform-implementation-js/driver-common/requestGmailThread.js +19 -20
- package/src/platform-implementation-js/driver-common/sidebar/AppSidebar.js +197 -306
- package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.js +113 -161
- package/src/platform-implementation-js/driver-interfaces/compose-view-driver.js +1 -114
- package/src/platform-implementation-js/driver-interfaces/driver.js +1 -131
- package/src/platform-implementation-js/driver-interfaces/message-view-driver.js +4 -48
- package/src/platform-implementation-js/driver-interfaces/mole-view-driver.js +1 -29
- package/src/platform-implementation-js/driver-interfaces/route-view-driver.js +1 -32
- package/src/platform-implementation-js/driver-interfaces/thread-row-view-driver.js +1 -11
- package/src/platform-implementation-js/lib/array-to-lifetimes.js +43 -41
- package/src/platform-implementation-js/lib/array-to-lifetimes.test.js +139 -155
- package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +19 -38
- package/src/platform-implementation-js/lib/css-selector-escape.js +7 -3
- package/src/platform-implementation-js/lib/dom/element-view-mapper.js +8 -11
- package/src/platform-implementation-js/lib/dom/get-selection.js +23 -52
- package/src/platform-implementation-js/lib/dom/insert-html-at-cursor.js +69 -101
- package/src/platform-implementation-js/lib/dom/is-node-in-range.js +8 -10
- package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +15 -17
- package/src/platform-implementation-js/lib/dom/querySelectorOne.js +8 -11
- package/src/platform-implementation-js/lib/dom/set-css.js +7 -3
- package/src/platform-implementation-js/lib/dom/set-value-and-dispatch-event.js +9 -11
- package/src/platform-implementation-js/lib/dom/simulate-drag-and-drop.js +32 -33
- package/src/platform-implementation-js/lib/extract-contact-from-email-contact-string.test.js +23 -26
- package/src/platform-implementation-js/lib/handle-compose-link-chips.js +86 -149
- package/src/platform-implementation-js/lib/insert-link-chip-into-body.js +42 -57
- package/src/platform-implementation-js/lib/make-revocable-function.js +19 -21
- package/src/platform-implementation-js/lib/make-revocable-function.test.js +20 -22
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.js +15 -17
- package/src/platform-implementation-js/lib/parseParamsFromRouteID.test.js +9 -18
- package/src/platform-implementation-js/lib/populateRouteID.js +8 -9
- package/src/platform-implementation-js/lib/populateRouteID.test.js +20 -19
- package/src/platform-implementation-js/lib/react/ElementContainer.js +23 -20
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +10 -9
- package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +13 -20
- package/src/platform-implementation-js/lib/routeIDmatchesHash.js +13 -18
- package/src/platform-implementation-js/lib/routeIDmatchesHash.test.js +11 -17
- package/src/platform-implementation-js/lib/shared-style.js +14 -13
- package/src/platform-implementation-js/lib/toItemWithLifetimeStream.js +18 -17
- package/src/platform-implementation-js/lib/toLiveSet.js +17 -15
- package/src/platform-implementation-js/main-INTEGRATED-PAGEWORLD.js +6 -5
- package/src/platform-implementation-js/main.js +9 -24
- package/src/platform-implementation-js/namespaces/compose.js +37 -60
- package/src/platform-implementation-js/namespaces/conversations.js +52 -124
- package/src/platform-implementation-js/namespaces/global.js +27 -39
- package/src/platform-implementation-js/namespaces/keyboard.js +29 -33
- package/src/platform-implementation-js/namespaces/lists.js +25 -31
- package/src/platform-implementation-js/namespaces/modal.js +34 -28
- package/src/platform-implementation-js/namespaces/nav-menu.js +30 -45
- package/src/platform-implementation-js/namespaces/router.js +70 -137
- package/src/platform-implementation-js/namespaces/search.js +19 -17
- package/src/platform-implementation-js/namespaces/toolbars.js +71 -117
- package/src/platform-implementation-js/namespaces/user.js +36 -37
- package/src/platform-implementation-js/namespaces/widgets.js +54 -61
- package/src/platform-implementation-js/platform-implementation.js +98 -229
- package/src/platform-implementation-js/views/app-toolbar-button-view.js +26 -47
- package/src/platform-implementation-js/views/collapsible-section-view.js +66 -63
- package/src/platform-implementation-js/views/content-panel-view.js +28 -30
- package/src/platform-implementation-js/views/conversations/attachment-card-view.js +21 -44
- package/src/platform-implementation-js/views/conversations/custom-message-view.js +44 -104
- package/src/platform-implementation-js/views/conversations/message-view.js +131 -202
- package/src/platform-implementation-js/views/conversations/thread-view.js +75 -127
- package/src/platform-implementation-js/views/native-nav-item-view.js +32 -65
- package/src/platform-implementation-js/views/nav-item-view.js +51 -115
- package/src/platform-implementation-js/views/route-view/custom-route-view.js +25 -20
- package/src/platform-implementation-js/views/route-view/dummy-route-view-driver.js +18 -18
- package/src/platform-implementation-js/views/route-view/list-route-view.js +30 -52
- package/src/platform-implementation-js/views/route-view/route-view.js +24 -35
- package/src/platform-implementation-js/views/section-view.js +60 -52
- package/src/platform-implementation-js/views/thread-row-view.js +49 -74
- package/src/platform-implementation-js/widgets/drawer-view.js +29 -36
- package/src/platform-implementation-js/widgets/modal-view.js +39 -68
- package/src/platform-implementation-js/widgets/mole-view.js +22 -22
- package/src/platform-implementation-js/widgets/top-message-bar-view.js +13 -10
|
@@ -1,189 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
gmailRouteProcessor: GmailRouteProcessor,
|
|
16
|
-
driver: GmailDriver
|
|
17
|
-
): Kefir.Observable<GmailRouteView> {
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = setupRouteViewDriverStream;
|
|
8
|
+
var _kefir = _interopRequireDefault(require("kefir"));
|
|
9
|
+
var _getOrFail = _interopRequireDefault(require("../../../../common/get-or-fail"));
|
|
10
|
+
var _gmailElementGetter = _interopRequireDefault(require("../gmail-element-getter"));
|
|
11
|
+
var _gmailRouteView = _interopRequireDefault(require("../views/gmail-route-view/gmail-route-view"));
|
|
12
|
+
var _getUrlObject = _interopRequireDefault(require("./get-url-object"));
|
|
13
|
+
var _routeIDmatchesHash = _interopRequireDefault(require("../../../lib/routeIDmatchesHash"));
|
|
14
|
+
function setupRouteViewDriverStream(gmailRouteProcessor, driver) {
|
|
18
15
|
const customRouteIDs = driver.getCustomRouteIDs();
|
|
19
16
|
const customListRouteIDs = driver.getCustomListRouteIDs();
|
|
20
|
-
const customListSearchStringsToRouteIds =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let lastNativeHash = getURLObject(document.location.href).hash;
|
|
17
|
+
const customListSearchStringsToRouteIds = driver.getCustomListSearchStringsToRouteIds();
|
|
18
|
+
let lastNativeHash = (0, _getUrlObject.default)(document.location.href).hash;
|
|
24
19
|
let latestGmailRouteView = null;
|
|
25
|
-
|
|
26
20
|
driver.getStopper().onValue(() => {
|
|
27
21
|
if (latestGmailRouteView) {
|
|
28
22
|
latestGmailRouteView.destroy();
|
|
29
23
|
}
|
|
30
24
|
});
|
|
31
|
-
|
|
32
25
|
let lastHash = lastNativeHash;
|
|
33
|
-
|
|
34
26
|
let sameRouteData = {};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
for (let [routeIDs] of customListRouteIDs) {
|
|
53
|
-
let routeID = routeIDmatchesHash(routeIDs, name);
|
|
54
|
-
if (routeID) {
|
|
55
|
-
return { urlObject, type: 'CUSTOM_LIST_TRIGGER', routeID };
|
|
56
|
-
}
|
|
27
|
+
const eligibleHashChanges = _kefir.default.fromEvents(window, 'hashchange').filter(event => !event.oldURL.match(/#inboxsdk-fake-no-vc$/)).map(event => ({
|
|
28
|
+
new: (0, _getUrlObject.default)(event.newURL),
|
|
29
|
+
old: (0, _getUrlObject.default)(event.oldURL)
|
|
30
|
+
})).filter(event => event.new.hash !== event.old.hash).map(event => event.new).map(urlObject => {
|
|
31
|
+
const {
|
|
32
|
+
hash,
|
|
33
|
+
name
|
|
34
|
+
} = urlObject;
|
|
35
|
+
for (let routeIDs of customRouteIDs) {
|
|
36
|
+
let routeID = (0, _routeIDmatchesHash.default)(routeIDs, hash);
|
|
37
|
+
if (routeID) {
|
|
38
|
+
return {
|
|
39
|
+
urlObject,
|
|
40
|
+
type: 'CUSTOM',
|
|
41
|
+
routeID
|
|
42
|
+
};
|
|
57
43
|
}
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
}
|
|
45
|
+
for (let [routeIDs] of customListRouteIDs) {
|
|
46
|
+
let routeID = (0, _routeIDmatchesHash.default)(routeIDs, name);
|
|
47
|
+
if (routeID) {
|
|
48
|
+
return {
|
|
49
|
+
urlObject,
|
|
50
|
+
type: 'CUSTOM_LIST_TRIGGER',
|
|
51
|
+
routeID
|
|
52
|
+
};
|
|
60
53
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
}
|
|
55
|
+
if (gmailRouteProcessor.isNativeRoute(urlObject.name)) {
|
|
56
|
+
return {
|
|
57
|
+
urlObject,
|
|
58
|
+
type: 'NATIVE'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
urlObject,
|
|
63
|
+
type: 'OTHER_APP_CUSTOM'
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
const customAndCustomListRouteHashChanges = eligibleHashChanges.filter(_ref => {
|
|
67
|
+
let {
|
|
68
|
+
type
|
|
69
|
+
} = _ref;
|
|
70
|
+
return type !== 'NATIVE';
|
|
71
|
+
});
|
|
67
72
|
|
|
68
73
|
// If a user goes from a native route to a custom route, and then back to the
|
|
69
74
|
// same native route, we need to make a new GmailRouteView because
|
|
70
75
|
// getMainContentElementChangedStream() won't be firing, except when going from thread->custom->thread
|
|
71
|
-
const revertNativeHashChanges = eligibleHashChanges
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const revertNativeHashChanges = eligibleHashChanges.filter(_ref2 => {
|
|
77
|
+
let {
|
|
78
|
+
type
|
|
79
|
+
} = _ref2;
|
|
80
|
+
return type === 'NATIVE';
|
|
81
|
+
}).filter(_ref3 => {
|
|
82
|
+
let {
|
|
83
|
+
urlObject
|
|
84
|
+
} = _ref3;
|
|
85
|
+
const tmp = lastNativeHash;
|
|
86
|
+
lastNativeHash = urlObject.hash;
|
|
87
|
+
return tmp === urlObject.hash;
|
|
88
|
+
}).filter(_ref4 => {
|
|
89
|
+
let {
|
|
90
|
+
urlObject
|
|
91
|
+
} = _ref4;
|
|
92
|
+
return urlObject.hash !== lastHash;
|
|
93
|
+
});
|
|
81
94
|
|
|
82
95
|
// Merge everything that can trigger a new RouteView
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// since they're not lists.
|
|
118
|
-
if (
|
|
119
|
-
urlObject.params.length === 1 ||
|
|
120
|
-
(urlObject.params.length === 2 && urlObject.params[1][0] === 'p')
|
|
121
|
-
) {
|
|
122
|
-
driver.hashChangeNoViewChange(
|
|
123
|
-
'#' +
|
|
124
|
-
customListRouteId +
|
|
125
|
-
(urlObject.params[1] ? '/' + urlObject.params[1] : '')
|
|
126
|
-
);
|
|
127
|
-
return {
|
|
128
|
-
type: 'CUSTOM_LIST',
|
|
129
|
-
urlObject,
|
|
130
|
-
routeID: customListRouteId,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
96
|
+
return _kefir.default.merge([customAndCustomListRouteHashChanges, revertNativeHashChanges,
|
|
97
|
+
// when native gmail changes main view there's a div that takes on role=main.
|
|
98
|
+
// getMainContentElementChangedStream doesn't respect custom views so filter
|
|
99
|
+
// out events from it. This filter is needed if the user is already at a custom
|
|
100
|
+
// view of another InboxSDK instance while this starts up.
|
|
101
|
+
_gmailElementGetter.default.getMainContentElementChangedStream().map(event => ({
|
|
102
|
+
urlObject: (0, _getUrlObject.default)(document.location.href),
|
|
103
|
+
type: 'NATIVE'
|
|
104
|
+
})).filter(options => gmailRouteProcessor.isNativeRoute(options.urlObject.name))]).map(options => {
|
|
105
|
+
const {
|
|
106
|
+
type,
|
|
107
|
+
urlObject
|
|
108
|
+
} = options;
|
|
109
|
+
if (type === 'NATIVE' && urlObject.name === 'search') {
|
|
110
|
+
const customListRouteId = customListSearchStringsToRouteIds.get(urlObject.params[0]);
|
|
111
|
+
if (customListRouteId) {
|
|
112
|
+
const searchInput = _gmailElementGetter.default.getSearchInput();
|
|
113
|
+
if (!searchInput) throw new Error('Should not happen');
|
|
114
|
+
searchInput.value = '';
|
|
115
|
+
|
|
116
|
+
// Only rewrite the url if it's a search query with no further
|
|
117
|
+
// parameters or it has a page parameter. Don't write URLs with thread
|
|
118
|
+
// id parameters because currently other parts of the code depend on
|
|
119
|
+
// being able to parse the URL as a normal thread URL.
|
|
120
|
+
|
|
121
|
+
// Additionally, we don't want to treat threads as the CUSTOM_LIST type
|
|
122
|
+
// since they're not lists.
|
|
123
|
+
if (urlObject.params.length === 1 || urlObject.params.length === 2 && urlObject.params[1][0] === 'p') {
|
|
124
|
+
driver.hashChangeNoViewChange('#' + customListRouteId + (urlObject.params[1] ? '/' + urlObject.params[1] : ''));
|
|
125
|
+
return {
|
|
126
|
+
type: 'CUSTOM_LIST',
|
|
127
|
+
urlObject,
|
|
128
|
+
routeID: customListRouteId
|
|
129
|
+
};
|
|
133
130
|
}
|
|
134
131
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
sameRouteData[urlObject.hash].lastUsedTimestamp = Date.now();
|
|
147
|
-
|
|
148
|
-
if (Object.keys(sameRouteData).length > MAX_KEY_CACHE) {
|
|
149
|
-
sameRouteData = Object.keys(sameRouteData)
|
|
150
|
-
.sort(
|
|
151
|
-
(a, b) =>
|
|
152
|
-
sameRouteData[b].lastUsedTimestamp -
|
|
153
|
-
sameRouteData[a].lastUsedTimestamp
|
|
154
|
-
)
|
|
155
|
-
.slice(0, MAX_KEY_CACHE / 2)
|
|
156
|
-
.reduce((acc, hash) => ({ ...acc, [hash]: sameRouteData[hash] }), {});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
...options,
|
|
161
|
-
cachedRouteData: sameRouteData[urlObject.hash].data,
|
|
132
|
+
}
|
|
133
|
+
return options;
|
|
134
|
+
}).map(options => {
|
|
135
|
+
const MAX_KEY_CACHE = 50;
|
|
136
|
+
const {
|
|
137
|
+
urlObject
|
|
138
|
+
} = options;
|
|
139
|
+
if (!sameRouteData[urlObject.hash]) {
|
|
140
|
+
sameRouteData[urlObject.hash] = {
|
|
141
|
+
data: {}
|
|
162
142
|
};
|
|
163
|
-
}
|
|
164
|
-
.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
143
|
+
}
|
|
144
|
+
sameRouteData[urlObject.hash].lastUsedTimestamp = Date.now();
|
|
145
|
+
if (Object.keys(sameRouteData).length > MAX_KEY_CACHE) {
|
|
146
|
+
sameRouteData = Object.keys(sameRouteData).sort((a, b) => sameRouteData[b].lastUsedTimestamp - sameRouteData[a].lastUsedTimestamp).slice(0, MAX_KEY_CACHE / 2).reduce((acc, hash) => ({
|
|
147
|
+
...acc,
|
|
148
|
+
[hash]: sameRouteData[hash]
|
|
149
|
+
}), {});
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
...options,
|
|
153
|
+
cachedRouteData: sameRouteData[urlObject.hash].data
|
|
154
|
+
};
|
|
155
|
+
}).map(options => {
|
|
156
|
+
if (options.type === 'NATIVE' || options.type === 'CUSTOM_LIST') {
|
|
157
|
+
driver.showNativeRouteView();
|
|
158
|
+
} else if (options.type === 'CUSTOM_LIST_TRIGGER') {
|
|
159
|
+
driver.showCustomThreadList(options.routeID, (0, _getOrFail.default)(customListRouteIDs, options.routeID), options.urlObject.params);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
return new _gmailRouteView.default(options, gmailRouteProcessor, driver);
|
|
163
|
+
}).filter(Boolean).map(gmailRouteView => {
|
|
164
|
+
if (latestGmailRouteView) {
|
|
165
|
+
latestGmailRouteView.destroy();
|
|
166
|
+
}
|
|
167
|
+
latestGmailRouteView = gmailRouteView;
|
|
168
|
+
lastHash = (0, _getUrlObject.default)(document.location.href).hash;
|
|
169
|
+
return gmailRouteView;
|
|
170
|
+
});
|
|
187
171
|
}
|
|
188
172
|
|
|
189
173
|
/*
|
|
@@ -191,4 +175,4 @@ export default function setupRouteViewDriverStream(
|
|
|
191
175
|
*
|
|
192
176
|
* SDK only cares about hash change when the hash goes to a route that the app registered as custom.
|
|
193
177
|
* Otherwise it only responds to route changes when the role=main div changes.
|
|
194
|
-
*/
|
|
178
|
+
*/
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import MockMutationObserver from '../../../../../test/lib/mock-mutation-observer';
|
|
16
|
-
|
|
17
|
-
global.MutationObserver = MockMutationObserver;
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
5
|
+
var _kefirBus = _interopRequireDefault(require("kefir-bus"));
|
|
6
|
+
var _pdelay = _interopRequireDefault(require("pdelay"));
|
|
7
|
+
var _setupRouteViewDriverStream = _interopRequireDefault(require("./setup-route-view-driver-stream"));
|
|
8
|
+
var _gmailRouteProcessor = _interopRequireDefault(require("../views/gmail-route-view/gmail-route-processor"));
|
|
9
|
+
var _makeElementIntoEventEmitter = _interopRequireDefault(require("../../../../../test/lib/makeElementIntoEventEmitter"));
|
|
10
|
+
var _mockMutationObserver = _interopRequireDefault(require("../../../../../test/lib/mock-mutation-observer"));
|
|
11
|
+
jest.mock('../views/gmail-route-view/gmail-route-view', () => jest.fn(() => ({
|
|
12
|
+
destroy() {}
|
|
13
|
+
})));
|
|
14
|
+
global.MutationObserver = _mockMutationObserver.default;
|
|
19
15
|
if (!document.body) throw new Error('should not happen');
|
|
20
16
|
document.body.innerHTML = `
|
|
21
17
|
<div class="aeF">
|
|
@@ -28,164 +24,128 @@ document.body.innerHTML = `
|
|
|
28
24
|
const main = document.getElementById('main');
|
|
29
25
|
const main2 = document.getElementById('main2');
|
|
30
26
|
if (!main || !main2) throw new Error();
|
|
31
|
-
const mainEmitter =
|
|
32
|
-
const main2Emitter =
|
|
33
|
-
|
|
34
|
-
const stopper = kefirBus();
|
|
27
|
+
const mainEmitter = (0, _makeElementIntoEventEmitter.default)(main);
|
|
28
|
+
const main2Emitter = (0, _makeElementIntoEventEmitter.default)(main2);
|
|
29
|
+
const stopper = (0, _kefirBus.default)();
|
|
35
30
|
afterEach(() => {
|
|
36
31
|
stopper.emit(null);
|
|
37
32
|
});
|
|
38
|
-
|
|
39
|
-
function makeMockDriver(): Object {
|
|
33
|
+
function makeMockDriver() {
|
|
40
34
|
return {
|
|
41
|
-
getStopper:
|
|
42
|
-
getCustomRouteIDs:
|
|
43
|
-
getCustomListRouteIDs:
|
|
44
|
-
getCustomListSearchStringsToRouteIds:
|
|
35
|
+
getStopper: _lodash.default.constant(stopper),
|
|
36
|
+
getCustomRouteIDs: _lodash.default.constant(new Set()),
|
|
37
|
+
getCustomListRouteIDs: _lodash.default.constant(new Map()),
|
|
38
|
+
getCustomListSearchStringsToRouteIds: _lodash.default.constant(new Map()),
|
|
45
39
|
hashChangeNoViewChange: jest.fn(),
|
|
46
40
|
showNativeRouteView: jest.fn(),
|
|
47
|
-
showCustomThreadList: jest.fn()
|
|
41
|
+
showCustomThreadList: jest.fn()
|
|
48
42
|
};
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
test('role=main changes are seen', async () => {
|
|
52
45
|
const items = [];
|
|
53
46
|
window.location.hash = '#inbox';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
items.push(item);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await delay(1);
|
|
47
|
+
(0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), makeMockDriver()).takeUntilBy(stopper).onValue(item => {
|
|
48
|
+
items.push(item);
|
|
49
|
+
});
|
|
50
|
+
await (0, _pdelay.default)(1);
|
|
62
51
|
expect(items.length).toBe(1);
|
|
63
|
-
|
|
64
52
|
main.style.display = 'none';
|
|
65
53
|
main2.style.display = '';
|
|
66
|
-
mainEmitter({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
mainEmitter({
|
|
55
|
+
attributeName: 'style'
|
|
56
|
+
});
|
|
57
|
+
main2Emitter({
|
|
58
|
+
attributeName: 'style'
|
|
59
|
+
});
|
|
60
|
+
await (0, _pdelay.default)(1);
|
|
70
61
|
expect(items.length).toBe(2);
|
|
71
|
-
|
|
72
62
|
main.style.display = '';
|
|
73
63
|
main2.style.display = 'none';
|
|
74
|
-
mainEmitter({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
mainEmitter({
|
|
65
|
+
attributeName: 'style'
|
|
66
|
+
});
|
|
67
|
+
main2Emitter({
|
|
68
|
+
attributeName: 'style'
|
|
69
|
+
});
|
|
70
|
+
await (0, _pdelay.default)(1);
|
|
78
71
|
expect(items.length).toBe(3);
|
|
79
72
|
});
|
|
80
|
-
|
|
81
73
|
test('custom view hashchanges are seen', async () => {
|
|
82
74
|
const items = [];
|
|
83
75
|
const driver = makeMockDriver();
|
|
84
76
|
driver.getCustomRouteIDs().add('foo');
|
|
85
77
|
driver.getCustomRouteIDs().add('bar');
|
|
86
78
|
window.location.hash = '#inbox';
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
items.push(item);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
await delay(1);
|
|
79
|
+
(0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
|
|
80
|
+
items.push(item);
|
|
81
|
+
});
|
|
82
|
+
await (0, _pdelay.default)(1);
|
|
95
83
|
expect(items.length).toBe(1);
|
|
96
84
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
97
|
-
|
|
98
85
|
window.location.hash = '#foo';
|
|
99
|
-
|
|
100
|
-
await delay(1);
|
|
86
|
+
await (0, _pdelay.default)(1);
|
|
101
87
|
expect(items.length).toBe(2);
|
|
102
88
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
103
|
-
|
|
104
89
|
window.location.hash = '#foo/123';
|
|
105
|
-
|
|
106
|
-
await delay(1);
|
|
90
|
+
await (0, _pdelay.default)(1);
|
|
107
91
|
expect(items.length).toBe(3);
|
|
108
92
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
109
93
|
|
|
110
94
|
// Setting to the same hash should NOT make a new routeview.
|
|
111
95
|
window.location.hash = '#foo/123?compose=123';
|
|
112
|
-
|
|
113
|
-
await delay(1);
|
|
96
|
+
await (0, _pdelay.default)(1);
|
|
114
97
|
expect(items.length).toBe(3);
|
|
115
98
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
116
|
-
|
|
117
99
|
window.location.hash = '#bar';
|
|
118
|
-
|
|
119
|
-
await delay(1);
|
|
100
|
+
await (0, _pdelay.default)(1);
|
|
120
101
|
expect(items.length).toBe(4);
|
|
121
102
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
122
103
|
});
|
|
123
|
-
|
|
124
104
|
test('native hash changes are ignored', async () => {
|
|
125
105
|
// We don't pay attention to native hash changes usually. We settle for
|
|
126
106
|
// watching a new [role=main] element become displayed.
|
|
127
107
|
const items = [];
|
|
128
108
|
const driver = makeMockDriver();
|
|
129
109
|
window.location.hash = '#inbox';
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
items.push(item);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
await delay(1);
|
|
110
|
+
(0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
|
|
111
|
+
items.push(item);
|
|
112
|
+
});
|
|
113
|
+
await (0, _pdelay.default)(1);
|
|
138
114
|
expect(items.length).toBe(1);
|
|
139
115
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
140
|
-
|
|
141
116
|
window.location.hash = '#starred';
|
|
142
|
-
|
|
143
|
-
await delay(1);
|
|
117
|
+
await (0, _pdelay.default)(1);
|
|
144
118
|
expect(items.length).toBe(1);
|
|
145
119
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
146
120
|
});
|
|
147
|
-
|
|
148
121
|
test('revertNativeHashChanges works', async () => {
|
|
149
122
|
const items = [];
|
|
150
123
|
const driver = makeMockDriver();
|
|
151
124
|
driver.getCustomRouteIDs().add('foo');
|
|
152
125
|
window.location.hash = '#inbox';
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
items.push(item);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
await delay(1);
|
|
126
|
+
(0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
|
|
127
|
+
items.push(item);
|
|
128
|
+
});
|
|
129
|
+
await (0, _pdelay.default)(1);
|
|
161
130
|
expect(items.length).toBe(1);
|
|
162
131
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
163
|
-
|
|
164
132
|
window.location.hash = '#foo';
|
|
165
|
-
|
|
166
|
-
await delay(1);
|
|
133
|
+
await (0, _pdelay.default)(1);
|
|
167
134
|
expect(items.length).toBe(2);
|
|
168
135
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
169
|
-
|
|
170
136
|
window.location.hash = '#inbox';
|
|
171
|
-
|
|
172
|
-
await delay(1);
|
|
137
|
+
await (0, _pdelay.default)(1);
|
|
173
138
|
expect(items.length).toBe(3);
|
|
174
139
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
|
|
175
|
-
|
|
176
140
|
window.location.hash = '#foo';
|
|
177
|
-
|
|
178
|
-
await delay(1);
|
|
141
|
+
await (0, _pdelay.default)(1);
|
|
179
142
|
expect(items.length).toBe(4);
|
|
180
143
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
|
|
181
|
-
|
|
182
144
|
window.location.hash = '#inbox';
|
|
183
|
-
|
|
184
|
-
await delay(1);
|
|
145
|
+
await (0, _pdelay.default)(1);
|
|
185
146
|
expect(items.length).toBe(5);
|
|
186
147
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(3);
|
|
187
148
|
});
|
|
188
|
-
|
|
189
149
|
test('revertNativeHashChanges and ?compose parameter play nicely together', async () => {
|
|
190
150
|
// If you make a draft while at a native route view, Gmail adds ?compose=ID
|
|
191
151
|
// to the hash. If you edit the draft, Gmail updates the ID in the hash. If
|
|
@@ -201,33 +161,23 @@ test('revertNativeHashChanges and ?compose parameter play nicely together', asyn
|
|
|
201
161
|
const driver = makeMockDriver();
|
|
202
162
|
driver.getCustomRouteIDs().add('foo');
|
|
203
163
|
window.location.hash = '#inbox';
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
items.push(item);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
await delay(1);
|
|
164
|
+
(0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
|
|
165
|
+
items.push(item);
|
|
166
|
+
});
|
|
167
|
+
await (0, _pdelay.default)(1);
|
|
212
168
|
expect(items.length).toBe(1);
|
|
213
169
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
214
|
-
|
|
215
170
|
window.location.hash = '#inbox?compose=A';
|
|
216
|
-
|
|
217
|
-
await delay(1);
|
|
171
|
+
await (0, _pdelay.default)(1);
|
|
218
172
|
expect(items.length).toBe(1);
|
|
219
173
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
220
|
-
|
|
221
174
|
window.location.hash = '#foo';
|
|
222
|
-
|
|
223
|
-
await delay(1);
|
|
175
|
+
await (0, _pdelay.default)(1);
|
|
224
176
|
expect(items.length).toBe(2);
|
|
225
177
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
|
|
226
|
-
|
|
227
178
|
window.location.hash = '#inbox?compose=A';
|
|
228
179
|
window.location.hash = '#inbox?compose=B';
|
|
229
|
-
|
|
230
|
-
await delay(1);
|
|
180
|
+
await (0, _pdelay.default)(1);
|
|
231
181
|
expect(items.length).toBe(3);
|
|
232
182
|
expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
|
|
233
|
-
});
|
|
183
|
+
});
|