@internetarchive/collection-browser 2.7.13 → 2.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +3 -3
- package/.github/workflows/gh-pages-main.yml +2 -2
- package/.github/workflows/pr-preview.yml +2 -2
- package/.prettierignore +1 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +1 -1
- package/dist/src/app-root.js +4 -4
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/assets/img/icons/arrow-left.d.ts +1 -1
- package/dist/src/assets/img/icons/arrow-right.d.ts +1 -1
- package/dist/src/assets/img/icons/chevron.d.ts +1 -1
- package/dist/src/assets/img/icons/contract.d.ts +1 -1
- package/dist/src/assets/img/icons/empty-query.d.ts +1 -1
- package/dist/src/assets/img/icons/expand.d.ts +1 -1
- package/dist/src/assets/img/icons/eye-closed.d.ts +1 -1
- package/dist/src/assets/img/icons/eye.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
- package/dist/src/assets/img/icons/filter.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/null-result.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/circular-activity-indicator.d.ts +1 -1
- package/dist/src/circular-activity-indicator.js.map +1 -1
- package/dist/src/collection-browser.js +1 -2
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +5 -5
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
- package/dist/src/collection-facets/more-facets-content.js +2 -4
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +1 -0
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/dedupe.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/models.d.ts +2 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +1 -4
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.d.ts +2 -2
- package/dist/src/collection-facets/toggle-switch.js +2 -2
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +2 -3
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +8 -9
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.d.ts +2 -2
- package/dist/src/empty-placeholder.d.ts +1 -1
- package/dist/src/empty-placeholder.js +10 -11
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +86 -86
- package/dist/src/language-code-handler/language-code-mapping.js.map +1 -1
- package/dist/src/manage/manage-bar.js +16 -16
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/mediatype/mediatype-config.js +1 -0
- package/dist/src/mediatype/mediatype-config.js.map +1 -1
- package/dist/src/models.d.ts +15 -15
- package/dist/src/models.js +3 -3
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +0 -1
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +9 -9
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +1 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +2 -3
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +1 -1
- package/dist/src/tiles/grid/tile-stats.js +2 -2
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +3 -1
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +1 -1
- package/dist/src/tiles/image-block.js +1 -1
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +1 -1
- package/dist/src/tiles/item-image.js +2 -2
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +4 -6
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/mediatype-icon.d.ts +1 -1
- package/dist/src/tiles/mediatype-icon.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/review-block.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -1
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/utils/facet-utils.js.map +1 -1
- package/dist/src/utils/format-count.d.ts +2 -2
- package/dist/src/utils/format-count.js +0 -1
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/format-date.d.ts +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/src/utils/format-unit-size.js.map +1 -1
- package/dist/src/utils/log.js +1 -3
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +4 -3
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +4 -1
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +0 -1
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +0 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +12 -3
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +4 -4
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +0 -1
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +4 -3
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +0 -1
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +0 -1
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +0 -1
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +2 -3
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +0 -1
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +0 -1
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +0 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +0 -1
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +0 -1
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +22 -23
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +0 -1
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +0 -1
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +0 -1
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +0 -1
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +0 -1
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +0 -1
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/utils/format-count.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/dist/test/utils/local-date-from-utc.test.js.map +1 -1
- package/eslint.config.mjs +53 -0
- package/index.html +0 -3
- package/package.json +41 -39
- package/src/app-root.ts +21 -22
- package/src/collection-browser.ts +36 -38
- package/src/collection-facets/facets-template.ts +7 -6
- package/src/collection-facets/more-facets-content.ts +11 -13
- package/src/collection-facets/more-facets-pagination.ts +3 -2
- package/src/collection-facets/smart-facets/dedupe.ts +2 -2
- package/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.ts +1 -1
- package/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.ts +6 -6
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +6 -8
- package/src/collection-facets/smart-facets/smart-facet-button.ts +5 -3
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +4 -4
- package/src/collection-facets/smart-facets/smart-facet-heuristics.ts +1 -1
- package/src/collection-facets/toggle-switch.ts +2 -2
- package/src/collection-facets.ts +18 -19
- package/src/data-source/collection-browser-data-source-interface.ts +5 -1
- package/src/data-source/collection-browser-data-source.ts +37 -34
- package/src/empty-placeholder.ts +19 -16
- package/src/expanded-date-picker.ts +1 -1
- package/src/language-code-handler/language-code-handler.ts +1 -1
- package/src/manage/manage-bar.ts +23 -20
- package/src/manage/remove-items-modal-content.ts +2 -2
- package/src/mediatype/mediatype-config.ts +1 -0
- package/src/models.ts +3 -3
- package/src/restoration-state-handler.ts +14 -15
- package/src/sort-filter-bar/alpha-bar.ts +16 -17
- package/src/sort-filter-bar/sort-filter-bar.ts +14 -15
- package/src/tiles/grid/account-tile.ts +1 -1
- package/src/tiles/grid/collection-tile.ts +1 -1
- package/src/tiles/grid/item-tile.ts +9 -9
- package/src/tiles/grid/tile-stats.ts +4 -4
- package/src/tiles/hover/hover-pane-controller.ts +1 -1
- package/src/tiles/hover/tile-hover-pane.ts +4 -2
- package/src/tiles/item-image.ts +1 -1
- package/src/tiles/list/tile-list-compact.ts +2 -2
- package/src/tiles/list/tile-list.ts +22 -24
- package/src/tiles/tile-dispatcher.ts +5 -5
- package/src/tiles/tile-display-value-provider.ts +4 -4
- package/src/utils/facet-utils.ts +6 -6
- package/src/utils/format-count.ts +2 -3
- package/src/utils/format-date.ts +1 -1
- package/src/utils/format-unit-size.ts +1 -1
- package/src/utils/log.ts +1 -3
- package/test/collection-browser.test.ts +125 -124
- package/test/collection-facets/facet-row.test.ts +31 -28
- package/test/collection-facets/facets-template.test.ts +9 -9
- package/test/collection-facets/more-facets-content.test.ts +14 -15
- package/test/collection-facets/more-facets-pagination.test.ts +18 -19
- package/test/collection-facets/toggle-switch.test.ts +28 -18
- package/test/collection-facets.test.ts +46 -39
- package/test/data-source/collection-browser-data-source.test.ts +2 -2
- package/test/empty-placeholder.test.ts +6 -7
- package/test/expanded-date-picker.test.ts +25 -20
- package/test/icon-overlay.test.ts +0 -1
- package/test/image-block.test.ts +6 -7
- package/test/item-image.test.ts +0 -1
- package/test/manage/manage-bar.test.ts +19 -16
- package/test/manage/remove-items-modal-content.test.ts +4 -5
- package/test/mocks/mock-search-responses.ts +2 -1
- package/test/mocks/mock-search-service.ts +1 -1
- package/test/restoration-state-handler.test.ts +12 -12
- package/test/review-block.test.ts +1 -2
- package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +1 -1
- package/test/sort-filter-bar/alpha-bar.test.ts +5 -5
- package/test/sort-filter-bar/sort-filter-bar.test.ts +38 -39
- package/test/text-overlay.test.ts +0 -1
- package/test/text-snippet-block.test.ts +5 -6
- package/test/tile-stats.test.ts +26 -35
- package/test/tiles/grid/account-tile.test.ts +2 -3
- package/test/tiles/grid/collection-tile.test.ts +3 -4
- package/test/tiles/grid/item-tile.test.ts +13 -14
- package/test/tiles/grid/search-tile.test.ts +1 -2
- package/test/tiles/hover/hover-pane-controller.test.ts +15 -15
- package/test/tiles/hover/tile-hover-pane.test.ts +5 -5
- package/test/tiles/list/tile-list-compact.test.ts +1 -2
- package/test/tiles/list/tile-list.test.ts +10 -11
- package/test/tiles/tile-dispatcher.test.ts +5 -5
- package/test/utils/format-count.test.ts +1 -1
- package/test/utils/format-date.test.ts +1 -1
- package/test/utils/local-date-from-utc.test.ts +1 -1
- package/tsconfig.json +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import { html } from 'lit';
|
|
4
3
|
import type { TextSnippetBlock } from '../src/tiles/text-snippet-block';
|
|
@@ -7,7 +6,7 @@ import '../src/tiles/text-snippet-block';
|
|
|
7
6
|
describe('TextSnippetBlock component', () => {
|
|
8
7
|
it('should render initial component', async () => {
|
|
9
8
|
const el = await fixture<TextSnippetBlock>(
|
|
10
|
-
html`<text-snippet-block></text-snippet-block
|
|
9
|
+
html`<text-snippet-block></text-snippet-block>`,
|
|
11
10
|
);
|
|
12
11
|
|
|
13
12
|
// No content if no snippets
|
|
@@ -27,7 +26,7 @@ describe('TextSnippetBlock component', () => {
|
|
|
27
26
|
];
|
|
28
27
|
|
|
29
28
|
const el = await fixture<TextSnippetBlock>(
|
|
30
|
-
html`<text-snippet-block .snippets=${snippets}></text-snippet-block
|
|
29
|
+
html`<text-snippet-block .snippets=${snippets}></text-snippet-block>`,
|
|
31
30
|
);
|
|
32
31
|
|
|
33
32
|
const container = el.shadowRoot?.querySelector('.snippet-view');
|
|
@@ -44,7 +43,7 @@ describe('TextSnippetBlock component', () => {
|
|
|
44
43
|
];
|
|
45
44
|
|
|
46
45
|
const el = await fixture<TextSnippetBlock>(
|
|
47
|
-
html`<text-snippet-block .snippets=${snippets}></text-snippet-block
|
|
46
|
+
html`<text-snippet-block .snippets=${snippets}></text-snippet-block>`,
|
|
48
47
|
);
|
|
49
48
|
|
|
50
49
|
const container = el.shadowRoot?.querySelector('.snippet-view');
|
|
@@ -59,7 +58,7 @@ describe('TextSnippetBlock component', () => {
|
|
|
59
58
|
html`<text-snippet-block
|
|
60
59
|
viewsize="grid"
|
|
61
60
|
.snippets=${['text']}
|
|
62
|
-
></text-snippet-block
|
|
61
|
+
></text-snippet-block>`,
|
|
63
62
|
);
|
|
64
63
|
|
|
65
64
|
const container = el.shadowRoot?.querySelector('.snippet-view');
|
|
@@ -74,7 +73,7 @@ describe('TextSnippetBlock component', () => {
|
|
|
74
73
|
html`<text-snippet-block
|
|
75
74
|
viewsize="list"
|
|
76
75
|
.snippets=${['text']}
|
|
77
|
-
></text-snippet-block
|
|
76
|
+
></text-snippet-block>`,
|
|
78
77
|
);
|
|
79
78
|
|
|
80
79
|
const container = el.shadowRoot?.querySelector('.snippet-view');
|
package/test/tile-stats.test.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import { html } from 'lit';
|
|
4
3
|
import type { TileStats } from '../src/tiles/grid/tile-stats';
|
|
@@ -19,17 +18,15 @@ describe('Tile Stats', () => {
|
|
|
19
18
|
});
|
|
20
19
|
|
|
21
20
|
it('should render component with value', async () => {
|
|
22
|
-
const el = await fixture<TileStats>(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`
|
|
32
|
-
);
|
|
21
|
+
const el = await fixture<TileStats>(html`
|
|
22
|
+
<tile-stats
|
|
23
|
+
.mediatype=${'account'}
|
|
24
|
+
.itemCount=${1}
|
|
25
|
+
.favCount=${2}
|
|
26
|
+
.commentCount=${3}
|
|
27
|
+
>
|
|
28
|
+
</tile-stats>
|
|
29
|
+
`);
|
|
33
30
|
|
|
34
31
|
const statsRow = el.shadowRoot?.querySelector('#stats-row');
|
|
35
32
|
|
|
@@ -56,17 +53,15 @@ describe('Tile Stats', () => {
|
|
|
56
53
|
});
|
|
57
54
|
|
|
58
55
|
it('should render view count for non-account items', async () => {
|
|
59
|
-
const el = await fixture<TileStats>(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
`
|
|
69
|
-
);
|
|
56
|
+
const el = await fixture<TileStats>(html`
|
|
57
|
+
<tile-stats
|
|
58
|
+
.mediatype=${'texts'}
|
|
59
|
+
.viewCount=${4}
|
|
60
|
+
.favCount=${5}
|
|
61
|
+
.commentCount=${6}
|
|
62
|
+
>
|
|
63
|
+
</tile-stats>
|
|
64
|
+
`);
|
|
70
65
|
|
|
71
66
|
const statsRow = el.shadowRoot?.querySelector('#stats-row');
|
|
72
67
|
|
|
@@ -94,12 +89,10 @@ describe('Tile Stats', () => {
|
|
|
94
89
|
});
|
|
95
90
|
|
|
96
91
|
it('handles missing counts gracefully', async () => {
|
|
97
|
-
const el = await fixture<TileStats>(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`
|
|
102
|
-
);
|
|
92
|
+
const el = await fixture<TileStats>(html`
|
|
93
|
+
<tile-stats .mediatype=${'texts'} .favCount=${5} .commentCount=${6}>
|
|
94
|
+
</tile-stats>
|
|
95
|
+
`);
|
|
103
96
|
|
|
104
97
|
const statsRow = el.shadowRoot?.querySelector('#stats-row');
|
|
105
98
|
|
|
@@ -127,12 +120,10 @@ describe('Tile Stats', () => {
|
|
|
127
120
|
});
|
|
128
121
|
|
|
129
122
|
it('handles missing counts gracefully for accounts', async () => {
|
|
130
|
-
const el = await fixture<TileStats>(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
135
|
-
);
|
|
123
|
+
const el = await fixture<TileStats>(html`
|
|
124
|
+
<tile-stats .mediatype=${'account'} .favCount=${5} .commentCount=${6}>
|
|
125
|
+
</tile-stats>
|
|
126
|
+
`);
|
|
136
127
|
|
|
137
128
|
const statsRow = el.shadowRoot?.querySelector('#stats-row');
|
|
138
129
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import sinon from 'sinon';
|
|
4
3
|
import { html } from 'lit';
|
|
@@ -38,7 +37,7 @@ describe('Account Tile', () => {
|
|
|
38
37
|
expect(itemInfo).to.exist;
|
|
39
38
|
expect(accountTitle).to.exist;
|
|
40
39
|
expect(accountTitle?.querySelector('.truncated')?.textContent).to.equal(
|
|
41
|
-
'@jack-sparrow'
|
|
40
|
+
'@jack-sparrow',
|
|
42
41
|
);
|
|
43
42
|
});
|
|
44
43
|
|
|
@@ -112,7 +111,7 @@ describe('Account Tile', () => {
|
|
|
112
111
|
`);
|
|
113
112
|
|
|
114
113
|
const infoButton = el.shadowRoot?.querySelector(
|
|
115
|
-
'.info-button'
|
|
114
|
+
'.info-button',
|
|
116
115
|
) as HTMLButtonElement;
|
|
117
116
|
infoButton.click();
|
|
118
117
|
await el.updateComplete;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import sinon from 'sinon';
|
|
4
3
|
import { html } from 'lit';
|
|
@@ -9,7 +8,7 @@ import '../../../src/tiles/grid/collection-tile';
|
|
|
9
8
|
describe('Collection Tile', () => {
|
|
10
9
|
it('should render initial component', async () => {
|
|
11
10
|
const el = await fixture<CollectionTile>(
|
|
12
|
-
html`<collection-tile></collection-tile
|
|
11
|
+
html`<collection-tile></collection-tile>`,
|
|
13
12
|
);
|
|
14
13
|
|
|
15
14
|
const itemInfo = el.shadowRoot?.querySelector('.item-info');
|
|
@@ -40,7 +39,7 @@ describe('Collection Tile', () => {
|
|
|
40
39
|
expect(itemInfo).to.exist;
|
|
41
40
|
expect(itemTitle).to.exist;
|
|
42
41
|
expect(itemTitle?.querySelector('.truncated')?.textContent).to.equal(
|
|
43
|
-
'Books'
|
|
42
|
+
'Books',
|
|
44
43
|
);
|
|
45
44
|
});
|
|
46
45
|
|
|
@@ -105,7 +104,7 @@ describe('Collection Tile', () => {
|
|
|
105
104
|
`);
|
|
106
105
|
|
|
107
106
|
const infoButton = el.shadowRoot?.querySelector(
|
|
108
|
-
'.info-button'
|
|
107
|
+
'.info-button',
|
|
109
108
|
) as HTMLButtonElement;
|
|
110
109
|
infoButton.click();
|
|
111
110
|
await el.updateComplete;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import sinon from 'sinon';
|
|
4
3
|
import { html } from 'lit';
|
|
@@ -26,7 +25,7 @@ describe('Item Tile', () => {
|
|
|
26
25
|
|
|
27
26
|
it('should render with created-by element', async () => {
|
|
28
27
|
const el = await fixture<ItemTile>(
|
|
29
|
-
html`<item-tile .model=${{ creator: 'someone' }}></item-tile
|
|
28
|
+
html`<item-tile .model=${{ creator: 'someone' }}></item-tile>`,
|
|
30
29
|
);
|
|
31
30
|
|
|
32
31
|
const container = el.shadowRoot?.querySelector('.container');
|
|
@@ -46,7 +45,7 @@ describe('Item Tile', () => {
|
|
|
46
45
|
|
|
47
46
|
it('should not render with created-by but date element', async () => {
|
|
48
47
|
const el = await fixture<ItemTile>(
|
|
49
|
-
html`<item-tile .model=${{ datePublished: new Date() }}></item-tile
|
|
48
|
+
html`<item-tile .model=${{ datePublished: new Date() }}></item-tile>`,
|
|
50
49
|
);
|
|
51
50
|
|
|
52
51
|
el.sortParam = {
|
|
@@ -64,7 +63,7 @@ describe('Item Tile', () => {
|
|
|
64
63
|
|
|
65
64
|
it('should not render with created-by but reviewdate element', async () => {
|
|
66
65
|
const el = await fixture<ItemTile>(
|
|
67
|
-
html`<item-tile .model=${{ dateReviewed: new Date() }}></item-tile
|
|
66
|
+
html`<item-tile .model=${{ dateReviewed: new Date() }}></item-tile>`,
|
|
68
67
|
);
|
|
69
68
|
|
|
70
69
|
el.sortParam = {
|
|
@@ -82,7 +81,7 @@ describe('Item Tile', () => {
|
|
|
82
81
|
|
|
83
82
|
it('should not render with created-by but publicdate element', async () => {
|
|
84
83
|
const el = await fixture<ItemTile>(
|
|
85
|
-
html`<item-tile .model=${{ dateArchived: new Date() }}></item-tile
|
|
84
|
+
html`<item-tile .model=${{ dateArchived: new Date() }}></item-tile>`,
|
|
86
85
|
);
|
|
87
86
|
|
|
88
87
|
el.sortParam = {
|
|
@@ -100,7 +99,7 @@ describe('Item Tile', () => {
|
|
|
100
99
|
|
|
101
100
|
it('should not render date-sorted-by element if date is not provided', async () => {
|
|
102
101
|
const el = await fixture<ItemTile>(
|
|
103
|
-
html`<item-tile .model=${{ dateArchived: undefined }}></item-tile
|
|
102
|
+
html`<item-tile .model=${{ dateArchived: undefined }}></item-tile>`,
|
|
104
103
|
);
|
|
105
104
|
|
|
106
105
|
el.sortParam = {
|
|
@@ -118,7 +117,7 @@ describe('Item Tile', () => {
|
|
|
118
117
|
|
|
119
118
|
it('should render without created-by when sorting by a date field', async () => {
|
|
120
119
|
const el = await fixture<ItemTile>(
|
|
121
|
-
html`<item-tile .model=${{ dateAdded: new Date() }}></item-tile
|
|
120
|
+
html`<item-tile .model=${{ dateAdded: new Date() }}></item-tile>`,
|
|
122
121
|
);
|
|
123
122
|
|
|
124
123
|
el.sortParam = {
|
|
@@ -138,7 +137,7 @@ describe('Item Tile', () => {
|
|
|
138
137
|
|
|
139
138
|
it('should render with created-by when sort field is not a date', async () => {
|
|
140
139
|
const el = await fixture<ItemTile>(
|
|
141
|
-
html`<item-tile .model=${{ creator: 'someone' }}></item-tile
|
|
140
|
+
html`<item-tile .model=${{ creator: 'someone' }}></item-tile>`,
|
|
142
141
|
);
|
|
143
142
|
|
|
144
143
|
el.sortParam = {
|
|
@@ -175,7 +174,7 @@ describe('Item Tile', () => {
|
|
|
175
174
|
const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
|
|
176
175
|
expect(dateSortedBy).to.exist;
|
|
177
176
|
expect(dateSortedBy?.textContent?.trim()).to.contain(
|
|
178
|
-
'published Jan 02, 2012'
|
|
177
|
+
'published Jan 02, 2012',
|
|
179
178
|
);
|
|
180
179
|
});
|
|
181
180
|
|
|
@@ -219,7 +218,7 @@ describe('Item Tile', () => {
|
|
|
219
218
|
const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
|
|
220
219
|
expect(dateSortedBy).to.exist;
|
|
221
220
|
expect(dateSortedBy?.textContent?.trim()).to.contain(
|
|
222
|
-
'archived Jan 02, 2011'
|
|
221
|
+
'archived Jan 02, 2011',
|
|
223
222
|
);
|
|
224
223
|
});
|
|
225
224
|
|
|
@@ -242,7 +241,7 @@ describe('Item Tile', () => {
|
|
|
242
241
|
const dateSortedBy = el.shadowRoot?.querySelector('.date-sorted-by');
|
|
243
242
|
expect(dateSortedBy).to.exist;
|
|
244
243
|
expect(dateSortedBy?.textContent?.trim()).to.contain(
|
|
245
|
-
'reviewed Jan 02, 2013'
|
|
244
|
+
'reviewed Jan 02, 2013',
|
|
246
245
|
);
|
|
247
246
|
});
|
|
248
247
|
|
|
@@ -349,7 +348,7 @@ describe('Item Tile', () => {
|
|
|
349
348
|
`);
|
|
350
349
|
|
|
351
350
|
const infoButton = el.shadowRoot?.querySelector(
|
|
352
|
-
'.info-button'
|
|
351
|
+
'.info-button',
|
|
353
352
|
) as HTMLButtonElement;
|
|
354
353
|
infoButton.click();
|
|
355
354
|
await el.updateComplete;
|
|
@@ -398,7 +397,7 @@ describe('Item Tile', () => {
|
|
|
398
397
|
const firstDateLink = captureDatesUl?.children[0]?.querySelector('a[href]');
|
|
399
398
|
expect(firstDateLink, 'first date link').to.exist;
|
|
400
399
|
expect(firstDateLink?.getAttribute('href')).to.equal(
|
|
401
|
-
'https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F'
|
|
400
|
+
'https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F',
|
|
402
401
|
);
|
|
403
402
|
expect(firstDateLink?.textContent?.trim()).to.equal('Jan 02, 2010');
|
|
404
403
|
|
|
@@ -406,7 +405,7 @@ describe('Item Tile', () => {
|
|
|
406
405
|
captureDatesUl?.children[1]?.querySelector('a[href]');
|
|
407
406
|
expect(secondDateLink, 'second date link').to.exist;
|
|
408
407
|
expect(secondDateLink?.getAttribute('href')).to.equal(
|
|
409
|
-
'https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F'
|
|
408
|
+
'https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F',
|
|
410
409
|
);
|
|
411
410
|
expect(secondDateLink?.textContent?.trim()).to.equal('Feb 03, 2011');
|
|
412
411
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import { html } from 'lit';
|
|
4
3
|
import type { SearchTile } from '../../../src/tiles/grid/search-tile';
|
|
@@ -38,7 +37,7 @@ describe('Search Tile', () => {
|
|
|
38
37
|
expect(itemInfo).to.exist;
|
|
39
38
|
expect(itemTitle).to.exist;
|
|
40
39
|
expect(itemTitle?.querySelector('.truncated')?.textContent).to.equal(
|
|
41
|
-
'searched query'
|
|
40
|
+
'searched query',
|
|
42
41
|
);
|
|
43
42
|
});
|
|
44
43
|
|
|
@@ -66,7 +66,7 @@ describe('Hover Pane Controller', () => {
|
|
|
66
66
|
before(() => {
|
|
67
67
|
oldMatchMedia = window.matchMedia;
|
|
68
68
|
oldOnTouchStart = window.ontouchstart;
|
|
69
|
-
window.matchMedia = () => ({ matches: true } as MediaQueryList
|
|
69
|
+
window.matchMedia = () => ({ matches: true }) as MediaQueryList;
|
|
70
70
|
window.ontouchstart = () => {};
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -77,7 +77,7 @@ describe('Hover Pane Controller', () => {
|
|
|
77
77
|
|
|
78
78
|
it('should initially provide empty template', async () => {
|
|
79
79
|
const host = await fixture<HostElement>(
|
|
80
|
-
html`<host-element></host-element
|
|
80
|
+
html`<host-element></host-element>`,
|
|
81
81
|
);
|
|
82
82
|
expect(host.controller?.getTemplate()).to.equal(nothing);
|
|
83
83
|
});
|
|
@@ -86,7 +86,7 @@ describe('Hover Pane Controller', () => {
|
|
|
86
86
|
const host = await fixture<HostElement>(
|
|
87
87
|
html`<host-element
|
|
88
88
|
.controllerOptions=${{ showDelay: 0, hideDelay: 0 }}
|
|
89
|
-
></host-element
|
|
89
|
+
></host-element>`,
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
host.dispatchEvent(new MouseEvent('mousemove'));
|
|
@@ -110,7 +110,7 @@ describe('Hover Pane Controller', () => {
|
|
|
110
110
|
const host = await fixture<HostElement>(
|
|
111
111
|
html`<host-element
|
|
112
112
|
.controllerOptions=${{ showDelay: 0, hideDelay: 0 }}
|
|
113
|
-
></host-element
|
|
113
|
+
></host-element>`,
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
host.dispatchEvent(new MouseEvent('mouseenter'));
|
|
@@ -126,7 +126,7 @@ describe('Hover Pane Controller', () => {
|
|
|
126
126
|
const host = await fixture<HostElement>(
|
|
127
127
|
html`<host-element
|
|
128
128
|
.controllerOptions=${{ showDelay: 0, hideDelay: 0 }}
|
|
129
|
-
></host-element
|
|
129
|
+
></host-element>`,
|
|
130
130
|
);
|
|
131
131
|
|
|
132
132
|
// Enter the host element and wait for the show handlers to run
|
|
@@ -155,11 +155,11 @@ describe('Hover Pane Controller', () => {
|
|
|
155
155
|
const host = await fixture<HostElement>(
|
|
156
156
|
html`<host-element
|
|
157
157
|
.controllerOptions=${{ showDelay: 0, hideDelay: 0 }}
|
|
158
|
-
></host-element
|
|
158
|
+
></host-element>`,
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
host.dispatchEvent(
|
|
162
|
-
new MouseEvent('mousemove', { clientX: 800, clientY: 600 })
|
|
162
|
+
new MouseEvent('mousemove', { clientX: 800, clientY: 600 }),
|
|
163
163
|
);
|
|
164
164
|
// Need to wait a tick for the event handlers to run
|
|
165
165
|
await new Promise(resolve => {
|
|
@@ -169,10 +169,10 @@ describe('Hover Pane Controller', () => {
|
|
|
169
169
|
|
|
170
170
|
expect(host.controller?.getTemplate()).not.to.equal(nothing);
|
|
171
171
|
expect(host.getHoverPane()?.getBoundingClientRect()?.right).to.be.lessThan(
|
|
172
|
-
window.innerWidth
|
|
172
|
+
window.innerWidth,
|
|
173
173
|
);
|
|
174
174
|
expect(host.getHoverPane()?.getBoundingClientRect()?.bottom).to.be.lessThan(
|
|
175
|
-
window.innerHeight
|
|
175
|
+
window.innerHeight,
|
|
176
176
|
);
|
|
177
177
|
});
|
|
178
178
|
|
|
@@ -181,7 +181,7 @@ describe('Hover Pane Controller', () => {
|
|
|
181
181
|
html`<host-element
|
|
182
182
|
.controllerOptions=${{ showDelay: 0, hideDelay: 0 }}
|
|
183
183
|
?suppressHoverPane=${true}
|
|
184
|
-
></host-element
|
|
184
|
+
></host-element>`,
|
|
185
185
|
);
|
|
186
186
|
|
|
187
187
|
host.dispatchEvent(new MouseEvent('mousemove'));
|
|
@@ -225,7 +225,7 @@ describe('Hover Pane Controller', () => {
|
|
|
225
225
|
longPressDelay: 0,
|
|
226
226
|
enableLongPress: true,
|
|
227
227
|
}}
|
|
228
|
-
></host-element
|
|
228
|
+
></host-element>`,
|
|
229
229
|
);
|
|
230
230
|
|
|
231
231
|
// Touch the host element and wait for the long press handlers to run
|
|
@@ -245,7 +245,7 @@ describe('Hover Pane Controller', () => {
|
|
|
245
245
|
longPressDelay: 100,
|
|
246
246
|
enableLongPress: true,
|
|
247
247
|
}}
|
|
248
|
-
></host-element
|
|
248
|
+
></host-element>`,
|
|
249
249
|
);
|
|
250
250
|
|
|
251
251
|
// Touch the host element
|
|
@@ -271,7 +271,7 @@ describe('Hover Pane Controller', () => {
|
|
|
271
271
|
longPressDelay: 100,
|
|
272
272
|
enableLongPress: true,
|
|
273
273
|
}}
|
|
274
|
-
></host-element
|
|
274
|
+
></host-element>`,
|
|
275
275
|
);
|
|
276
276
|
|
|
277
277
|
// Touch the host element
|
|
@@ -297,7 +297,7 @@ describe('Hover Pane Controller', () => {
|
|
|
297
297
|
longPressDelay: 100,
|
|
298
298
|
enableLongPress: true,
|
|
299
299
|
}}
|
|
300
|
-
></host-element
|
|
300
|
+
></host-element>`,
|
|
301
301
|
);
|
|
302
302
|
|
|
303
303
|
// Touch the host element
|
|
@@ -325,7 +325,7 @@ describe('Hover Pane Controller', () => {
|
|
|
325
325
|
enableLongPress: true,
|
|
326
326
|
mobileBreakpoint: 9999, // Ensure we get the mobile view
|
|
327
327
|
}}
|
|
328
|
-
></host-element
|
|
328
|
+
></host-element>`,
|
|
329
329
|
);
|
|
330
330
|
|
|
331
331
|
// Touch the host element
|
|
@@ -8,7 +8,7 @@ import '../../../src/tiles/hover/tile-hover-pane';
|
|
|
8
8
|
describe('Tile Hover Pane', () => {
|
|
9
9
|
it('should render initial component', async () => {
|
|
10
10
|
const el = await fixture<TileHoverPane>(
|
|
11
|
-
html`<tile-hover-pane></tile-hover-pane
|
|
11
|
+
html`<tile-hover-pane></tile-hover-pane>`,
|
|
12
12
|
);
|
|
13
13
|
|
|
14
14
|
const container = el.shadowRoot?.querySelector('#container');
|
|
@@ -25,7 +25,7 @@ describe('Tile Hover Pane', () => {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const el = await fixture<TileHoverPane>(
|
|
28
|
-
html`<tile-hover-pane .model=${model}></tile-hover-pane
|
|
28
|
+
html`<tile-hover-pane .model=${model}></tile-hover-pane>`,
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const container = el.shadowRoot?.querySelector('#container');
|
|
@@ -36,7 +36,7 @@ describe('Tile Hover Pane', () => {
|
|
|
36
36
|
expect(listView).to.exist;
|
|
37
37
|
expect(headerElement).to.exist;
|
|
38
38
|
expect(headerElement?.querySelector('a')?.getAttribute('href')).contains(
|
|
39
|
-
'/details/collection1'
|
|
39
|
+
'/details/collection1',
|
|
40
40
|
);
|
|
41
41
|
});
|
|
42
42
|
|
|
@@ -47,7 +47,7 @@ describe('Tile Hover Pane', () => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
const el = await fixture<TileHoverPane>(
|
|
50
|
-
html`<tile-hover-pane .model=${model}></tile-hover-pane
|
|
50
|
+
html`<tile-hover-pane .model=${model}></tile-hover-pane>`,
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
const container = el.shadowRoot?.querySelector('#container');
|
|
@@ -66,7 +66,7 @@ describe('Tile Hover Pane', () => {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const el = await fixture<TileHoverPane>(
|
|
69
|
-
html`<tile-hover-pane .model=${model}></tile-hover-pane
|
|
69
|
+
html`<tile-hover-pane .model=${model}></tile-hover-pane>`,
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const container = el.shadowRoot?.querySelector('#container');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import { html } from 'lit';
|
|
4
3
|
import type { TileListCompact } from '../../../src/tiles/list/tile-list-compact';
|
|
@@ -9,7 +8,7 @@ import type { TileModel } from '../../../src/models';
|
|
|
9
8
|
describe('List Tile Compact', () => {
|
|
10
9
|
it('should render initial component', async () => {
|
|
11
10
|
const el = await fixture<TileListCompact>(
|
|
12
|
-
html`<tile-list-compact></tile-list-compact
|
|
11
|
+
html`<tile-list-compact></tile-list-compact>`,
|
|
13
12
|
);
|
|
14
13
|
|
|
15
14
|
const listContainer = el.shadowRoot?.querySelector('#list-line');
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
|
2
1
|
import { expect, fixture } from '@open-wc/testing';
|
|
3
2
|
import { html } from 'lit';
|
|
4
3
|
import type { TileList } from '../../../src/tiles/list/tile-list';
|
|
@@ -9,7 +8,7 @@ import type { TileModel } from '../../../src/models';
|
|
|
9
8
|
describe('List Tile', () => {
|
|
10
9
|
it('should render initial component', async () => {
|
|
11
10
|
const el = await fixture<TileList>(
|
|
12
|
-
html`<tile-list .model=${{}}></tile-list
|
|
11
|
+
html`<tile-list .model=${{}}></tile-list>`,
|
|
13
12
|
);
|
|
14
13
|
|
|
15
14
|
const listContainer = el.shadowRoot?.querySelector('#list-line');
|
|
@@ -96,7 +95,7 @@ describe('List Tile', () => {
|
|
|
96
95
|
const collectionLinks = collectionsRow?.querySelectorAll('a[href]');
|
|
97
96
|
expect(collectionLinks?.length).to.equal(1);
|
|
98
97
|
expect(collectionLinks?.item(0).getAttribute('href')).to.equal(
|
|
99
|
-
'base/details/foo'
|
|
98
|
+
'base/details/foo',
|
|
100
99
|
);
|
|
101
100
|
});
|
|
102
101
|
|
|
@@ -115,7 +114,7 @@ describe('List Tile', () => {
|
|
|
115
114
|
const collectionLinks = collectionsRow?.querySelectorAll('a[href]');
|
|
116
115
|
expect(collectionLinks?.length).to.equal(1);
|
|
117
116
|
expect(collectionLinks?.item(0).getAttribute('href')).to.equal(
|
|
118
|
-
'base/details/bar'
|
|
117
|
+
'base/details/bar',
|
|
119
118
|
);
|
|
120
119
|
});
|
|
121
120
|
|
|
@@ -282,19 +281,19 @@ describe('List Tile', () => {
|
|
|
282
281
|
const subjectLink = el.shadowRoot?.querySelector('#topics a[href]');
|
|
283
282
|
expect(subjectLink).to.exist;
|
|
284
283
|
expect(subjectLink?.getAttribute('href')).to.equal(
|
|
285
|
-
`/search?query=${encodeURIComponent('subject:"foo"')}
|
|
284
|
+
`/search?query=${encodeURIComponent('subject:"foo"')}`,
|
|
286
285
|
);
|
|
287
286
|
|
|
288
287
|
const creatorLink = el.shadowRoot?.querySelector('#creator a[href]');
|
|
289
288
|
expect(creatorLink).to.exist;
|
|
290
289
|
expect(creatorLink?.getAttribute('href')).to.equal(
|
|
291
|
-
`/search?query=${encodeURIComponent('creator:"bar"')}
|
|
290
|
+
`/search?query=${encodeURIComponent('creator:"bar"')}`,
|
|
292
291
|
);
|
|
293
292
|
|
|
294
293
|
const sourceLink = el.shadowRoot?.querySelector('#source a[href]');
|
|
295
294
|
expect(sourceLink).to.exist;
|
|
296
295
|
expect(sourceLink?.getAttribute('href')).to.equal(
|
|
297
|
-
`/search?query=${encodeURIComponent('source:"baz"')}
|
|
296
|
+
`/search?query=${encodeURIComponent('source:"baz"')}`,
|
|
298
297
|
);
|
|
299
298
|
});
|
|
300
299
|
|
|
@@ -323,7 +322,7 @@ describe('List Tile', () => {
|
|
|
323
322
|
const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
|
|
324
323
|
expect(mediatypeLink).to.exist;
|
|
325
324
|
expect(mediatypeLink?.getAttribute('href')).to.equal(
|
|
326
|
-
`https://archive.org/details/texts
|
|
325
|
+
`https://archive.org/details/texts`,
|
|
327
326
|
);
|
|
328
327
|
});
|
|
329
328
|
|
|
@@ -356,7 +355,7 @@ describe('List Tile', () => {
|
|
|
356
355
|
const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
|
|
357
356
|
expect(mediatypeLink).to.exist;
|
|
358
357
|
expect(mediatypeLink?.getAttribute('href')).to.equal(
|
|
359
|
-
`https://archive.org/search?query=mediatype:collection&sort=-downloads
|
|
358
|
+
`https://archive.org/search?query=mediatype:collection&sort=-downloads`,
|
|
360
359
|
);
|
|
361
360
|
});
|
|
362
361
|
|
|
@@ -416,7 +415,7 @@ describe('List Tile', () => {
|
|
|
416
415
|
const firstDateLink = captureDatesUl?.children[0]?.querySelector('a[href]');
|
|
417
416
|
expect(firstDateLink, 'first date link').to.exist;
|
|
418
417
|
expect(firstDateLink?.getAttribute('href')).to.equal(
|
|
419
|
-
'https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F'
|
|
418
|
+
'https://web.archive.org/web/20100102123456/https%3A%2F%2Fexample.com%2F',
|
|
420
419
|
);
|
|
421
420
|
expect(firstDateLink?.textContent?.trim()).to.equal('Jan 02, 2010');
|
|
422
421
|
|
|
@@ -424,7 +423,7 @@ describe('List Tile', () => {
|
|
|
424
423
|
captureDatesUl?.children[1]?.querySelector('a[href]');
|
|
425
424
|
expect(secondDateLink, 'second date link').to.exist;
|
|
426
425
|
expect(secondDateLink?.getAttribute('href')).to.equal(
|
|
427
|
-
'https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F'
|
|
426
|
+
'https://web.archive.org/web/20110203124321/https%3A%2F%2Fexample.com%2F',
|
|
428
427
|
);
|
|
429
428
|
expect(secondDateLink?.textContent?.trim()).to.equal('Feb 03, 2011');
|
|
430
429
|
});
|
|
@@ -96,7 +96,7 @@ describe('Tile Dispatcher', () => {
|
|
|
96
96
|
`);
|
|
97
97
|
|
|
98
98
|
const tileLink = el.shadowRoot?.querySelector(
|
|
99
|
-
'a[href]'
|
|
99
|
+
'a[href]',
|
|
100
100
|
) as HTMLAnchorElement;
|
|
101
101
|
expect(tileLink).to.exist;
|
|
102
102
|
|
|
@@ -120,7 +120,7 @@ describe('Tile Dispatcher', () => {
|
|
|
120
120
|
`);
|
|
121
121
|
|
|
122
122
|
const manageCheck = el.shadowRoot?.querySelector(
|
|
123
|
-
'.manage-check > input[type="checkbox"]'
|
|
123
|
+
'.manage-check > input[type="checkbox"]',
|
|
124
124
|
) as HTMLButtonElement;
|
|
125
125
|
|
|
126
126
|
manageCheck.click();
|
|
@@ -138,7 +138,7 @@ describe('Tile Dispatcher', () => {
|
|
|
138
138
|
`);
|
|
139
139
|
|
|
140
140
|
expect(el.getHoverPaneProps()).to.satisfy(
|
|
141
|
-
(props: HoverPaneProperties) => props?.model?.identifier === 'foo'
|
|
141
|
+
(props: HoverPaneProperties) => props?.model?.identifier === 'foo',
|
|
142
142
|
);
|
|
143
143
|
});
|
|
144
144
|
|
|
@@ -148,7 +148,7 @@ describe('Tile Dispatcher', () => {
|
|
|
148
148
|
before(() => {
|
|
149
149
|
oldMatchMedia = window.matchMedia;
|
|
150
150
|
// Pretend that there is no hover-capable input device
|
|
151
|
-
window.matchMedia = () => ({ matches: false } as MediaQueryList
|
|
151
|
+
window.matchMedia = () => ({ matches: false }) as MediaQueryList;
|
|
152
152
|
});
|
|
153
153
|
|
|
154
154
|
after(() => {
|
|
@@ -169,7 +169,7 @@ describe('Tile Dispatcher', () => {
|
|
|
169
169
|
expect(itemTile).to.exist;
|
|
170
170
|
|
|
171
171
|
const infoButton = itemTile.shadowRoot?.querySelector(
|
|
172
|
-
'.info-button'
|
|
172
|
+
'.info-button',
|
|
173
173
|
) as HTMLButtonElement;
|
|
174
174
|
expect(infoButton).to.exist;
|
|
175
175
|
|
|
@@ -29,7 +29,7 @@ describe('formatDate', () => {
|
|
|
29
29
|
// receive from the search engine for date metadata that only specifies the year.
|
|
30
30
|
// So we must ensure these older dates still output the correct year, not the prior one.
|
|
31
31
|
expect(formatDate(new Date('1234-01-01T00:00:00Z'), 'year-only')).to.equal(
|
|
32
|
-
'1234'
|
|
32
|
+
'1234',
|
|
33
33
|
);
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -9,7 +9,7 @@ describe('localDateFromUTC', () => {
|
|
|
9
9
|
const date = new Date(1990, 1, 2, 3, 4, 5, 6);
|
|
10
10
|
const dateFromUTC = new Date(Date.UTC(1990, 1, 2, 3, 4, 5, 6));
|
|
11
11
|
expect(localDateFromUTC(date).toISOString()).to.equal(
|
|
12
|
-
dateFromUTC.toISOString()
|
|
12
|
+
dateFromUTC.toISOString(),
|
|
13
13
|
);
|
|
14
14
|
});
|
|
15
15
|
});
|