@internetarchive/collection-browser 3.4.1-alpha-webdev7761.4 → 3.4.1
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/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/src/app-root.js +28 -19
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +4 -24
- package/dist/src/collection-browser.js +125 -286
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +143 -143
- package/dist/src/collection-facets/facet-row.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 +48 -34
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +10 -6
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +21 -16
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +10 -7
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +2 -3
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +11 -9
- 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 +7 -7
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +6 -4
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +310 -309
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +1 -10
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +1 -19
- package/dist/src/data-source/collection-browser-data-source.js +65 -71
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +2 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +0 -11
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/empty-placeholder.js +18 -19
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js +10 -6
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js +2 -2
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/manage/manage-bar.js +15 -9
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js +2 -2
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/models.d.ts +6 -2
- package/dist/src/models.js +54 -46
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +2 -1
- package/dist/src/restoration-state-handler.js +19 -12
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +14 -9
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +24 -14
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js +2 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +7 -5
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +6 -3
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +33 -23
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +2 -1
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +3 -2
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +28 -21
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +4 -3
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.js +8 -5
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.js +19 -12
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +25 -17
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +55 -34
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js +2 -1
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +4 -2
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js +4 -2
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +30 -22
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js +9 -5
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/tiles/tile-mediatype-icon.js +19 -12
- package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
- package/dist/src/utils/facet-utils.js +5 -3
- package/dist/src/utils/facet-utils.js.map +1 -1
- package/dist/src/utils/format-count.js +10 -10
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/resolve-mediatype.js +3 -2
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +380 -336
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +52 -37
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js +23 -17
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +32 -22
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +22 -16
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +19 -22
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +77 -60
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +17 -11
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +14 -8
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +6 -7
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +26 -16
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +32 -23
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +33 -21
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +15 -10
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +3 -2
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +54 -14
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +18 -16
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +3 -2
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +24 -18
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +180 -178
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +15 -16
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +19 -14
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +34 -73
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +25 -25
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +19 -13
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +91 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +13 -9
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +35 -23
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +16 -12
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +48 -34
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +105 -76
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +30 -17
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/tiles/tile-mediatype-icon.test.js +24 -12
- package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +118 -120
- package/renovate.json +6 -6
- package/src/collection-browser.ts +15 -246
- package/src/collection-facets/facet-row.ts +296 -299
- package/src/collection-facets/more-facets-content.ts +8 -5
- package/src/collection-facets.ts +995 -1010
- package/src/data-source/collection-browser-data-source-interface.ts +333 -345
- package/src/data-source/collection-browser-data-source.ts +1401 -1441
- package/src/data-source/collection-browser-query-state.ts +65 -59
- package/src/data-source/models.ts +43 -56
- package/src/models.ts +870 -866
- package/src/restoration-state-handler.ts +544 -546
- package/test/collection-browser.test.ts +2403 -2413
- package/test/restoration-state-handler.test.ts +510 -480
- package/tsconfig.json +20 -25
- package/vite.config.ts +22 -29
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/dist/src/combo-box/caret-closed.d.ts +0 -2
- package/dist/src/combo-box/caret-closed.js +0 -7
- package/dist/src/combo-box/caret-closed.js.map +0 -1
- package/dist/src/combo-box/caret-open.d.ts +0 -2
- package/dist/src/combo-box/caret-open.js +0 -7
- package/dist/src/combo-box/caret-open.js.map +0 -1
- package/dist/src/combo-box/clear.d.ts +0 -2
- package/dist/src/combo-box/clear.js +0 -11
- package/dist/src/combo-box/clear.js.map +0 -1
- package/dist/src/combo-box/ia-combo-box.d.ts +0 -422
- package/dist/src/combo-box/ia-combo-box.js +0 -1203
- package/dist/src/combo-box/ia-combo-box.js.map +0 -1
- package/dist/src/combo-box/models.d.ts +0 -75
- package/dist/src/combo-box/models.js +0 -40
- package/dist/src/combo-box/models.js.map +0 -1
- package/src/combo-box/caret-closed.ts +0 -7
- package/src/combo-box/caret-open.ts +0 -7
- package/src/combo-box/clear.ts +0 -11
- package/src/combo-box/ia-combo-box.ts +0 -1288
- package/src/combo-box/models.ts +0 -113
|
@@ -3,71 +3,79 @@ import { html } from 'lit';
|
|
|
3
3
|
import '../../../src/tiles/list/tile-list';
|
|
4
4
|
describe('List Tile', () => {
|
|
5
5
|
it('should render initial component', async () => {
|
|
6
|
+
var _a, _b, _c;
|
|
6
7
|
const el = await fixture(html `<tile-list .model=${{}}></tile-list>`);
|
|
7
|
-
const listContainer = el.shadowRoot
|
|
8
|
-
const itemTitle = el.shadowRoot
|
|
9
|
-
const imageBlock = el.shadowRoot
|
|
8
|
+
const listContainer = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#list-line');
|
|
9
|
+
const itemTitle = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#title');
|
|
10
|
+
const imageBlock = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('image-block');
|
|
10
11
|
expect(listContainer).to.exist;
|
|
11
12
|
expect(itemTitle).to.exist;
|
|
12
13
|
expect(imageBlock).to.exist;
|
|
13
14
|
});
|
|
14
15
|
it('should render the mobile template if below mobile breakpoint', async () => {
|
|
16
|
+
var _a, _b, _c;
|
|
15
17
|
const el = await fixture(html `
|
|
16
18
|
<tile-list .mobileBreakpoint=${500} .currentWidth=${400}> </tile-list>
|
|
17
19
|
`);
|
|
18
|
-
const listContainer = el.shadowRoot
|
|
19
|
-
const topLine = el.shadowRoot
|
|
20
|
-
const bottomLine = el.shadowRoot
|
|
20
|
+
const listContainer = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('list-line');
|
|
21
|
+
const topLine = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById('list-line-top');
|
|
22
|
+
const bottomLine = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.getElementById('list-line-bottom');
|
|
21
23
|
expect(listContainer).to.exist;
|
|
22
|
-
expect(listContainer
|
|
24
|
+
expect(listContainer === null || listContainer === void 0 ? void 0 : listContainer.classList.contains('mobile')).to.be.true;
|
|
23
25
|
expect(topLine).to.exist;
|
|
24
26
|
expect(bottomLine).to.exist;
|
|
25
27
|
});
|
|
26
28
|
it('should render title link with model href if provided', async () => {
|
|
29
|
+
var _a;
|
|
27
30
|
const el = await fixture(html `
|
|
28
31
|
<tile-list
|
|
29
32
|
.baseNavigationUrl=${''}
|
|
30
33
|
.model=${{ title: 'foo', href: '/foo/bar' }}
|
|
31
34
|
></tile-list>
|
|
32
35
|
`);
|
|
33
|
-
const title = el.shadowRoot
|
|
36
|
+
const title = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#title > a');
|
|
34
37
|
expect(title).to.exist;
|
|
35
|
-
expect(title
|
|
38
|
+
expect(title === null || title === void 0 ? void 0 : title.getAttribute('href')).to.equal('/foo/bar');
|
|
36
39
|
});
|
|
37
40
|
it('should add title to image link if provided', async () => {
|
|
41
|
+
var _a;
|
|
38
42
|
const el = await fixture(html `
|
|
39
43
|
<tile-list
|
|
40
44
|
.baseNavigationUrl=${''}
|
|
41
45
|
.model=${{ title: 'foo', href: '/foo/bar' }}
|
|
42
46
|
></tile-list>
|
|
43
47
|
`);
|
|
44
|
-
const imageLink = el.shadowRoot
|
|
48
|
+
const imageLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#image-link');
|
|
45
49
|
expect(imageLink).to.exist;
|
|
46
|
-
expect(imageLink
|
|
50
|
+
expect(imageLink === null || imageLink === void 0 ? void 0 : imageLink.getAttribute('title')).to.equal('View foo');
|
|
47
51
|
});
|
|
48
52
|
it('should render with creator element but not dates', async () => {
|
|
53
|
+
var _a, _b;
|
|
49
54
|
const el = await fixture(html `
|
|
50
55
|
<tile-list .model=${{ creators: ['someone'] }}></tile-list>
|
|
51
56
|
`);
|
|
52
|
-
const creator = el.shadowRoot
|
|
53
|
-
const datesLine = el.shadowRoot
|
|
57
|
+
const creator = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#creator');
|
|
58
|
+
const datesLine = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#dates-line');
|
|
54
59
|
expect(creator).to.exist;
|
|
55
|
-
expect(datesLine
|
|
60
|
+
expect(datesLine === null || datesLine === void 0 ? void 0 : datesLine.children.length).to.equal(0);
|
|
56
61
|
});
|
|
57
62
|
it('should render with snippet block when it has snippets', async () => {
|
|
63
|
+
var _a;
|
|
58
64
|
const el = await fixture(html `
|
|
59
65
|
<tile-list .model=${{ snippets: ['some {{{snippet}}} text'] }}>
|
|
60
66
|
</tile-list>
|
|
61
67
|
`);
|
|
62
|
-
const snippetBlock = el.shadowRoot
|
|
68
|
+
const snippetBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('text-snippet-block');
|
|
63
69
|
expect(snippetBlock).to.exist;
|
|
64
70
|
});
|
|
65
71
|
it('should not render snippet block when no snippets are present', async () => {
|
|
72
|
+
var _a;
|
|
66
73
|
const el = await fixture(html `<tile-list></tile-list>`);
|
|
67
|
-
const snippetBlock = el.shadowRoot
|
|
74
|
+
const snippetBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('text-snippet-block');
|
|
68
75
|
expect(snippetBlock).to.not.exist;
|
|
69
76
|
});
|
|
70
77
|
it('should not render suppressed collections', async () => {
|
|
78
|
+
var _a;
|
|
71
79
|
const el = await fixture(html `
|
|
72
80
|
<tile-list
|
|
73
81
|
.model=${{ collections: ['deemphasize', 'community', 'foo'] }}
|
|
@@ -75,13 +83,14 @@ describe('List Tile', () => {
|
|
|
75
83
|
>
|
|
76
84
|
</tile-list>
|
|
77
85
|
`);
|
|
78
|
-
const collectionsRow = el.shadowRoot
|
|
86
|
+
const collectionsRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('collections');
|
|
79
87
|
expect(collectionsRow).to.exist;
|
|
80
|
-
const collectionLinks = collectionsRow
|
|
81
|
-
expect(collectionLinks
|
|
82
|
-
expect(collectionLinks
|
|
88
|
+
const collectionLinks = collectionsRow === null || collectionsRow === void 0 ? void 0 : collectionsRow.querySelectorAll('a[href]');
|
|
89
|
+
expect(collectionLinks === null || collectionLinks === void 0 ? void 0 : collectionLinks.length).to.equal(1);
|
|
90
|
+
expect(collectionLinks === null || collectionLinks === void 0 ? void 0 : collectionLinks.item(0).getAttribute('href')).to.equal('base/details/foo');
|
|
83
91
|
});
|
|
84
92
|
it('should not render fav- collections', async () => {
|
|
93
|
+
var _a;
|
|
85
94
|
const el = await fixture(html `
|
|
86
95
|
<tile-list
|
|
87
96
|
.model=${{ collections: ['fav-foo', 'bar'] }}
|
|
@@ -89,13 +98,14 @@ describe('List Tile', () => {
|
|
|
89
98
|
>
|
|
90
99
|
</tile-list>
|
|
91
100
|
`);
|
|
92
|
-
const collectionsRow = el.shadowRoot
|
|
101
|
+
const collectionsRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('collections');
|
|
93
102
|
expect(collectionsRow).to.exist;
|
|
94
|
-
const collectionLinks = collectionsRow
|
|
95
|
-
expect(collectionLinks
|
|
96
|
-
expect(collectionLinks
|
|
103
|
+
const collectionLinks = collectionsRow === null || collectionsRow === void 0 ? void 0 : collectionsRow.querySelectorAll('a[href]');
|
|
104
|
+
expect(collectionLinks === null || collectionLinks === void 0 ? void 0 : collectionLinks.length).to.equal(1);
|
|
105
|
+
expect(collectionLinks === null || collectionLinks === void 0 ? void 0 : collectionLinks.item(0).getAttribute('href')).to.equal('base/details/bar');
|
|
97
106
|
});
|
|
98
107
|
it('should render weekly views when sorting by week', async () => {
|
|
108
|
+
var _a, _b;
|
|
99
109
|
const el = await fixture(html `
|
|
100
110
|
<tile-list
|
|
101
111
|
.model=${{ viewCount: 50, weeklyViewCount: 10 }}
|
|
@@ -103,11 +113,12 @@ describe('List Tile', () => {
|
|
|
103
113
|
>
|
|
104
114
|
</tile-list>
|
|
105
115
|
`);
|
|
106
|
-
const viewsRow = el.shadowRoot
|
|
116
|
+
const viewsRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('views-line');
|
|
107
117
|
expect(viewsRow).to.exist;
|
|
108
|
-
expect(viewsRow
|
|
118
|
+
expect((_b = viewsRow === null || viewsRow === void 0 ? void 0 : viewsRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('Views: 10');
|
|
109
119
|
});
|
|
110
120
|
it('should render published date when sorting by it', async () => {
|
|
121
|
+
var _a, _b;
|
|
111
122
|
const model = {
|
|
112
123
|
dateAdded: new Date(2010, 0, 2),
|
|
113
124
|
dateArchived: new Date(2011, 0, 2),
|
|
@@ -121,11 +132,12 @@ describe('List Tile', () => {
|
|
|
121
132
|
>
|
|
122
133
|
</tile-list>
|
|
123
134
|
`);
|
|
124
|
-
const dateRow = el.shadowRoot
|
|
135
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
125
136
|
expect(dateRow).to.exist;
|
|
126
|
-
expect(dateRow
|
|
137
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Published: Jan 02, 2012');
|
|
127
138
|
});
|
|
128
139
|
it('should render added date when sorting by it', async () => {
|
|
140
|
+
var _a, _b;
|
|
129
141
|
const model = {
|
|
130
142
|
dateAdded: new Date(2010, 0, 2),
|
|
131
143
|
dateArchived: new Date(2011, 0, 2),
|
|
@@ -139,11 +151,12 @@ describe('List Tile', () => {
|
|
|
139
151
|
>
|
|
140
152
|
</tile-list>
|
|
141
153
|
`);
|
|
142
|
-
const dateRow = el.shadowRoot
|
|
154
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
143
155
|
expect(dateRow).to.exist;
|
|
144
|
-
expect(dateRow
|
|
156
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Added: Jan 02, 2010');
|
|
145
157
|
});
|
|
146
158
|
it('should render archived date when sorting by it', async () => {
|
|
159
|
+
var _a, _b;
|
|
147
160
|
const model = {
|
|
148
161
|
dateAdded: new Date(2010, 0, 2),
|
|
149
162
|
dateArchived: new Date(2011, 0, 2),
|
|
@@ -157,11 +170,12 @@ describe('List Tile', () => {
|
|
|
157
170
|
>
|
|
158
171
|
</tile-list>
|
|
159
172
|
`);
|
|
160
|
-
const dateRow = el.shadowRoot
|
|
173
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
161
174
|
expect(dateRow).to.exist;
|
|
162
|
-
expect(dateRow
|
|
175
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Archived: Jan 02, 2011');
|
|
163
176
|
});
|
|
164
177
|
it('should render reviewed date when sorting by it', async () => {
|
|
178
|
+
var _a, _b;
|
|
165
179
|
const model = {
|
|
166
180
|
dateAdded: new Date(2010, 0, 2),
|
|
167
181
|
dateArchived: new Date(2011, 0, 2),
|
|
@@ -175,11 +189,12 @@ describe('List Tile', () => {
|
|
|
175
189
|
>
|
|
176
190
|
</tile-list>
|
|
177
191
|
`);
|
|
178
|
-
const dateRow = el.shadowRoot
|
|
192
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
179
193
|
expect(dateRow).to.exist;
|
|
180
|
-
expect(dateRow
|
|
194
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Reviewed: Jan 02, 2013');
|
|
181
195
|
});
|
|
182
196
|
it('should only show the year for a date published of Jan 1 at midnight UTC', async () => {
|
|
197
|
+
var _a, _b;
|
|
183
198
|
const model = {
|
|
184
199
|
datePublished: new Date('2012-01-01T00:00:00Z'),
|
|
185
200
|
};
|
|
@@ -190,11 +205,12 @@ describe('List Tile', () => {
|
|
|
190
205
|
>
|
|
191
206
|
</tile-list>
|
|
192
207
|
`);
|
|
193
|
-
const dateRow = el.shadowRoot
|
|
208
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
194
209
|
expect(dateRow).to.exist;
|
|
195
|
-
expect(dateRow
|
|
210
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Published: 2012');
|
|
196
211
|
});
|
|
197
212
|
it('should show full date added/archived/reviewed, even on Jan 1 at midnight UTC', async () => {
|
|
213
|
+
var _a, _b, _c, _d, _e, _f;
|
|
198
214
|
const model = {
|
|
199
215
|
dateAdded: new Date(2010, 0, 1, 0, 0, 0, 0),
|
|
200
216
|
dateArchived: new Date(2011, 0, 1, 0, 0, 0, 0),
|
|
@@ -208,21 +224,22 @@ describe('List Tile', () => {
|
|
|
208
224
|
>
|
|
209
225
|
</tile-list>
|
|
210
226
|
`);
|
|
211
|
-
let dateRow = el.shadowRoot
|
|
227
|
+
let dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
212
228
|
expect(dateRow).to.exist;
|
|
213
|
-
expect(dateRow
|
|
229
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Added: Jan 01, 2010');
|
|
214
230
|
el.sortParam = { field: 'publicdate', direction: 'desc' };
|
|
215
231
|
await el.updateComplete;
|
|
216
|
-
dateRow = el.shadowRoot
|
|
232
|
+
dateRow = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.getElementById('dates-line');
|
|
217
233
|
expect(dateRow).to.exist;
|
|
218
|
-
expect(dateRow
|
|
234
|
+
expect((_d = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _d === void 0 ? void 0 : _d.trim()).to.contain('Archived: Jan 01, 2011');
|
|
219
235
|
el.sortParam = { field: 'reviewdate', direction: 'desc' };
|
|
220
236
|
await el.updateComplete;
|
|
221
|
-
dateRow = el.shadowRoot
|
|
237
|
+
dateRow = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.getElementById('dates-line');
|
|
222
238
|
expect(dateRow).to.exist;
|
|
223
|
-
expect(dateRow
|
|
239
|
+
expect((_f = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _f === void 0 ? void 0 : _f.trim()).to.contain('Reviewed: Jan 01, 2013');
|
|
224
240
|
});
|
|
225
241
|
it('should display dates in UTC time zone by default', async () => {
|
|
242
|
+
var _a, _b;
|
|
226
243
|
const model = {
|
|
227
244
|
datePublished: new Date('2012-02-15T00:00:00Z'),
|
|
228
245
|
};
|
|
@@ -233,11 +250,12 @@ describe('List Tile', () => {
|
|
|
233
250
|
>
|
|
234
251
|
</tile-list>
|
|
235
252
|
`);
|
|
236
|
-
const dateRow = el.shadowRoot
|
|
253
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
237
254
|
expect(dateRow).to.exist;
|
|
238
|
-
expect(dateRow
|
|
255
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain('Published: Feb 15, 2012');
|
|
239
256
|
});
|
|
240
257
|
it('should display dates in local time when useLocalTime option is true', async () => {
|
|
258
|
+
var _a, _b;
|
|
241
259
|
// Expected behavior depends on the time zone offset where the testing occurs
|
|
242
260
|
const offset = new Date().getTimezoneOffset();
|
|
243
261
|
let datePublished, expected;
|
|
@@ -267,11 +285,12 @@ describe('List Tile', () => {
|
|
|
267
285
|
>
|
|
268
286
|
</tile-list>
|
|
269
287
|
`);
|
|
270
|
-
const dateRow = el.shadowRoot
|
|
288
|
+
const dateRow = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('dates-line');
|
|
271
289
|
expect(dateRow).to.exist;
|
|
272
|
-
expect(dateRow
|
|
290
|
+
expect((_b = dateRow === null || dateRow === void 0 ? void 0 : dateRow.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.contain(expected);
|
|
273
291
|
});
|
|
274
292
|
it('should render links to /search pages (not search.php) for subject, creator, and source', async () => {
|
|
293
|
+
var _a, _b, _c;
|
|
275
294
|
const model = {
|
|
276
295
|
subjects: ['foo'],
|
|
277
296
|
creators: ['bar'],
|
|
@@ -280,25 +299,27 @@ describe('List Tile', () => {
|
|
|
280
299
|
const el = await fixture(html `
|
|
281
300
|
<tile-list .model=${model}></tile-list>
|
|
282
301
|
`);
|
|
283
|
-
const subjectLink = el.shadowRoot
|
|
302
|
+
const subjectLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#topics a[href]');
|
|
284
303
|
expect(subjectLink).to.exist;
|
|
285
|
-
expect(subjectLink
|
|
286
|
-
const creatorLink = el.shadowRoot
|
|
304
|
+
expect(subjectLink === null || subjectLink === void 0 ? void 0 : subjectLink.getAttribute('href')).to.equal(`/search?query=${encodeURIComponent('subject:"foo"')}`);
|
|
305
|
+
const creatorLink = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#creator a[href]');
|
|
287
306
|
expect(creatorLink).to.exist;
|
|
288
|
-
expect(creatorLink
|
|
289
|
-
const sourceLink = el.shadowRoot
|
|
307
|
+
expect(creatorLink === null || creatorLink === void 0 ? void 0 : creatorLink.getAttribute('href')).to.equal(`/search?query=${encodeURIComponent('creator:"bar"')}`);
|
|
308
|
+
const sourceLink = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('#source a[href]');
|
|
290
309
|
expect(sourceLink).to.exist;
|
|
291
|
-
expect(sourceLink
|
|
310
|
+
expect(sourceLink === null || sourceLink === void 0 ? void 0 : sourceLink.getAttribute('href')).to.equal(`/search?query=${encodeURIComponent('source:"baz"')}`);
|
|
292
311
|
});
|
|
293
312
|
it('should render multi-line descriptions with spaces b/w lines', async () => {
|
|
313
|
+
var _a, _b;
|
|
294
314
|
const el = await fixture(html `
|
|
295
315
|
<tile-list .model=${{ description: 'line1\nline2' }}> </tile-list>
|
|
296
316
|
`);
|
|
297
|
-
const descriptionBlock = el.shadowRoot
|
|
317
|
+
const descriptionBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('description');
|
|
298
318
|
expect(descriptionBlock).to.exist;
|
|
299
|
-
expect(descriptionBlock
|
|
319
|
+
expect((_b = descriptionBlock === null || descriptionBlock === void 0 ? void 0 : descriptionBlock.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('line1 line2'); // line break replaced by space
|
|
300
320
|
});
|
|
301
321
|
it('should render mediatype icon as link to corresponding mediatype collection details', async () => {
|
|
322
|
+
var _a;
|
|
302
323
|
const model = {
|
|
303
324
|
mediatype: 'texts',
|
|
304
325
|
};
|
|
@@ -308,23 +329,25 @@ describe('List Tile', () => {
|
|
|
308
329
|
.model=${model}
|
|
309
330
|
></tile-list>
|
|
310
331
|
`);
|
|
311
|
-
const mediatypeLink = el.shadowRoot
|
|
332
|
+
const mediatypeLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a#icon-right');
|
|
312
333
|
expect(mediatypeLink).to.exist;
|
|
313
|
-
expect(mediatypeLink
|
|
314
|
-
expect(mediatypeLink
|
|
334
|
+
expect(mediatypeLink === null || mediatypeLink === void 0 ? void 0 : mediatypeLink.getAttribute('href')).to.equal(`https://archive.org/details/texts`);
|
|
335
|
+
expect(mediatypeLink === null || mediatypeLink === void 0 ? void 0 : mediatypeLink.getAttribute('title')).to.equal('See more: texts');
|
|
315
336
|
});
|
|
316
337
|
it('should render mediatype icon as link even with empty baseNavigationUrl', async () => {
|
|
338
|
+
var _a;
|
|
317
339
|
const model = {
|
|
318
340
|
mediatype: 'texts',
|
|
319
341
|
};
|
|
320
342
|
const el = await fixture(html `
|
|
321
343
|
<tile-list .baseNavigationUrl=${''} .model=${model}></tile-list>
|
|
322
344
|
`);
|
|
323
|
-
const mediatypeLink = el.shadowRoot
|
|
345
|
+
const mediatypeLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a#icon-right');
|
|
324
346
|
expect(mediatypeLink).to.exist;
|
|
325
|
-
expect(mediatypeLink
|
|
347
|
+
expect(mediatypeLink === null || mediatypeLink === void 0 ? void 0 : mediatypeLink.getAttribute('href')).to.equal(`/details/texts`);
|
|
326
348
|
});
|
|
327
349
|
it('should render collection mediatype icon as link to search page', async () => {
|
|
350
|
+
var _a;
|
|
328
351
|
const model = {
|
|
329
352
|
mediatype: 'collection',
|
|
330
353
|
};
|
|
@@ -334,11 +357,12 @@ describe('List Tile', () => {
|
|
|
334
357
|
.model=${model}
|
|
335
358
|
></tile-list>
|
|
336
359
|
`);
|
|
337
|
-
const mediatypeLink = el.shadowRoot
|
|
360
|
+
const mediatypeLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a#icon-right');
|
|
338
361
|
expect(mediatypeLink).to.exist;
|
|
339
|
-
expect(mediatypeLink
|
|
362
|
+
expect(mediatypeLink === null || mediatypeLink === void 0 ? void 0 : mediatypeLink.getAttribute('href')).to.equal(`https://archive.org/search?query=mediatype:collection&sort=-downloads`);
|
|
340
363
|
});
|
|
341
364
|
it('should not render account mediatype icon as link', async () => {
|
|
365
|
+
var _a;
|
|
342
366
|
const model = {
|
|
343
367
|
mediatype: 'account',
|
|
344
368
|
};
|
|
@@ -348,11 +372,12 @@ describe('List Tile', () => {
|
|
|
348
372
|
.model=${model}
|
|
349
373
|
></tile-list>
|
|
350
374
|
`);
|
|
351
|
-
const mediatypeLink = el.shadowRoot
|
|
375
|
+
const mediatypeLink = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a#icon-right');
|
|
352
376
|
expect(mediatypeLink).to.exist;
|
|
353
|
-
expect(mediatypeLink
|
|
377
|
+
expect(mediatypeLink === null || mediatypeLink === void 0 ? void 0 : mediatypeLink.getAttribute('href')).not.to.exist;
|
|
354
378
|
});
|
|
355
379
|
it('should render date added for accounts', async () => {
|
|
380
|
+
var _a, _b;
|
|
356
381
|
const el = await fixture(html `
|
|
357
382
|
<tile-list
|
|
358
383
|
.model=${{
|
|
@@ -362,11 +387,12 @@ describe('List Tile', () => {
|
|
|
362
387
|
>
|
|
363
388
|
</tile-list>
|
|
364
389
|
`);
|
|
365
|
-
const creatorBlock = el.shadowRoot
|
|
390
|
+
const creatorBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('creator');
|
|
366
391
|
expect(creatorBlock).to.exist;
|
|
367
|
-
expect(creatorBlock
|
|
392
|
+
expect((_b = creatorBlock === null || creatorBlock === void 0 ? void 0 : creatorBlock.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('Archivist since 2015');
|
|
368
393
|
});
|
|
369
394
|
it('should render web capture date links if present', async () => {
|
|
395
|
+
var _a, _b, _c, _d, _e;
|
|
370
396
|
const captureDates = [
|
|
371
397
|
new Date('2010-01-02T12:34:56Z'),
|
|
372
398
|
new Date('2011-02-03T12:43:21Z'),
|
|
@@ -380,19 +406,20 @@ describe('List Tile', () => {
|
|
|
380
406
|
}}
|
|
381
407
|
></tile-list>
|
|
382
408
|
`);
|
|
383
|
-
const captureDatesUl = el.shadowRoot
|
|
409
|
+
const captureDatesUl = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.capture-dates');
|
|
384
410
|
expect(captureDatesUl, 'capture dates container').to.exist;
|
|
385
|
-
expect(captureDatesUl
|
|
386
|
-
const firstDateLink = captureDatesUl
|
|
411
|
+
expect(captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children.length).to.equal(2);
|
|
412
|
+
const firstDateLink = (_b = captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children[0]) === null || _b === void 0 ? void 0 : _b.querySelector('a[href]');
|
|
387
413
|
expect(firstDateLink, 'first date link').to.exist;
|
|
388
|
-
expect(firstDateLink
|
|
389
|
-
expect(firstDateLink
|
|
390
|
-
const secondDateLink = captureDatesUl
|
|
414
|
+
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');
|
|
415
|
+
expect((_c = firstDateLink === null || firstDateLink === void 0 ? void 0 : firstDateLink.textContent) === null || _c === void 0 ? void 0 : _c.trim()).to.equal('Jan 02, 2010');
|
|
416
|
+
const secondDateLink = (_d = captureDatesUl === null || captureDatesUl === void 0 ? void 0 : captureDatesUl.children[1]) === null || _d === void 0 ? void 0 : _d.querySelector('a[href]');
|
|
391
417
|
expect(secondDateLink, 'second date link').to.exist;
|
|
392
|
-
expect(secondDateLink
|
|
393
|
-
expect(secondDateLink
|
|
418
|
+
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');
|
|
419
|
+
expect((_e = secondDateLink === null || secondDateLink === void 0 ? void 0 : secondDateLink.textContent) === null || _e === void 0 ? void 0 : _e.trim()).to.equal('Feb 03, 2011');
|
|
394
420
|
});
|
|
395
421
|
it('should not render web captures if no title is present', async () => {
|
|
422
|
+
var _a;
|
|
396
423
|
const captureDates = [
|
|
397
424
|
new Date('2010-01-02T12:34:56Z'),
|
|
398
425
|
new Date('2011-02-03T12:43:21Z'),
|
|
@@ -405,10 +432,11 @@ describe('List Tile', () => {
|
|
|
405
432
|
}}
|
|
406
433
|
></tile-list>
|
|
407
434
|
`);
|
|
408
|
-
const captureDatesUl = el.shadowRoot
|
|
435
|
+
const captureDatesUl = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.capture-dates');
|
|
409
436
|
expect(captureDatesUl).not.to.exist;
|
|
410
437
|
});
|
|
411
438
|
it('should render review snippet if present', async () => {
|
|
439
|
+
var _a;
|
|
412
440
|
const review = {
|
|
413
441
|
title: 'Foo',
|
|
414
442
|
body: 'foo bar baz',
|
|
@@ -422,10 +450,11 @@ describe('List Tile', () => {
|
|
|
422
450
|
}}
|
|
423
451
|
></tile-list>
|
|
424
452
|
`);
|
|
425
|
-
const reviewBlock = el.shadowRoot
|
|
453
|
+
const reviewBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('review-block');
|
|
426
454
|
expect(reviewBlock).to.exist;
|
|
427
455
|
});
|
|
428
456
|
it('should not render review snippet block when no review is present', async () => {
|
|
457
|
+
var _a;
|
|
429
458
|
const el = await fixture(html `
|
|
430
459
|
<tile-list
|
|
431
460
|
.model=${{
|
|
@@ -433,7 +462,7 @@ describe('List Tile', () => {
|
|
|
433
462
|
}}
|
|
434
463
|
></tile-list>
|
|
435
464
|
`);
|
|
436
|
-
const reviewBlock = el.shadowRoot
|
|
465
|
+
const reviewBlock = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('review-block');
|
|
437
466
|
expect(reviewBlock).not.to.exist;
|
|
438
467
|
});
|
|
439
468
|
});
|