@inboxsdk/core 1.0.1 → 1.0.3

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 (147) hide show
  1. package/inboxsdk.js +5 -5
  2. package/inboxsdk.js.map +1 -1
  3. package/package.json +1 -1
  4. package/pageWorld.js.map +1 -1
  5. package/src/inboxsdk.d.ts +16 -1
  6. package/src/injected-js/gmail/modify-suggestions.d.ts +2 -0
  7. package/src/injected-js/gmail/modify-suggestions.d.ts.map +1 -1
  8. package/src/platform-implementation-js/constants/router.d.ts +5 -0
  9. package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts +2 -0
  10. package/src/platform-implementation-js/dom-driver/gmail/custom-style.d.ts.map +1 -0
  11. package/src/platform-implementation-js/dom-driver/gmail/custom-style.js +16 -21
  12. package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.d.ts +12 -0
  13. package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.d.ts.map +1 -0
  14. package/src/platform-implementation-js/dom-driver/gmail/gmail-butter-bar-driver.js +152 -187
  15. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts +1 -1
  16. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.d.ts.map +1 -1
  17. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-app-menu-item.js +1 -1
  18. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.d.ts +5 -0
  19. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.d.ts.map +1 -0
  20. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/add-toolbar-button-for-app.js +15 -20
  21. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.d.ts +4 -0
  22. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.d.ts.map +1 -0
  23. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/create-link.js +59 -56
  24. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.d.ts +9 -0
  25. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.d.ts.map +1 -0
  26. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-draft-id-for-message-id.js +42 -54
  27. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.d.ts +4 -0
  28. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.d.ts.map +1 -0
  29. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-native-nav-item.js +31 -33
  30. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.d.ts +8 -0
  31. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.d.ts.map +1 -0
  32. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/get-url-object.js +21 -23
  33. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.d.ts +4 -0
  34. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.d.ts.map +1 -0
  35. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadForOldGmailThreadId.js +19 -31
  36. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/getSyncThreadFromSyncThreadId.d.ts +7 -0
  37. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.d.ts +5 -0
  38. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.d.ts.map +1 -0
  39. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/goto-view.js +51 -60
  40. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.d.ts +20 -0
  41. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.d.ts.map +1 -0
  42. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/keyboard-shortcut-help-modifier.js +166 -130
  43. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.d.ts +3 -0
  44. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.d.ts.map +1 -0
  45. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/open-compose-window.js +17 -22
  46. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.d.ts +4 -0
  47. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.d.ts.map +1 -0
  48. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/override-gmail-back-button.js +44 -51
  49. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.d.ts +3 -0
  50. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.d.ts.map +1 -0
  51. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-query-rewriter.js +17 -22
  52. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.d.ts +3 -0
  53. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.d.ts.map +1 -0
  54. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/register-search-suggestions-provider.js +136 -129
  55. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.d.ts +6 -0
  56. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.d.ts.map +1 -0
  57. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-compose-view-driver-stream.js +102 -95
  58. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.d.ts +6 -0
  59. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.d.ts.map +1 -0
  60. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.js +144 -169
  61. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.d.ts +3 -0
  62. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.d.ts.map +1 -0
  63. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-app-id-warning.js +14 -23
  64. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.d.ts +3 -0
  65. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.d.ts.map +1 -0
  66. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-route-view.js +41 -49
  67. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.d.ts +5 -0
  68. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.d.ts.map +1 -0
  69. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.js +286 -294
  70. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.d.ts +3 -0
  71. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.d.ts.map +1 -0
  72. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-native-route-view.js +19 -26
  73. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.d.ts +3 -0
  74. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.d.ts.map +1 -0
  75. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/suppressAddon.js +36 -42
  76. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.d.ts +3 -0
  77. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.d.ts.map +1 -0
  78. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/temporary-track-download-url-validity.js +34 -33
  79. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.d.ts +13 -0
  80. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.d.ts.map +1 -0
  81. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/thread-row-identifier.js +80 -81
  82. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.d.ts +3 -0
  83. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.d.ts.map +1 -0
  84. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/track-events.js +124 -81
  85. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.d.ts +10 -0
  86. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.d.ts.map +1 -0
  87. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.js +47 -54
  88. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts +183 -106
  89. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.d.ts.map +1 -0
  90. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver.js +712 -647
  91. package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.d.ts +7 -0
  92. package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.d.ts.map +1 -0
  93. package/src/platform-implementation-js/dom-driver/gmail/make-xhr-interceptor.js +93 -82
  94. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-sidebar-view/index.d.ts +7 -0
  95. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-app-toolbar-button-view.d.ts +5 -0
  96. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.d.ts +11 -0
  97. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.d.ts.map +1 -0
  98. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-backdrop.js +20 -32
  99. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-compose-view.d.ts +1 -0
  100. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-message-view.d.ts +8 -0
  101. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts +2 -0
  102. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.d.ts.map +1 -1
  103. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-nav-item-view.js +1 -1
  104. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-processor.d.ts +8 -0
  105. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.d.ts +3 -0
  106. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-route-view/gmail-route-view.js +3 -1
  107. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-row-list-view.d.ts +10 -0
  108. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-row-view.d.ts +5 -0
  109. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-thread-view.d.ts +9 -0
  110. package/src/platform-implementation-js/dom-driver/gmail/views/gmail-toolbar-view.d.ts +12 -0
  111. package/src/platform-implementation-js/dom-driver/gmail/views/native-gmail-nav-item-view.d.ts +9 -0
  112. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.d.ts +20 -0
  113. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.d.ts.map +1 -0
  114. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-modal-view-driver.js +107 -108
  115. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.d.ts +16 -0
  116. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-mole-view-driver.js +1 -1
  117. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.d.ts +13 -0
  118. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.d.ts.map +1 -0
  119. package/src/platform-implementation-js/dom-driver/gmail/widgets/gmail-top-message-bar-driver.js +66 -66
  120. package/src/platform-implementation-js/dom-driver/inbox/views/inbox-drawer-view.d.ts +5 -0
  121. package/src/platform-implementation-js/driver-common/getGmailMessageIdForSyncMessageId.d.ts +6 -0
  122. package/src/platform-implementation-js/driver-common/getGmailThreadIdForRfcMessageId.d.ts +6 -0
  123. package/src/platform-implementation-js/driver-common/sidebar/ContentPanelViewDriver.d.ts +1 -0
  124. package/src/platform-implementation-js/driver-interfaces/driver.d.ts +3 -6
  125. package/src/platform-implementation-js/driver-interfaces/mole-view-driver.d.ts +27 -0
  126. package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.d.ts +4 -0
  127. package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.d.ts.map +1 -0
  128. package/src/platform-implementation-js/lib/copyAndValidateAutocompleteResults.js +34 -34
  129. package/src/platform-implementation-js/lib/dom/element-view-mapper.d.ts +10 -0
  130. package/src/platform-implementation-js/lib/dom/element-view-mapper.d.ts.map +1 -0
  131. package/src/platform-implementation-js/lib/dom/element-view-mapper.js +9 -17
  132. package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.d.ts +4 -0
  133. package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.d.ts.map +1 -0
  134. package/src/platform-implementation-js/lib/dom/on-mouse-down-and-up.js +7 -16
  135. package/src/platform-implementation-js/lib/populateRouteID.d.ts +6 -0
  136. package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts +2 -0
  137. package/src/platform-implementation-js/lib/rewriteCssWithIdMap.d.ts.map +1 -0
  138. package/src/platform-implementation-js/lib/rewriteCssWithIdMap.js +4 -11
  139. package/src/platform-implementation-js/lib/routeIDmatchesHash.d.ts +4 -0
  140. package/src/platform-implementation-js/lib/toLiveSet.d.ts +5 -0
  141. package/src/platform-implementation-js/lib/toLiveSet.d.ts.map +1 -0
  142. package/src/platform-implementation-js/lib/toLiveSet.js +22 -33
  143. package/src/platform-implementation-js/namespaces/router.d.ts +1 -0
  144. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/setup-route-view-driver-stream.test.js +0 -183
  145. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/show-custom-thread-list.test.js +0 -218
  146. package/src/platform-implementation-js/dom-driver/gmail/gmail-driver/user-info.test.js +0 -85
  147. package/src/platform-implementation-js/lib/rewriteCssWithIdMap.test.js +0 -43
@@ -1,17 +1,8 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ import fromEventTargetCapture from '../from-event-target-capture';
2
+ import { defn } from 'ud';
3
+ const pageMouseUps = fromEventTargetCapture(document.body, 'mouseup');
4
+ const onMouseDownAndUp = defn(module, function onMouseDownAndUp(el) {
5
+ const elMouseDowns = fromEventTargetCapture(el, 'mousedown');
6
+ return elMouseDowns.flatMapLatest(() => pageMouseUps.take(1).filter((event) => el.contains(event.target)));
6
7
  });
7
- exports.default = void 0;
8
- var _fromEventTargetCapture = _interopRequireDefault(require("../from-event-target-capture"));
9
- var _ud = require("ud");
10
- const Kefir = require('kefir');
11
- const pageMouseUps = (0, _fromEventTargetCapture.default)(document.body, 'mouseup');
12
- const onMouseDownAndUp = (0, _ud.defn)(module, function onMouseDownAndUp(el) {
13
- const elMouseDowns = (0, _fromEventTargetCapture.default)(el, 'mousedown');
14
- return elMouseDowns.flatMapLatest(() => pageMouseUps.take(1).filter(event => el.contains(event.target)));
15
- });
16
- var _default = onMouseDownAndUp;
17
- exports.default = _default;
8
+ export default onMouseDownAndUp;
@@ -0,0 +1,6 @@
1
+ import type { RouteParams } from '../namespaces/router';
2
+
3
+ export default function populateRouteID(
4
+ routeID: string,
5
+ params: RouteParams | null | undefined
6
+ ): string;
@@ -0,0 +1,2 @@
1
+ export default function rewriteCssWithIdMap(cssSource: string): string;
2
+ //# sourceMappingURL=rewriteCssWithIdMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteCssWithIdMap.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/lib/rewriteCssWithIdMap.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKrE"}
@@ -1,11 +1,4 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = rewriteCssWithIdMap;
8
- var _idMap = _interopRequireDefault(require("./idMap"));
9
- function rewriteCssWithIdMap(cssSource) {
10
- return cssSource.replace(/\.IDMAP_([-a-zA-Z0-9_]+)/g, (match, classname) => `.${(0, _idMap.default)(classname)}`);
11
- }
1
+ import idMap from './idMap';
2
+ export default function rewriteCssWithIdMap(cssSource) {
3
+ return cssSource.replace(/\.IDMAP_([-a-zA-Z0-9_]+)/g, (match, classname) => `.${idMap(classname)}`);
4
+ }
@@ -0,0 +1,4 @@
1
+ export default function routeIDmatchesHash(
2
+ routeID: string | Array<string>,
3
+ hash: string
4
+ ): string | null | undefined;
@@ -0,0 +1,5 @@
1
+ import LiveSet from 'live-set';
2
+ import * as Kefir from 'kefir';
3
+ import type { ItemWithLifetime } from './dom/make-element-child-stream';
4
+ export default function toLiveSet<T>(itemWithLifetimeStream: Kefir.Observable<ItemWithLifetime<T>, unknown>): LiveSet<T>;
5
+ //# sourceMappingURL=toLiveSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toLiveSet.d.ts","sourceRoot":"","sources":["../../../../../src/platform-implementation-js/lib/toLiveSet.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,CAAC,EACjC,sBAAsB,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GACrE,OAAO,CAAC,CAAC,CAAC,CAsBZ"}
@@ -1,33 +1,22 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = toLiveSet;
8
- var _liveSet = _interopRequireDefault(require("live-set"));
9
- function toLiveSet(itemWithLifetimeStream) {
10
- return new _liveSet.default({
11
- read() {
12
- throw new Error('should not happen; liveset was inactive');
13
- },
14
- listen(setValues, controller) {
15
- setValues(new Set());
16
- const sub = itemWithLifetimeStream.observe({
17
- value(_ref) {
18
- let {
19
- el,
20
- removalStream
21
- } = _ref;
22
- controller.add(el);
23
- removalStream.take(1).onValue(() => {
24
- controller.remove(el);
25
- });
26
- }
27
- });
28
- return () => {
29
- sub.unsubscribe();
30
- };
31
- }
32
- });
33
- }
1
+ import LiveSet from 'live-set';
2
+ export default function toLiveSet(itemWithLifetimeStream) {
3
+ return new LiveSet({
4
+ read() {
5
+ throw new Error('should not happen; liveset was inactive');
6
+ },
7
+ listen(setValues, controller) {
8
+ setValues(new Set());
9
+ const sub = itemWithLifetimeStream.observe({
10
+ value({ el, removalStream }) {
11
+ controller.add(el);
12
+ removalStream.take(1).onValue(() => {
13
+ controller.remove(el);
14
+ });
15
+ },
16
+ });
17
+ return () => {
18
+ sub.unsubscribe();
19
+ };
20
+ },
21
+ });
22
+ }
@@ -0,0 +1 @@
1
+ export type RouteParams = { [ix: string]: string | number };
@@ -1,183 +0,0 @@
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;
15
- if (!document.body) throw new Error('should not happen');
16
- document.body.innerHTML = `
17
- <div class="aeF">
18
- <div class="nH">
19
- <div id="main" class="nH"></div>
20
- <div id="main2" class="nH" style="display:none"></div>
21
- </div>
22
- </div>
23
- `;
24
- const main = document.getElementById('main');
25
- const main2 = document.getElementById('main2');
26
- if (!main || !main2) throw new Error();
27
- const mainEmitter = (0, _makeElementIntoEventEmitter.default)(main);
28
- const main2Emitter = (0, _makeElementIntoEventEmitter.default)(main2);
29
- const stopper = (0, _kefirBus.default)();
30
- afterEach(() => {
31
- stopper.emit(null);
32
- });
33
- function makeMockDriver() {
34
- return {
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()),
39
- hashChangeNoViewChange: jest.fn(),
40
- showNativeRouteView: jest.fn(),
41
- showCustomThreadList: jest.fn()
42
- };
43
- }
44
- test('role=main changes are seen', async () => {
45
- const items = [];
46
- window.location.hash = '#inbox';
47
- (0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), makeMockDriver()).takeUntilBy(stopper).onValue(item => {
48
- items.push(item);
49
- });
50
- await (0, _pdelay.default)(1);
51
- expect(items.length).toBe(1);
52
- main.style.display = 'none';
53
- main2.style.display = '';
54
- mainEmitter({
55
- attributeName: 'style'
56
- });
57
- main2Emitter({
58
- attributeName: 'style'
59
- });
60
- await (0, _pdelay.default)(1);
61
- expect(items.length).toBe(2);
62
- main.style.display = '';
63
- main2.style.display = 'none';
64
- mainEmitter({
65
- attributeName: 'style'
66
- });
67
- main2Emitter({
68
- attributeName: 'style'
69
- });
70
- await (0, _pdelay.default)(1);
71
- expect(items.length).toBe(3);
72
- });
73
- test('custom view hashchanges are seen', async () => {
74
- const items = [];
75
- const driver = makeMockDriver();
76
- driver.getCustomRouteIDs().add('foo');
77
- driver.getCustomRouteIDs().add('bar');
78
- window.location.hash = '#inbox';
79
- (0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
80
- items.push(item);
81
- });
82
- await (0, _pdelay.default)(1);
83
- expect(items.length).toBe(1);
84
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
85
- window.location.hash = '#foo';
86
- await (0, _pdelay.default)(1);
87
- expect(items.length).toBe(2);
88
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
89
- window.location.hash = '#foo/123';
90
- await (0, _pdelay.default)(1);
91
- expect(items.length).toBe(3);
92
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
93
-
94
- // Setting to the same hash should NOT make a new routeview.
95
- window.location.hash = '#foo/123?compose=123';
96
- await (0, _pdelay.default)(1);
97
- expect(items.length).toBe(3);
98
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
99
- window.location.hash = '#bar';
100
- await (0, _pdelay.default)(1);
101
- expect(items.length).toBe(4);
102
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
103
- });
104
- test('native hash changes are ignored', async () => {
105
- // We don't pay attention to native hash changes usually. We settle for
106
- // watching a new [role=main] element become displayed.
107
- const items = [];
108
- const driver = makeMockDriver();
109
- window.location.hash = '#inbox';
110
- (0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
111
- items.push(item);
112
- });
113
- await (0, _pdelay.default)(1);
114
- expect(items.length).toBe(1);
115
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
116
- window.location.hash = '#starred';
117
- await (0, _pdelay.default)(1);
118
- expect(items.length).toBe(1);
119
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
120
- });
121
- test('revertNativeHashChanges works', async () => {
122
- const items = [];
123
- const driver = makeMockDriver();
124
- driver.getCustomRouteIDs().add('foo');
125
- window.location.hash = '#inbox';
126
- (0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
127
- items.push(item);
128
- });
129
- await (0, _pdelay.default)(1);
130
- expect(items.length).toBe(1);
131
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
132
- window.location.hash = '#foo';
133
- await (0, _pdelay.default)(1);
134
- expect(items.length).toBe(2);
135
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
136
- window.location.hash = '#inbox';
137
- await (0, _pdelay.default)(1);
138
- expect(items.length).toBe(3);
139
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
140
- window.location.hash = '#foo';
141
- await (0, _pdelay.default)(1);
142
- expect(items.length).toBe(4);
143
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
144
- window.location.hash = '#inbox';
145
- await (0, _pdelay.default)(1);
146
- expect(items.length).toBe(5);
147
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(3);
148
- });
149
- test('revertNativeHashChanges and ?compose parameter play nicely together', async () => {
150
- // If you make a draft while at a native route view, Gmail adds ?compose=ID
151
- // to the hash. If you edit the draft, Gmail updates the ID in the hash. If
152
- // you go to a custom route view, then we drop ?compose=ID from the hash and
153
- // Gmail doesn't try to update it because it doesn't understand the hash. If
154
- // you edit the draft, and then hit the back button, the hash will first
155
- // change to the hash in your browser history, and then Gmail will
156
- // immediately update it to the draft's current ID. We need to not pay
157
- // attention to the extra hash change, but our revertNativeHashChanges still
158
- // needs to work.
159
-
160
- const items = [];
161
- const driver = makeMockDriver();
162
- driver.getCustomRouteIDs().add('foo');
163
- window.location.hash = '#inbox';
164
- (0, _setupRouteViewDriverStream.default)(new _gmailRouteProcessor.default(), driver).takeUntilBy(stopper).onValue(item => {
165
- items.push(item);
166
- });
167
- await (0, _pdelay.default)(1);
168
- expect(items.length).toBe(1);
169
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
170
- window.location.hash = '#inbox?compose=A';
171
- await (0, _pdelay.default)(1);
172
- expect(items.length).toBe(1);
173
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
174
- window.location.hash = '#foo';
175
- await (0, _pdelay.default)(1);
176
- expect(items.length).toBe(2);
177
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(1);
178
- window.location.hash = '#inbox?compose=A';
179
- window.location.hash = '#inbox?compose=B';
180
- await (0, _pdelay.default)(1);
181
- expect(items.length).toBe(3);
182
- expect(driver.showNativeRouteView).toHaveBeenCalledTimes(2);
183
- });
@@ -1,218 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
- var _showCustomThreadList = _interopRequireDefault(require("./show-custom-thread-list"));
6
- var GSRP = _interopRequireWildcard(require("../gmail-sync-response-processor"));
7
- var _fs = _interopRequireDefault(require("fs"));
8
- var _once = _interopRequireDefault(require("lodash/once"));
9
- var _kefir = _interopRequireDefault(require("kefir"));
10
- var _kefirBus = _interopRequireDefault(require("kefir-bus"));
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- 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; }
13
- const readFile = _fs.default.promises.readFile;
14
- beforeAll(() => {
15
- document.body.innerHTML = `
16
- <div>
17
- <form role="search">
18
- <input type="text">
19
- </form>
20
- </div>
21
- `;
22
- });
23
- class ShowCustomThreadListTester {
24
- constructor(options) {
25
- (0, _defineProperty2.default)(this, "_ajaxInterceptStream", (0, _kefirBus.default)());
26
- (0, _defineProperty2.default)(this, "_customListNewQueryBus", (0, _kefirBus.default)());
27
- (0, _defineProperty2.default)(this, "_customListResultsBus", (0, _kefirBus.default)());
28
- (0, _defineProperty2.default)(this, "_allowGmailThreadIdLookup", (0, _kefirBus.default)());
29
- (0, _defineProperty2.default)(this, "_driver", {
30
- isUsingSyncAPI: () => true,
31
- getLogger: (0, _once.default)(() => ({
32
- error(e) {
33
- // eslint-disable-next-line no-console
34
- console.error(e);
35
- throw e;
36
- }
37
- })),
38
- getCustomListSearchStringsToRouteIds: (0, _once.default)(() => new Map()),
39
- getPageCommunicator: (0, _once.default)(() => ({
40
- ajaxInterceptStream: this._ajaxInterceptStream,
41
- setupCustomListResultsQuery: jest.fn(),
42
- setCustomListNewQuery: jest.fn(value => {
43
- this._customListNewQueryBus.value(value);
44
- }),
45
- setCustomListResults: jest.fn(value => {
46
- this._customListResultsBus.value(value);
47
- })
48
- })),
49
- signalCustomThreadListActivity: jest.fn(),
50
- getRfcMessageIdForGmailThreadId: jest.fn(async gmailThreadId => {
51
- if (!this._threadIdsToRfcIds.has(gmailThreadId)) {
52
- throw new Error('Failed to find id');
53
- }
54
- return this._threadIdsToRfcIds.get(gmailThreadId);
55
- }),
56
- getGmailThreadIdForRfcMessageId: jest.fn(async rfcId => {
57
- if (!this._rfcIdsToThreadIds.has(rfcId)) {
58
- throw new Error('Failed to find id');
59
- }
60
- await this._allowGmailThreadIdLookup.take(1).toPromise();
61
- return this._rfcIdsToThreadIds.get(rfcId);
62
- })
63
- });
64
- (0, _defineProperty2.default)(this, "_customRouteID", 'tlbeep');
65
- (0, _defineProperty2.default)(this, "_routeParams", []);
66
- this._onActivate = options.onActivate;
67
- this._threadIdsToRfcIds = new Map(options.threadAndRfcIds);
68
- this._rfcIdsToThreadIds = new Map(options.threadAndRfcIds.map(_ref => {
69
- let [threadId, rfcId] = _ref;
70
- return [rfcId, threadId];
71
- }));
72
- this._expectedSearchQuery = options.expectedSearchQuery;
73
- this._start = options.start;
74
- this._getOriginalSearchResponse = options.getOriginalSearchResponse;
75
- }
76
- async runAndGetSetCustomListResults() {
77
- (0, _showCustomThreadList.default)(this._driver, this._customRouteID, this._onActivate, this._routeParams, () => null);
78
- expect(this._driver.getPageCommunicator().setupCustomListResultsQuery.mock.calls.length).toBe(1);
79
- this._newQuery = this._driver.getPageCommunicator().setupCustomListResultsQuery.mock.calls[0][0];
80
- expect(typeof this._newQuery).toBe('string');
81
- expect(this._driver.getCustomListSearchStringsToRouteIds().size).toBe(1);
82
- expect(this._driver.getCustomListSearchStringsToRouteIds().get(this._newQuery)).toBe('tlbeep');
83
- expect(this._driver.signalCustomThreadListActivity.mock.calls).toEqual([]);
84
- expect(this._driver.getPageCommunicator().setCustomListNewQuery.mock.calls).toEqual([]);
85
- this._ajaxInterceptStream.value({
86
- type: 'searchForReplacement',
87
- query: this._newQuery,
88
- start: this._start
89
- });
90
- expect(this._driver.signalCustomThreadListActivity.mock.calls).toEqual([[this._customRouteID]]);
91
- await this._customListNewQueryBus.take(1).toPromise();
92
- expect(this._driver.getPageCommunicator().setCustomListNewQuery.mock.calls).toEqual([[{
93
- newQuery: this._expectedSearchQuery,
94
- newStart: 0,
95
- query: this._newQuery,
96
- start: this._start
97
- }]]);
98
- const originalSearchResponse = await this._getOriginalSearchResponse();
99
- this._ajaxInterceptStream.value({
100
- type: 'searchResultsResponse',
101
- query: this._newQuery,
102
- start: this._start,
103
- response: originalSearchResponse
104
- });
105
- expect(this._driver.getPageCommunicator().setCustomListResults.mock.calls.length).toBe(0);
106
- this._allowGmailThreadIdLookup.value();
107
- await this._customListResultsBus.take(1).toPromise();
108
- expect(this._driver.getPageCommunicator().setCustomListResults.mock.calls.length).toBe(1);
109
- expect(this._driver.getPageCommunicator().setCustomListResults.mock.calls[0][0]).toBe(this._newQuery);
110
- return this._driver.getPageCommunicator().setCustomListResults.mock.calls[0][1];
111
- }
112
- }
113
- test('works', async () => {
114
- const getOriginalSearchResponse = (0, _once.default)(() => readFile(__dirname + '/../../../../../test/data/2019-02-01 search results.json', 'utf8'));
115
- const tester = new ShowCustomThreadListTester({
116
- onActivate() {
117
- return {
118
- hasMore: false,
119
- threads: ['168ab8987a3b61b3', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>']
120
- };
121
- },
122
- threadAndRfcIds: [['168ab8987a3b61b3', '<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com>'], ['168a6018f86576ac', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>']],
123
- expectedSearchQuery: 'rfc822msgid:<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com> OR rfc822msgid:<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>',
124
- start: 0,
125
- getOriginalSearchResponse
126
- });
127
- const setCustomListResults = await tester.runAndGetSetCustomListResults();
128
- function ignoreRawResponses(syncThreads) {
129
- return syncThreads.map(o => ({
130
- ...o,
131
- rawResponse: 'ignored'
132
- }));
133
- }
134
- expect(ignoreRawResponses(GSRP.extractThreadsFromSearchResponse(setCustomListResults))).toEqual(ignoreRawResponses(GSRP.extractThreadsFromSearchResponse(await getOriginalSearchResponse())));
135
- });
136
- test('can reorder list', async () => {
137
- const getOriginalSearchResponse = (0, _once.default)(() => readFile(__dirname + '/../../../../../test/data/2019-02-01 search results.json', 'utf8'));
138
- const tester = new ShowCustomThreadListTester({
139
- onActivate() {
140
- return {
141
- hasMore: false,
142
- threads: ['<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>', '168ab8987a3b61b3']
143
- };
144
- },
145
- threadAndRfcIds: [['168ab8987a3b61b3', '<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com>'], ['168a6018f86576ac', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>']],
146
- expectedSearchQuery: 'rfc822msgid:<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com> OR rfc822msgid:<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com>',
147
- start: 0,
148
- getOriginalSearchResponse
149
- });
150
- const setCustomListResults = await tester.runAndGetSetCustomListResults();
151
- function ignoreSomeFields(syncThreads) {
152
- return syncThreads.map(o => ({
153
- ...o,
154
- rawResponse: 'ignored',
155
- extraMetaData: {
156
- ...o.extraMetaData,
157
- syncMessageData: o.extraMetaData.syncMessageData.map(s => ({
158
- ...s,
159
- date: 'ignored'
160
- }))
161
- }
162
- }));
163
- }
164
- expect(ignoreSomeFields(GSRP.extractThreadsFromSearchResponse(setCustomListResults))).toEqual(ignoreSomeFields(GSRP.extractThreadsFromSearchResponse(await getOriginalSearchResponse())).reverse());
165
- });
166
- test('missing thread id', async () => {
167
- const getOriginalSearchResponse = (0, _once.default)(() => readFile(__dirname + '/../../../../../test/data/2019-02-01 search results.json', 'utf8'));
168
- const tester = new ShowCustomThreadListTester({
169
- onActivate() {
170
- return {
171
- hasMore: false,
172
- threads: ['<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>', '168ab8987a3b61b3', '1111111111111111', '1111111111111112', '<a@b.com>']
173
- };
174
- },
175
- threadAndRfcIds: [['168ab8987a3b61b3', '<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com>'], ['168a6018f86576ac', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>']],
176
- expectedSearchQuery: 'rfc822msgid:<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com> OR rfc822msgid:<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com> OR rfc822msgid:<a@b.com>',
177
- start: 0,
178
- getOriginalSearchResponse
179
- });
180
- const setCustomListResults = await tester.runAndGetSetCustomListResults();
181
- function ignoreSomeFields(syncThreads) {
182
- return syncThreads.map(o => ({
183
- ...o,
184
- rawResponse: 'ignored',
185
- extraMetaData: {
186
- ...o.extraMetaData,
187
- syncMessageData: o.extraMetaData.syncMessageData.map(s => ({
188
- ...s,
189
- date: 'ignored'
190
- }))
191
- }
192
- }));
193
- }
194
- expect(ignoreSomeFields(GSRP.extractThreadsFromSearchResponse(setCustomListResults))).toEqual(ignoreSomeFields(GSRP.extractThreadsFromSearchResponse(await getOriginalSearchResponse())).reverse());
195
- });
196
- test('missing threads in response', async () => {
197
- const getOriginalSearchResponse = (0, _once.default)(() => readFile(__dirname + '/../../../../../test/data/2019-02-01 search results.json', 'utf8'));
198
- const tester = new ShowCustomThreadListTester({
199
- onActivate() {
200
- return {
201
- hasMore: false,
202
- threads: ['168ab8987a3b61b3', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>', '1111111111111111', '1111111111111112', '<a@b.com>']
203
- };
204
- },
205
- threadAndRfcIds: [['168ab8987a3b61b3', '<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com>'], ['168a6018f86576ac', '<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com>'], ['1111111111111111', '<ones@example.com>'], ['1111111111111112', '<onesandatwo@example.com>'], ['abab111111111111', '<a@b.com>']],
206
- expectedSearchQuery: 'rfc822msgid:<CAL_Ays_RcwA0U8-43zY8JYPRsyQ5EOavXjrYZx7=EqVTx9Jz3g@mail.gmail.com> OR rfc822msgid:<CAL_Ays8e-3FpHxkJ8qWNXKMHKnysR2XTeSakv_yvQNUjZsSSdw@mail.gmail.com> OR rfc822msgid:<ones@example.com> OR rfc822msgid:<onesandatwo@example.com> OR rfc822msgid:<a@b.com>',
207
- start: 0,
208
- getOriginalSearchResponse
209
- });
210
- const setCustomListResults = await tester.runAndGetSetCustomListResults();
211
- function ignoreRawResponses(syncThreads) {
212
- return syncThreads.map(o => ({
213
- ...o,
214
- rawResponse: 'ignored'
215
- }));
216
- }
217
- expect(ignoreRawResponses(GSRP.extractThreadsFromSearchResponse(setCustomListResults))).toEqual(ignoreRawResponses(GSRP.extractThreadsFromSearchResponse(await getOriginalSearchResponse())));
218
- });
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _lodash = _interopRequireDefault(require("lodash"));
5
- var _userInfo = _interopRequireDefault(require("./user-info"));
6
- document.body.innerHTML = '<div role="banner"><div id="slot"></div></div>';
7
- const slot = document.getElementById('slot');
8
- if (!slot) throw new Error();
9
- const driver = {
10
- getUserEmailAddress: _lodash.default.constant('cowan@streak.com')
11
- };
12
- describe('old', () => {
13
- it('normal signed in, plus one normal and one delegated', async () => {
14
- slot.innerHTML = `
15
- <div class="gb_w gb_ha" aria-label="Account Information" aria-hidden="true" tabindex="0" img-loaded="1"><div class="gb_J"><div>This account is managed by <b>streak.com</b>.</div><a class="gb_x" href="http://www.google.com/support/accounts/bin/answer.py?answer=181692&amp;hl=en" target="_blank">Learn more</a></div><div class="gb_z"><a class="gb_A gb_ec" href="https://plus.google.com/u/0/me?tab=mX&amp;authuser=0" target="_blank"><div class="gb_g gbip" title="Google+ Profile Icon"></div><span class="gb_C">Change photo</span></a><div class="gb_B"><div class="gb_D">Chris Cowan</div><div class="gb_E">cowan@streak.com</div><div class="gb_y"><a href="https://plus.google.com/u/0/me?tab=mX&amp;authuser=0" target="_blank">Profile</a>–<a href="http://www.google.com/intl/en/policies/privacy/" target="_blank">Privacy</a></div><a class="gb_bc gbp1 gb_a" href="https://myaccount.google.com/?utm_source=OGB&amp;authuser=0" target="_blank">My Account</a></div></div><div class="gb_K" aria-hidden="false"><a class="gb_L gb_O gb_P" target="_blank" rel="noreferrer"><img class="gb_Q" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABECLTFjZCok6-J9wEiC3ZjYXJkX3Bob3RvKihkZjczYTJjY2M2ZmEzNzg0OTk0NzdlM2JmYjg4OWY0ZTNmOTFhZmNiMAEiaDfw7v26ir1rp345NanqFU_MhQ?sz=48" alt="Google+ Profile Icon"><div class="gb_N"><div class="gb_R">Chris Cowan</div><div class="gb_S">cowan@streak.com (default)</div></div></a><a class="gb_L" href="https://mail.google.com/mail/u/1" target="_blank" rel="noreferrer"><img class="gb_Q" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABDCL_nn8ag5pLBGCILdmNhcmRfcGhvdG8qKGJmZjExYmU4ODA5YjhlNDc5OTdmMzhmZDI0YWEyMmUxNTdmNTYzNTIwAbWsPITWijXgBmbaAWa7V0IlI8KH?sz=48" alt="Google+ Profile Icon"><div class="gb_N"><div class="gb_R">Jonny Ive</div><div class="gb_S">streak.web.test.1@gmail.com</div></div></a><a class="gb_L" href="https://mail.google.com/mail/b/143/u/0/" target="_blank" rel="noreferrer"><img class="gb_Q" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABDCNqH_oPv4JWcMyILdmNhcmRfcGhvdG8qKDI5NjUxOGIyNzBjODJkZmI1Y2E1MDllNDU2YzlkNWNjMGMzYTBiNWMwATxsheQ8PeCbYGB49uDPpAo3nqCJ?sz=48" alt="Google+ Profile Icon"><div class="gb_N"><div class="gb_R">Nikola Tesla</div><div class="gb_S">tesla@streak.com (delegated)</div></div></a></div><a class="gb_T gb_c" href="https://plus.google.com/u/0/dashboard" aria-hidden="true"><span class="gb_U gb_2"></span><div class="gb_V">All your Google+ pages ›</div></a><div class="gb_F"><div><a class="gb_9b gb_a" href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail&amp;service=mail" target="_blank">Add account</a></div><div><a class="gb_cc gb_jc gb_a" id="gb_71" href="https://mail.google.com/mail/logout?hl=en" target="_top">Sign out</a></div></div></div>
16
- `;
17
- const userInfo = new _userInfo.default(driver);
18
- expect(userInfo.getUserName()).toBe('Chris Cowan');
19
- expect(userInfo.getAccountSwitcherContactList()).toEqual([{
20
- name: 'Chris Cowan',
21
- emailAddress: 'cowan@streak.com'
22
- }, {
23
- name: 'Jonny Ive',
24
- emailAddress: 'streak.web.test.1@gmail.com'
25
- }, {
26
- name: 'Nikola Tesla',
27
- emailAddress: 'tesla@streak.com'
28
- }]);
29
- });
30
- it('delegated signed in, plus two normal', async () => {
31
- slot.innerHTML = `
32
- <div class="gb_w gb_ha" aria-label="Account Information" aria-hidden="false" tabindex="0" img-loaded="1"><div class="gb_J"><div>This account is managed by <b>streak.com</b>.</div><a class="gb_x" href="http://www.google.com/support/accounts/bin/answer.py?answer=181692&amp;hl=en" target="_blank">Learn more</a></div><div class="identityUserDelegatedAccount gb_z"><div class="gb_D">tesla@streak.com</div></div><div class="gb_K" aria-hidden="false"><a class="gb_L" href="https://mail.google.com/mail/u/0" target="_blank" rel="noreferrer"><img class="gb_Q" src="https://plus.google.com/u/0/_/focus/g/143/photos/public/AIbEiAIAAABECLTFjZCok6-J9wEiC3ZjYXJkX3Bob3RvKihkZjczYTJjY2M2ZmEzNzg0OTk0NzdlM2JmYjg4OWY0ZTNmOTFhZmNiMAEiaDfw7v26ir1rp345NanqFU_MhQ?sz=48" alt="Google+ Profile Icon"><div class="gb_N"><div class="gb_R">Chris Cowan</div><div class="gb_S">cowan@streak.com (default)</div></div></a><a class="gb_L" href="https://mail.google.com/mail/u/1" target="_blank" rel="noreferrer"><img class="gb_Q" src="https://plus.google.com/u/0/_/focus/g/143/photos/public/AIbEiAIAAABDCL_nn8ag5pLBGCILdmNhcmRfcGhvdG8qKGJmZjExYmU4ODA5YjhlNDc5OTdmMzhmZDI0YWEyMmUxNTdmNTYzNTIwAbWsPITWijXgBmbaAWa7V0IlI8KH?sz=48" alt="Google+ Profile Icon"><div class="gb_N"><div class="gb_R">Jonny Ive</div><div class="gb_S">streak.web.test.1@gmail.com</div></div></a></div><a class="gb_T gb_c" href="https://plus.google.com/u/0/dashboard" aria-hidden="true"><span class="gb_U gb_2"></span><div class="gb_V">All your Google+ pages ›</div></a><div class="gb_F"><div><a class="gb_9b gb_a" href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail&amp;service=mail" target="_blank">Add account</a></div><div><a class="gb_cc gb_jc gb_a" id="gb_71" href="https://mail.google.com/mail/logout?hl=en" target="_top">Sign out</a></div></div></div>
33
- `;
34
- const userInfo = new _userInfo.default(driver);
35
- expect(userInfo.getAccountSwitcherContactList()).toEqual([{
36
- name: 'Chris Cowan',
37
- emailAddress: 'cowan@streak.com'
38
- }, {
39
- name: 'Jonny Ive',
40
- emailAddress: 'streak.web.test.1@gmail.com'
41
- }]);
42
- });
43
- });
44
- describe('new', () => {
45
- it('normal signed in, plus one normal and one delegated', async () => {
46
- slot.innerHTML = `
47
- <div class="gb_va gb_1b" aria-label="Account Information" aria-hidden="false" tabindex="0" img-loaded="1"><div class="gb_Ia"><div>This account is managed by <b>streak.com</b>.</div><a class="gb_wa" href="http://www.google.com/support/accounts/bin/answer.py?answer=181692&amp;hl=en" target="_blank">Learn more</a></div><div class="gb_ya"><a class="gb_za gb_Pc" href="https://plus.google.com/u/0/me?tab=mX&amp;authuser=0" target="_blank"><div class="gb_ha gbip" title="Google+ Profile Icon"></div><span class="gb_Ba">Change photo</span></a><div class="gb_Aa"><div class="gb_Ca">Chris Cowan</div><div class="gb_Da">cowan@streak.com</div><div class="gb_xa"><a href="https://plus.google.com/u/0/me?tab=mX&amp;authuser=0" target="_blank">Profile</a>–<a href="http://www.google.com/intl/en/policies/privacy/" target="_blank">Privacy</a></div><a class="gb_Mc gbp1 gb_7" href="https://myaccount.google.com/?utm_source=OGB&amp;authuser=0" target="_blank">My Account</a></div></div><div class="gb_Ja" aria-hidden="false"><a class="gb_Ka gb_Na gb_Oa" target="_blank" rel="noreferrer"><img class="gb_Pa" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABECLTFjZCok6-J9wEiC3ZjYXJkX3Bob3RvKihkZjczYTJjY2M2ZmEzNzg0OTk0NzdlM2JmYjg4OWY0ZTNmOTFhZmNiMAEiaDfw7v26ir1rp345NanqFU_MhQ?sz=48" alt="Google+ Profile Icon"><div class="gb_Ma"><div class="gb_Qa">Chris Cowan</div><div class="gb_Ra">cowan@streak.com (default)</div></div></a><a class="gb_Ka" href="https://mail.google.com/mail/u/1" target="_blank" rel="noreferrer"><img class="gb_Pa" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABDCL_nn8ag5pLBGCILdmNhcmRfcGhvdG8qKGJmZjExYmU4ODA5YjhlNDc5OTdmMzhmZDI0YWEyMmUxNTdmNTYzNTIwAbWsPITWijXgBmbaAWa7V0IlI8KH?sz=48" alt="Google+ Profile Icon"><div class="gb_Ma"><div class="gb_Qa">Jonny Ive</div><div class="gb_Ra">streak.web.test.1@gmail.com</div></div></a><a class="gb_Ka" href="https://mail.google.com/mail/b/143/u/0/" target="_blank" rel="noreferrer"><img class="gb_Pa" src="https://plus.google.com/u/0/_/focus/photos/public/AIbEiAIAAABDCNqH_oPv4JWcMyILdmNhcmRfcGhvdG8qKDI5NjUxOGIyNzBjODJkZmI1Y2E1MDllNDU2YzlkNWNjMGMzYTBiNWMwATxsheQ8PeCbYGB49uDPpAo3nqCJ?sz=48" alt="Google+ Profile Icon"><div class="gb_Ma"><div class="gb_Qa">Nikola Tesla</div><div class="gb_Ra">tesla@streak.com (delegated)</div></div></a></div><a class="gb_Sa gb_ea" href="https://plus.google.com/u/0/dashboard" aria-hidden="true"><span class="gb_Ta gb_5a"></span><div class="gb_Ua">All your Google+ pages ›</div></a><div class="gb_Ea"><div><a class="gb_Kc gb_7" href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail&amp;service=mail" target="_blank">Add account</a></div><div><a class="gb_Nc gb_Uc gb_7" id="gb_71" href="https://mail.google.com/mail/logout?hl=en" target="_top">Sign out</a></div></div></div>
48
- `;
49
- const userInfo = new _userInfo.default(driver);
50
- expect(userInfo.getUserName()).toBe('Chris Cowan');
51
- expect(userInfo.getAccountSwitcherContactList()).toEqual([{
52
- name: 'Chris Cowan',
53
- emailAddress: 'cowan@streak.com'
54
- }, {
55
- name: 'Jonny Ive',
56
- emailAddress: 'streak.web.test.1@gmail.com'
57
- }, {
58
- name: 'Nikola Tesla',
59
- emailAddress: 'tesla@streak.com'
60
- }]);
61
- });
62
- it('delegated signed in, plus two normal', async () => {
63
- slot.innerHTML = `
64
- <div class="gb_va gb_1b" aria-label="Account Information" aria-hidden="false" tabindex="0" img-loaded="1"><div class="gb_Ia"><div>This account is managed by <b>streak.com</b>.</div><a class="gb_wa" href="http://www.google.com/support/accounts/bin/answer.py?answer=181692&amp;hl=en" target="_blank">Learn more</a></div><div class="identityUserDelegatedAccount gb_ya"><div class="gb_Ca">tesla@streak.com</div></div><div class="gb_Ja" aria-hidden="false"><a class="gb_Ka" href="https://mail.google.com/mail/u/0" target="_blank" rel="noreferrer"><img class="gb_Pa" src="https://plus.google.com/u/0/_/focus/g/143/photos/public/AIbEiAIAAABECLTFjZCok6-J9wEiC3ZjYXJkX3Bob3RvKihkZjczYTJjY2M2ZmEzNzg0OTk0NzdlM2JmYjg4OWY0ZTNmOTFhZmNiMAEiaDfw7v26ir1rp345NanqFU_MhQ?sz=48" alt="Google+ Profile Icon"><div class="gb_Ma"><div class="gb_Qa">Chris Cowan</div><div class="gb_Ra">cowan@streak.com (default)</div></div></a><a class="gb_Ka" href="https://mail.google.com/mail/u/1" target="_blank" rel="noreferrer"><img class="gb_Pa" src="https://plus.google.com/u/0/_/focus/g/143/photos/public/AIbEiAIAAABDCL_nn8ag5pLBGCILdmNhcmRfcGhvdG8qKGJmZjExYmU4ODA5YjhlNDc5OTdmMzhmZDI0YWEyMmUxNTdmNTYzNTIwAbWsPITWijXgBmbaAWa7V0IlI8KH?sz=48" alt="Google+ Profile Icon"><div class="gb_Ma"><div class="gb_Qa">Jonny Ive</div><div class="gb_Ra">streak.web.test.1@gmail.com</div></div></a></div><a class="gb_Sa gb_ea" href="https://plus.google.com/u/0/dashboard" aria-hidden="true"><span class="gb_Ta gb_5a"></span><div class="gb_Ua">All your Google+ pages ›</div></a><div class="gb_Ea"><div><a class="gb_Kc gb_7" href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail&amp;service=mail" target="_blank">Add account</a></div><div><a class="gb_Nc gb_Uc gb_7" id="gb_71" href="https://mail.google.com/mail/logout?hl=en" target="_top">Sign out</a></div></div></div>
65
- `;
66
- const userInfo = new _userInfo.default(driver);
67
- expect(userInfo.getAccountSwitcherContactList()).toEqual([{
68
- name: 'Chris Cowan',
69
- emailAddress: 'cowan@streak.com'
70
- }, {
71
- name: 'Jonny Ive',
72
- emailAddress: 'streak.web.test.1@gmail.com'
73
- }]);
74
- });
75
- it('single user', async () => {
76
- slot.innerHTML = `
77
- <div class="gb_va gb_1b" aria-label="Account Information" aria-hidden="false" tabindex="0" img-loaded="1"><div class="gb_ya"><div class="gb_Aa"><div class="gb_Ca">PeopleAggregate Test</div><div class="gb_Da">peopleaggregatetest@gmail.com</div><div class="gb_xa"><a href="https://plus.google.com/u/0/up/accounts/upgrade?gpsrc=ogjgp&amp;tab=mX" target="_blank">Join Google+</a>–<a href="http://www.google.com/intl/en/policies/privacy/" target="_blank">Privacy</a></div><a class="gb_Mc gbp1 gb_7" href="https://myaccount.google.com/?utm_source=OGB" target="_blank">My Account</a></div></div><div class="gb_Ja gb_ea" aria-hidden="true"></div><a class="gb_Sa gb_ea" href="https://plus.google.com/u/0/dashboard" aria-hidden="true"><span class="gb_Ta gb_5a"></span><div class="gb_Ua">All your Google+ pages ›</div></a><div class="gb_Ea"><div><a class="gb_Kc gb_7" href="https://accounts.google.com/AddSession?hl=en&amp;continue=https://mail.google.com/mail&amp;service=mail" target="_blank">Add account</a></div><div><a class="gb_Nc gb_Uc gb_7" id="gb_71" href="https://mail.google.com/mail/logout?hl=en" target="_top">Sign out</a></div></div></div>
78
- `;
79
- const userInfo = new _userInfo.default(driver);
80
- expect(userInfo.getAccountSwitcherContactList()).toEqual([{
81
- name: 'PeopleAggregate Test',
82
- emailAddress: 'peopleaggregatetest@gmail.com'
83
- }]);
84
- });
85
- });