@internetarchive/collection-browser 3.4.1-alpha-webdev7761.2 → 3.4.1-alpha-webdev7761.4

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 (208) hide show
  1. package/dist/src/app-root.js +19 -28
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +14 -10
  4. package/dist/src/collection-browser.js +870 -886
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +3 -4
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/models.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.js +145 -156
  10. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  11. package/dist/src/collection-facets/more-facets-pagination.js +6 -10
  12. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  13. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
  14. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  15. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
  16. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  17. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
  18. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  19. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
  20. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  21. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  22. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  23. package/dist/src/collection-facets/toggle-switch.js +4 -6
  24. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  25. package/dist/src/collection-facets.js +34 -50
  26. package/dist/src/collection-facets.js.map +1 -1
  27. package/dist/src/combo-box/caret-closed.js +5 -11
  28. package/dist/src/combo-box/caret-closed.js.map +1 -1
  29. package/dist/src/combo-box/caret-open.js +5 -11
  30. package/dist/src/combo-box/caret-open.js.map +1 -1
  31. package/dist/src/combo-box/clear.d.ts +2 -0
  32. package/dist/src/combo-box/clear.js +11 -0
  33. package/dist/src/combo-box/clear.js.map +1 -0
  34. package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
  35. package/dist/src/combo-box/ia-combo-box.js +363 -272
  36. package/dist/src/combo-box/ia-combo-box.js.map +1 -1
  37. package/dist/src/combo-box/models.d.ts +14 -0
  38. package/dist/src/combo-box/models.js +32 -1
  39. package/dist/src/combo-box/models.js.map +1 -1
  40. package/dist/src/data-source/collection-browser-data-source.js +35 -47
  41. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  42. package/dist/src/empty-placeholder.js +19 -18
  43. package/dist/src/empty-placeholder.js.map +1 -1
  44. package/dist/src/expanded-date-picker.js +6 -10
  45. package/dist/src/expanded-date-picker.js.map +1 -1
  46. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  47. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  48. package/dist/src/manage/manage-bar.js +86 -92
  49. package/dist/src/manage/manage-bar.js.map +1 -1
  50. package/dist/src/manage/remove-items-modal-content.js +2 -2
  51. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  52. package/dist/src/models.js +36 -40
  53. package/dist/src/models.js.map +1 -1
  54. package/dist/src/restoration-state-handler.js +9 -10
  55. package/dist/src/restoration-state-handler.js.map +1 -1
  56. package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
  57. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  58. package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
  59. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  60. package/dist/src/tiles/base-tile-component.js +1 -2
  61. package/dist/src/tiles/base-tile-component.js.map +1 -1
  62. package/dist/src/tiles/grid/account-tile.js +36 -38
  63. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  64. package/dist/src/tiles/grid/collection-tile.js +79 -82
  65. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  66. package/dist/src/tiles/grid/item-tile.js +154 -164
  67. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  68. package/dist/src/tiles/grid/search-tile.js +42 -43
  69. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  70. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  71. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  72. package/dist/src/tiles/grid/tile-stats.js +2 -3
  73. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  74. package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
  75. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  76. package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
  77. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  78. package/dist/src/tiles/image-block.js +5 -8
  79. package/dist/src/tiles/image-block.js.map +1 -1
  80. package/dist/src/tiles/item-image.js +12 -19
  81. package/dist/src/tiles/item-image.js.map +1 -1
  82. package/dist/src/tiles/list/tile-list-compact.js +114 -122
  83. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  84. package/dist/src/tiles/list/tile-list.js +326 -347
  85. package/dist/src/tiles/list/tile-list.js.map +1 -1
  86. package/dist/src/tiles/overlay/icon-overlay.js +1 -2
  87. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  88. package/dist/src/tiles/overlay/text-overlay.js +2 -4
  89. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  90. package/dist/src/tiles/text-snippet-block.js +2 -4
  91. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  92. package/dist/src/tiles/tile-dispatcher.js +233 -241
  93. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  94. package/dist/src/tiles/tile-display-value-provider.js +5 -9
  95. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  96. package/dist/src/tiles/tile-mediatype-icon.js +12 -19
  97. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  98. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  99. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  100. package/dist/src/utils/facet-utils.js +3 -5
  101. package/dist/src/utils/facet-utils.js.map +1 -1
  102. package/dist/src/utils/format-count.js +10 -10
  103. package/dist/src/utils/format-count.js.map +1 -1
  104. package/dist/src/utils/format-date.js.map +1 -1
  105. package/dist/src/utils/resolve-mediatype.js +2 -3
  106. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  107. package/dist/test/collection-browser.test.js +131 -185
  108. package/dist/test/collection-browser.test.js.map +1 -1
  109. package/dist/test/collection-facets/facet-row.test.js +60 -75
  110. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  111. package/dist/test/collection-facets/facets-template.test.js +17 -23
  112. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  113. package/dist/test/collection-facets/more-facets-content.test.js +22 -32
  114. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
  116. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  117. package/dist/test/collection-facets/toggle-switch.test.js +22 -19
  118. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  119. package/dist/test/collection-facets.test.js +80 -97
  120. package/dist/test/collection-facets.test.js.map +1 -1
  121. package/dist/test/empty-placeholder.test.js +11 -17
  122. package/dist/test/empty-placeholder.test.js.map +1 -1
  123. package/dist/test/expanded-date-picker.test.js +8 -14
  124. package/dist/test/expanded-date-picker.test.js.map +1 -1
  125. package/dist/test/icon-overlay.test.js +7 -6
  126. package/dist/test/icon-overlay.test.js.map +1 -1
  127. package/dist/test/image-block.test.js +16 -26
  128. package/dist/test/image-block.test.js.map +1 -1
  129. package/dist/test/item-image.test.js +23 -32
  130. package/dist/test/item-image.test.js.map +1 -1
  131. package/dist/test/manage/manage-bar.test.js +21 -33
  132. package/dist/test/manage/manage-bar.test.js.map +1 -1
  133. package/dist/test/manage/remove-items-modal-content.test.js +10 -15
  134. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  135. package/dist/test/mocks/mock-search-service.js +2 -3
  136. package/dist/test/mocks/mock-search-service.js.map +1 -1
  137. package/dist/test/restoration-state-handler.test.js +13 -21
  138. package/dist/test/restoration-state-handler.test.js.map +1 -1
  139. package/dist/test/review-block.test.js +16 -18
  140. package/dist/test/review-block.test.js.map +1 -1
  141. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
  142. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
  144. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
  146. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  147. package/dist/test/text-overlay.test.js +16 -15
  148. package/dist/test/text-overlay.test.js.map +1 -1
  149. package/dist/test/text-snippet-block.test.js +14 -19
  150. package/dist/test/text-snippet-block.test.js.map +1 -1
  151. package/dist/test/tile-stats.test.js +73 -34
  152. package/dist/test/tile-stats.test.js.map +1 -1
  153. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  154. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  155. package/dist/test/tiles/grid/collection-tile.test.js +13 -19
  156. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/item-tile.test.js +141 -168
  158. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/search-tile.test.js +9 -13
  160. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  161. package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
  162. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  163. package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
  164. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  165. package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
  166. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list.test.js +202 -231
  168. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  169. package/dist/test/tiles/tile-dispatcher.test.js +97 -110
  170. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  171. package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
  172. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  173. package/dist/test/utils/format-date.test.js.map +1 -1
  174. package/index.html +1 -1
  175. package/package.json +5 -3
  176. package/src/collection-browser.ts +3060 -3030
  177. package/src/collection-facets/models.ts +10 -10
  178. package/src/collection-facets/more-facets-content.ts +639 -639
  179. package/src/collection-facets.ts +1 -1
  180. package/src/combo-box/caret-closed.ts +5 -11
  181. package/src/combo-box/caret-open.ts +5 -11
  182. package/src/combo-box/clear.ts +11 -0
  183. package/src/combo-box/ia-combo-box.ts +1288 -1180
  184. package/src/combo-box/models.ts +31 -1
  185. package/src/manage/manage-bar.ts +247 -247
  186. package/src/restoration-state-handler.ts +5 -1
  187. package/src/tiles/base-tile-component.ts +65 -65
  188. package/src/tiles/grid/account-tile.ts +113 -113
  189. package/src/tiles/grid/collection-tile.ts +163 -163
  190. package/src/tiles/grid/item-tile.ts +340 -340
  191. package/src/tiles/grid/search-tile.ts +90 -90
  192. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  193. package/src/tiles/hover/hover-pane-controller.ts +613 -613
  194. package/src/tiles/hover/tile-hover-pane.ts +184 -184
  195. package/src/tiles/list/tile-list-compact.ts +239 -239
  196. package/src/tiles/list/tile-list.ts +700 -700
  197. package/src/tiles/tile-dispatcher.ts +517 -517
  198. package/src/utils/format-date.ts +62 -62
  199. package/test/collection-facets/facet-row.test.ts +375 -375
  200. package/test/collection-facets.test.ts +928 -928
  201. package/test/tiles/grid/item-tile.test.ts +520 -520
  202. package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
  203. package/test/tiles/list/tile-list-compact.test.ts +282 -282
  204. package/test/tiles/list/tile-list.test.ts +552 -552
  205. package/test/tiles/tile-dispatcher.test.ts +283 -283
  206. package/test/utils/format-date.test.ts +89 -89
  207. package/tsconfig.json +8 -3
  208. package/vite.config.ts +29 -22
@@ -4,13 +4,12 @@ import { html } from 'lit';
4
4
  import '../../../src/tiles/grid/item-tile';
5
5
  describe('Item Tile', () => {
6
6
  it('should render initial component', async () => {
7
- var _a, _b, _c, _d, _e;
8
7
  const el = await fixture(html `<item-tile></item-tile>`);
9
- const container = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.container');
10
- const tileDetails = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.tile-details');
11
- const itemInfo = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.item-info');
12
- const itemTitle = (_d = el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('#title');
13
- const imageBlock = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('image-block');
8
+ const container = el.shadowRoot?.querySelector('.container');
9
+ const tileDetails = el.shadowRoot?.querySelector('.tile-details');
10
+ const itemInfo = el.shadowRoot?.querySelector('.item-info');
11
+ const itemTitle = el.shadowRoot?.querySelector('#title');
12
+ const imageBlock = el.shadowRoot?.querySelector('image-block');
14
13
  expect(container).to.exist;
15
14
  expect(tileDetails).to.exist;
16
15
  expect(itemInfo).to.exist;
@@ -18,14 +17,13 @@ describe('Item Tile', () => {
18
17
  expect(itemTitle).to.exist;
19
18
  });
20
19
  it('should render with created-by element', async () => {
21
- var _a, _b, _c, _d, _e;
22
20
  const el = await fixture(html `<item-tile .model=${{ creator: 'someone' }}></item-tile>`);
23
- const container = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.container');
24
- const tileDetails = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.tile-details');
25
- const itemInfo = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.item-info');
26
- const createdBy = (_d = el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('.created-by');
27
- const truncatedCreatorText = createdBy === null || createdBy === void 0 ? void 0 : createdBy.querySelector('.truncated');
28
- const dateSortedBy = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('.date-sorted-by');
21
+ const container = el.shadowRoot?.querySelector('.container');
22
+ const tileDetails = el.shadowRoot?.querySelector('.tile-details');
23
+ const itemInfo = el.shadowRoot?.querySelector('.item-info');
24
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
25
+ const truncatedCreatorText = createdBy?.querySelector('.truncated');
26
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
29
27
  expect(container).to.exist;
30
28
  expect(tileDetails).to.exist;
31
29
  expect(itemInfo).to.exist;
@@ -34,226 +32,212 @@ describe('Item Tile', () => {
34
32
  expect(dateSortedBy).to.not.exist;
35
33
  });
36
34
  it('should not render with created-by but date element', async () => {
37
- var _a, _b;
38
35
  const el = await fixture(html `<item-tile .model=${{ datePublished: new Date() }}></item-tile>`);
39
36
  el.sortParam = {
40
37
  field: 'date',
41
38
  direction: 'desc',
42
39
  };
43
40
  await el.updateComplete;
44
- const createdBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.created-by');
45
- const dateSortedBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.date-sorted-by');
41
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
42
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
46
43
  expect(createdBy).to.not.exist;
47
44
  expect(dateSortedBy).to.exist;
48
45
  });
49
46
  it('should not render with created-by but reviewdate element', async () => {
50
- var _a, _b;
51
47
  const el = await fixture(html `<item-tile .model=${{ dateReviewed: new Date() }}></item-tile>`);
52
48
  el.sortParam = {
53
49
  field: 'reviewdate',
54
50
  direction: 'desc',
55
51
  };
56
52
  await el.updateComplete;
57
- const createdBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.created-by');
58
- const dateSortedBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.date-sorted-by');
53
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
54
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
59
55
  expect(createdBy).to.not.exist;
60
56
  expect(dateSortedBy).to.exist;
61
57
  });
62
58
  it('should not render with created-by but publicdate element', async () => {
63
- var _a, _b;
64
59
  const el = await fixture(html `<item-tile .model=${{ dateArchived: new Date() }}></item-tile>`);
65
60
  el.sortParam = {
66
61
  field: 'publicdate',
67
62
  direction: 'desc',
68
63
  };
69
64
  await el.updateComplete;
70
- const createdBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.created-by');
71
- const dateSortedBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.date-sorted-by');
65
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
66
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
72
67
  expect(createdBy).to.not.exist;
73
68
  expect(dateSortedBy).to.exist;
74
69
  });
75
70
  it('should not render date-sorted-by element if date is not provided', async () => {
76
- var _a, _b;
77
71
  const el = await fixture(html `<item-tile .model=${{ dateArchived: undefined }}></item-tile>`);
78
72
  el.sortParam = {
79
73
  field: 'publicdate',
80
74
  direction: 'desc',
81
75
  };
82
76
  await el.updateComplete;
83
- const createdBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.created-by');
84
- const dateSortedBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.date-sorted-by');
77
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
78
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
85
79
  expect(createdBy).to.not.exist;
86
80
  expect(dateSortedBy).to.not.exist;
87
81
  });
88
82
  it('should render without created-by when sorting by a date field', async () => {
89
- var _a, _b, _c;
90
83
  const el = await fixture(html `<item-tile .model=${{ dateAdded: new Date() }}></item-tile>`);
91
84
  el.sortParam = {
92
85
  field: 'addeddate',
93
86
  direction: 'asc',
94
87
  };
95
88
  await el.updateComplete;
96
- const itemInfo = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.item-info');
97
- const createdBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.created-by');
98
- const dateSortedBy = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.date-sorted-by');
89
+ const itemInfo = el.shadowRoot?.querySelector('.item-info');
90
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
91
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
99
92
  expect(itemInfo).to.exist;
100
93
  expect(createdBy).to.not.exist;
101
94
  expect(dateSortedBy).to.exist;
102
95
  });
103
96
  it('should render with created-by when sort field is not a date', async () => {
104
- var _a, _b, _c;
105
97
  const el = await fixture(html `<item-tile .model=${{ creator: 'someone' }}></item-tile>`);
106
98
  el.sortParam = {
107
99
  field: 'week',
108
100
  direction: 'asc',
109
101
  };
110
102
  await el.updateComplete;
111
- const itemInfo = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.item-info');
112
- const createdBy = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.created-by');
113
- const dateSortedBy = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.date-sorted-by');
103
+ const itemInfo = el.shadowRoot?.querySelector('.item-info');
104
+ const createdBy = el.shadowRoot?.querySelector('.created-by');
105
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
114
106
  expect(itemInfo).to.exist;
115
107
  expect(dateSortedBy).to.not.exist; // it should not exist because this is not a date sort
116
108
  expect(createdBy).to.exist;
117
109
  });
118
110
  it('should render published date when sorting by it', async () => {
119
- var _a, _b;
120
111
  const model = {
121
112
  dateAdded: new Date(2010, 0, 2),
122
113
  dateArchived: new Date(2011, 0, 2),
123
114
  datePublished: new Date(2012, 0, 2),
124
115
  dateReviewed: new Date(2013, 0, 2),
125
116
  };
126
- const el = await fixture(html `
127
- <item-tile
128
- .model=${model}
129
- .sortParam=${{ field: 'date', direction: 'desc' }}
130
- >
131
- </item-tile>
117
+ const el = await fixture(html `
118
+ <item-tile
119
+ .model=${model}
120
+ .sortParam=${{ field: 'date', direction: 'desc' }}
121
+ >
122
+ </item-tile>
132
123
  `);
133
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
124
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
134
125
  expect(dateSortedBy).to.exist;
135
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('published Jan 02, 2012');
126
+ expect(dateSortedBy?.textContent?.trim()).to.contain('published Jan 02, 2012');
136
127
  });
137
128
  it('should render added date when sorting by it', async () => {
138
- var _a, _b;
139
129
  const model = {
140
130
  dateAdded: new Date(2010, 0, 2),
141
131
  dateArchived: new Date(2011, 0, 2),
142
132
  datePublished: new Date(2012, 0, 2),
143
133
  dateReviewed: new Date(2013, 0, 2),
144
134
  };
145
- const el = await fixture(html `
146
- <item-tile
147
- .model=${model}
148
- .sortParam=${{ field: 'addeddate', direction: 'desc' }}
149
- >
150
- </item-tile>
135
+ const el = await fixture(html `
136
+ <item-tile
137
+ .model=${model}
138
+ .sortParam=${{ field: 'addeddate', direction: 'desc' }}
139
+ >
140
+ </item-tile>
151
141
  `);
152
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
142
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
153
143
  expect(dateSortedBy).to.exist;
154
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('added Jan 02, 2010');
144
+ expect(dateSortedBy?.textContent?.trim()).to.contain('added Jan 02, 2010');
155
145
  });
156
146
  it('should render archived date when sorting by it', async () => {
157
- var _a, _b;
158
147
  const model = {
159
148
  dateAdded: new Date(2010, 0, 2),
160
149
  dateArchived: new Date(2011, 0, 2),
161
150
  datePublished: new Date(2012, 0, 2),
162
151
  dateReviewed: new Date(2013, 0, 2),
163
152
  };
164
- const el = await fixture(html `
165
- <item-tile
166
- .model=${model}
167
- .sortParam=${{ field: 'publicdate', direction: 'desc' }}
168
- >
169
- </item-tile>
153
+ const el = await fixture(html `
154
+ <item-tile
155
+ .model=${model}
156
+ .sortParam=${{ field: 'publicdate', direction: 'desc' }}
157
+ >
158
+ </item-tile>
170
159
  `);
171
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
160
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
172
161
  expect(dateSortedBy).to.exist;
173
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('archived Jan 02, 2011');
162
+ expect(dateSortedBy?.textContent?.trim()).to.contain('archived Jan 02, 2011');
174
163
  });
175
164
  it('should render reviewed date when sorting by it', async () => {
176
- var _a, _b;
177
165
  const model = {
178
166
  dateAdded: new Date(2010, 0, 2),
179
167
  dateArchived: new Date(2011, 0, 2),
180
168
  datePublished: new Date(2012, 0, 2),
181
169
  dateReviewed: new Date(2013, 0, 2),
182
170
  };
183
- const el = await fixture(html `
184
- <item-tile
185
- .model=${model}
186
- .sortParam=${{ field: 'reviewdate', direction: 'desc' }}
187
- >
188
- </item-tile>
171
+ const el = await fixture(html `
172
+ <item-tile
173
+ .model=${model}
174
+ .sortParam=${{ field: 'reviewdate', direction: 'desc' }}
175
+ >
176
+ </item-tile>
189
177
  `);
190
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
178
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
191
179
  expect(dateSortedBy).to.exist;
192
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('reviewed Jan 02, 2013');
180
+ expect(dateSortedBy?.textContent?.trim()).to.contain('reviewed Jan 02, 2013');
193
181
  });
194
182
  it('should only show the year for a date published of Jan 1 at midnight UTC', async () => {
195
- var _a, _b;
196
183
  const model = {
197
184
  datePublished: new Date('2012-01-01T00:00:00Z'),
198
185
  };
199
- const el = await fixture(html `
200
- <item-tile
201
- .model=${model}
202
- .sortParam=${{ field: 'date', direction: 'desc' }}
203
- >
204
- </item-tile>
186
+ const el = await fixture(html `
187
+ <item-tile
188
+ .model=${model}
189
+ .sortParam=${{ field: 'date', direction: 'desc' }}
190
+ >
191
+ </item-tile>
205
192
  `);
206
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
193
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
207
194
  expect(dateSortedBy).to.exist;
208
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('published 2012');
195
+ expect(dateSortedBy?.textContent?.trim()).to.equal('published 2012');
209
196
  });
210
197
  it('should show full date added/archived/reviewed, even on Jan 1 at midnight UTC', async () => {
211
- var _a, _b, _c, _d, _e, _f;
212
198
  const model = {
213
199
  dateAdded: new Date(2010, 0, 1, 0, 0, 0, 0),
214
200
  dateArchived: new Date(2011, 0, 1, 0, 0, 0, 0),
215
201
  datePublished: new Date(2012, 0, 1, 0, 0, 0, 0),
216
202
  dateReviewed: new Date(2013, 0, 1, 0, 0, 0, 0),
217
203
  };
218
- const el = await fixture(html `
219
- <item-tile
220
- .model=${model}
221
- .sortParam=${{ field: 'addeddate', direction: 'desc' }}
222
- >
223
- </item-tile>
204
+ const el = await fixture(html `
205
+ <item-tile
206
+ .model=${model}
207
+ .sortParam=${{ field: 'addeddate', direction: 'desc' }}
208
+ >
209
+ </item-tile>
224
210
  `);
225
- let dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
211
+ let dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
226
212
  expect(dateSortedBy).to.exist;
227
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('added Jan 01, 2010');
213
+ expect(dateSortedBy?.textContent?.trim()).to.equal('added Jan 01, 2010');
228
214
  el.sortParam = { field: 'publicdate', direction: 'desc' };
229
215
  await el.updateComplete;
230
- dateSortedBy = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.date-sorted-by');
216
+ dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
231
217
  expect(dateSortedBy).to.exist;
232
- expect((_d = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _d === void 0 ? void 0 : _d.trim()).to.equal('archived Jan 01, 2011');
218
+ expect(dateSortedBy?.textContent?.trim()).to.equal('archived Jan 01, 2011');
233
219
  el.sortParam = { field: 'reviewdate', direction: 'desc' };
234
220
  await el.updateComplete;
235
- dateSortedBy = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('.date-sorted-by');
221
+ dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
236
222
  expect(dateSortedBy).to.exist;
237
- expect((_f = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _f === void 0 ? void 0 : _f.trim()).to.equal('reviewed Jan 01, 2013');
223
+ expect(dateSortedBy?.textContent?.trim()).to.equal('reviewed Jan 01, 2013');
238
224
  });
239
225
  it('should display dates in UTC time zone by default', async () => {
240
- var _a, _b;
241
226
  const model = {
242
227
  datePublished: new Date('2012-02-15T00:00:00Z'),
243
228
  };
244
- const el = await fixture(html `
245
- <item-tile
246
- .model=${model}
247
- .sortParam=${{ field: 'date', direction: 'desc' }}
248
- >
249
- </item-tile>
229
+ const el = await fixture(html `
230
+ <item-tile
231
+ .model=${model}
232
+ .sortParam=${{ field: 'date', direction: 'desc' }}
233
+ >
234
+ </item-tile>
250
235
  `);
251
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
236
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
252
237
  expect(dateSortedBy).to.exist;
253
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('published Feb 15, 2012');
238
+ expect(dateSortedBy?.textContent?.trim()).to.equal('published Feb 15, 2012');
254
239
  });
255
240
  it('should display dates in local time when useLocalTime option is true', async () => {
256
- var _a, _b;
257
241
  // Expected behavior depends on the time zone offset where the testing occurs
258
242
  const offset = new Date().getTimezoneOffset();
259
243
  let datePublished, expected;
@@ -275,152 +259,141 @@ describe('Item Tile', () => {
275
259
  const model = {
276
260
  datePublished,
277
261
  };
278
- const el = await fixture(html `
279
- <item-tile
280
- useLocalTime
281
- .model=${model}
282
- .sortParam=${{ field: 'date', direction: 'desc' }}
283
- >
284
- </item-tile>
262
+ const el = await fixture(html `
263
+ <item-tile
264
+ useLocalTime
265
+ .model=${model}
266
+ .sortParam=${{ field: 'date', direction: 'desc' }}
267
+ >
268
+ </item-tile>
285
269
  `);
286
- const dateSortedBy = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.date-sorted-by');
270
+ const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
287
271
  expect(dateSortedBy).to.exist;
288
- expect((_b = dateSortedBy === null || dateSortedBy === void 0 ? void 0 : dateSortedBy.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal(expected);
272
+ expect(dateSortedBy?.textContent?.trim()).to.equal(expected);
289
273
  });
290
274
  it('should show the first creator matching the letter filter, if defined', async () => {
291
- var _a, _b;
292
275
  const model = {
293
276
  creator: 'foo',
294
277
  creators: ['foo', 'bar', 'baz'],
295
278
  };
296
- const el = await fixture(html `
297
- <item-tile .model=${model} .creatorFilter=${'B'}> </item-tile>
279
+ const el = await fixture(html `
280
+ <item-tile .model=${model} .creatorFilter=${'B'}> </item-tile>
298
281
  `);
299
- const creator = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.created-by');
282
+ const creator = el.shadowRoot?.querySelector('.created-by');
300
283
  expect(creator).to.exist;
301
- expect((_b = creator === null || creator === void 0 ? void 0 : creator.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.match(/by\s+bar/);
284
+ expect(creator?.textContent?.trim()).to.match(/by\s+bar/);
302
285
  });
303
286
  it('should render with snippet block when it has snippets', async () => {
304
- var _a;
305
- const el = await fixture(html `
306
- <item-tile .model=${{ snippets: ['some {{{snippet}}} text'] }}>
307
- </item-tile>
287
+ const el = await fixture(html `
288
+ <item-tile .model=${{ snippets: ['some {{{snippet}}} text'] }}>
289
+ </item-tile>
308
290
  `);
309
- const snippetBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('text-snippet-block');
291
+ const snippetBlock = el.shadowRoot?.querySelector('text-snippet-block');
310
292
  expect(snippetBlock).to.exist;
311
293
  });
312
294
  it('should not render snippet block when no snippets are present', async () => {
313
- var _a;
314
295
  const el = await fixture(html `<item-tile></item-tile>`);
315
- const snippetBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('text-snippet-block');
296
+ const snippetBlock = el.shadowRoot?.querySelector('text-snippet-block');
316
297
  expect(snippetBlock).to.not.exist;
317
298
  });
318
299
  it('should render info button when showInfoButton flag is set', async () => {
319
- var _a;
320
- const el = await fixture(html `
321
- <item-tile ?showInfoButton=${true}> </item-tile>
300
+ const el = await fixture(html `
301
+ <item-tile ?showInfoButton=${true}> </item-tile>
322
302
  `);
323
- const infoButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.info-button');
303
+ const infoButton = el.shadowRoot?.querySelector('.info-button');
324
304
  expect(infoButton).to.exist;
325
305
  });
326
306
  it('should dispatch event when info button tapped', async () => {
327
- var _a;
328
307
  const infoButtonSpy = sinon.spy();
329
- const el = await fixture(html `
330
- <item-tile ?showInfoButton=${true} @infoButtonPressed=${infoButtonSpy}>
331
- </item-tile>
308
+ const el = await fixture(html `
309
+ <item-tile ?showInfoButton=${true} @infoButtonPressed=${infoButtonSpy}>
310
+ </item-tile>
332
311
  `);
333
- const infoButton = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.info-button');
312
+ const infoButton = el.shadowRoot?.querySelector('.info-button');
334
313
  infoButton.click();
335
314
  await el.updateComplete;
336
315
  expect(infoButtonSpy.callCount).to.equal(1);
337
316
  });
338
317
  it('should render with volume/issue view', async () => {
339
- var _a;
340
- const el = await fixture(html `
341
- <item-tile .model=${{ volume: '1', issue: 'Index' }}></item-tile>
318
+ const el = await fixture(html `
319
+ <item-tile .model=${{ volume: '1', issue: 'Index' }}></item-tile>
342
320
  `);
343
- const volumeIssueBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.volume-issue');
321
+ const volumeIssueBlock = el.shadowRoot?.querySelector('.volume-issue');
344
322
  expect(volumeIssueBlock).to.exist;
345
323
  });
346
324
  it('should render with volume/issue view to not render', async () => {
347
- var _a;
348
325
  const el = await fixture(html `<item-tile></item-tile>`);
349
- const volumeIssueBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.volume-issue');
326
+ const volumeIssueBlock = el.shadowRoot?.querySelector('.volume-issue');
350
327
  expect(volumeIssueBlock).to.not.exist;
351
328
  });
352
329
  it('should render web capture date links if present', async () => {
353
- var _a, _b, _c, _d, _e;
354
330
  const captureDates = [
355
331
  new Date('2010-01-02T12:34:56Z'),
356
332
  new Date('2011-02-03T12:43:21Z'),
357
333
  ];
358
- const el = await fixture(html `
359
- <item-tile
334
+ const el = await fixture(html `
335
+ <item-tile
360
336
  .model=${{
361
337
  identifier: 'foo',
362
338
  title: 'https://example.com/',
363
339
  captureDates,
364
- }}
365
- ></item-tile>
340
+ }}
341
+ ></item-tile>
366
342
  `);
367
- const captureDatesUl = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.capture-dates');
343
+ const captureDatesUl = el.shadowRoot?.querySelector('.capture-dates');
368
344
  expect(captureDatesUl, 'capture dates container').to.exist;
369
- expect(captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children.length).to.equal(2);
370
- const firstDateLink = (_b = captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children[0]) === null || _b === void 0 ? void 0 : _b.querySelector('a[href]');
345
+ expect(captureDatesUl?.children.length).to.equal(2);
346
+ const firstDateLink = captureDatesUl?.children[0]?.querySelector('a[href]');
371
347
  expect(firstDateLink, 'first date link').to.exist;
372
- expect(firstDateLink === null || firstDateLink === void 0 ? void 0 : firstDateLink.getAttribute('href')).to.equal('https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F');
373
- expect((_c = firstDateLink === null || firstDateLink === void 0 ? void 0 : firstDateLink.textContent) === null || _c === void 0 ? void 0 : _c.trim()).to.equal('Jan 02, 2010');
374
- const secondDateLink = (_d = captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children[1]) === null || _d === void 0 ? void 0 : _d.querySelector('a[href]');
348
+ expect(firstDateLink?.getAttribute('href')).to.equal('https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F');
349
+ expect(firstDateLink?.textContent?.trim()).to.equal('Jan 02, 2010');
350
+ const secondDateLink = captureDatesUl?.children[1]?.querySelector('a[href]');
375
351
  expect(secondDateLink, 'second date link').to.exist;
376
- expect(secondDateLink === null || secondDateLink === void 0 ? void 0 : secondDateLink.getAttribute('href')).to.equal('https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F');
377
- expect((_e = secondDateLink === null || secondDateLink === void 0 ? void 0 : secondDateLink.textContent) === null || _e === void 0 ? void 0 : _e.trim()).to.equal('Feb 03, 2011');
352
+ expect(secondDateLink?.getAttribute('href')).to.equal('https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F');
353
+ expect(secondDateLink?.textContent?.trim()).to.equal('Feb 03, 2011');
378
354
  });
379
355
  it('should not render web captures if no title is present', async () => {
380
- var _a;
381
356
  const captureDates = [
382
357
  new Date('2010-01-02T12:34:56Z'),
383
358
  new Date('2011-02-03T12:43:21Z'),
384
359
  ];
385
- const el = await fixture(html `
386
- <item-tile
360
+ const el = await fixture(html `
361
+ <item-tile
387
362
  .model=${{
388
363
  identifier: 'foo',
389
364
  captureDates,
390
- }}
391
- ></item-tile>
365
+ }}
366
+ ></item-tile>
392
367
  `);
393
- const captureDatesUl = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.capture-dates');
368
+ const captureDatesUl = el.shadowRoot?.querySelector('.capture-dates');
394
369
  expect(captureDatesUl).not.to.exist;
395
370
  });
396
371
  it('should render review snippet if present', async () => {
397
- var _a;
398
372
  const review = {
399
373
  title: 'Foo',
400
374
  body: 'foo bar baz',
401
375
  stars: 3,
402
376
  };
403
- const el = await fixture(html `
404
- <item-tile
377
+ const el = await fixture(html `
378
+ <item-tile
405
379
  .model=${{
406
380
  identifier: 'foo',
407
381
  review,
408
- }}
409
- ></item-tile>
382
+ }}
383
+ ></item-tile>
410
384
  `);
411
- const reviewBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('review-block');
385
+ const reviewBlock = el.shadowRoot?.querySelector('review-block');
412
386
  expect(reviewBlock).to.exist;
413
387
  });
414
388
  it('should not render review snippet block when no review is present', async () => {
415
- var _a;
416
- const el = await fixture(html `
417
- <item-tile
389
+ const el = await fixture(html `
390
+ <item-tile
418
391
  .model=${{
419
392
  identifier: 'foo',
420
- }}
421
- ></item-tile>
393
+ }}
394
+ ></item-tile>
422
395
  `);
423
- const reviewBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('review-block');
396
+ const reviewBlock = el.shadowRoot?.querySelector('review-block');
424
397
  expect(reviewBlock).not.to.exist;
425
398
  });
426
399
  });