@internetarchive/ia-item-navigator 0.0.0-a1 → 0.0.0-a14
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -19
- package/demo/app-root.ts +101 -34
- package/demo/index.html +9 -1
- package/dist/demo/app-root.d.ts +26 -7
- package/dist/demo/app-root.js +88 -34
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/interfaces/event-interfaces.d.ts +3 -13
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +3 -2
- package/dist/src/interfaces/menu-interfaces.js.map +1 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +9 -0
- package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -41
- package/dist/src/item-inspector/item-inspector.js +253 -215
- package/dist/src/item-inspector/item-inspector.js.map +1 -1
- package/dist/src/item-inspector/visual-mod-provider.d.ts +2 -0
- package/dist/src/item-inspector/visual-mod-provider.js +3 -0
- package/dist/src/item-inspector/visual-mod-provider.js.map +1 -1
- package/dist/src/item-navigator.d.ts +36 -22
- package/dist/src/item-navigator.js +118 -108
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/loader.d.ts +5 -0
- package/dist/src/loader.js +8 -2
- package/dist/src/loader.js.map +1 -1
- package/dist/src/no-theater-available.d.ts +9 -0
- package/dist/src/no-theater-available.js +79 -0
- package/dist/src/no-theater-available.js.map +1 -0
- package/dist/test/book-nav-stub.d.ts +17 -0
- package/dist/test/book-nav-stub.js +42 -0
- package/dist/test/book-nav-stub.js.map +1 -0
- package/dist/test/ia-item-navigator.test.d.ts +2 -0
- package/dist/test/ia-item-navigator.test.js +321 -0
- package/dist/test/ia-item-navigator.test.js.map +1 -0
- package/dist/test/ia-stub-goody.d.ts +210 -0
- package/dist/test/ia-stub-goody.js +276 -0
- package/dist/test/ia-stub-goody.js.map +1 -0
- package/dist/test/ia-stub.d.ts +22 -0
- package/dist/test/ia-stub.js +35 -0
- package/dist/test/ia-stub.js.map +1 -0
- package/dist/test/no-theater-available.test.d.ts +1 -0
- package/dist/test/no-theater-available.test.js +27 -0
- package/dist/test/no-theater-available.test.js.map +1 -0
- package/package.json +4 -3
- package/src/interfaces/event-interfaces.ts +3 -14
- package/src/interfaces/menu-interfaces.ts +3 -2
- package/src/interfaces/nav-controller-interface.ts +13 -0
- package/src/item-navigator.ts +144 -122
- package/src/loader.ts +9 -2
- package/src/no-theater-available.ts +85 -0
- package/test/book-nav-stub.ts +35 -0
- package/test/ia-item-navigator.test.ts +443 -0
- package/test/ia-stub.ts +79 -0
- package/test/no-theater-available.test.ts +32 -0
- package/demo/demo-book-manifest.json +0 -1163
- package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -43
- package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -100
- package/src/item-inspector/item-inspector.ts +0 -235
- package/src/item-inspector/share-provider.ts +0 -51
- package/src/item-inspector/visual-mod-provider.ts +0 -60
- package/src/item-navigator-js.js +0 -372
- package/test/your-webcomponent.test.ts +0 -40
@@ -0,0 +1,79 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { LitElement, customElement, property, html, css, } from 'lit-element';
|
3
|
+
let IANoTheaterAvailable = class IANoTheaterAvailable extends LitElement {
|
4
|
+
constructor() {
|
5
|
+
super(...arguments);
|
6
|
+
this.identifier = '';
|
7
|
+
}
|
8
|
+
emitLoaded() {
|
9
|
+
this.dispatchEvent(new CustomEvent('loadingStateUpdated', {
|
10
|
+
detail: { loaded: true },
|
11
|
+
}));
|
12
|
+
}
|
13
|
+
updated(changed) {
|
14
|
+
if (changed.has('identifier')) {
|
15
|
+
this.emitLoaded();
|
16
|
+
}
|
17
|
+
}
|
18
|
+
get downloadUrl() {
|
19
|
+
return `/download/${this.identifier}`;
|
20
|
+
}
|
21
|
+
render() {
|
22
|
+
return html `
|
23
|
+
<section>
|
24
|
+
<h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>
|
25
|
+
<p>
|
26
|
+
This item does not appear to have any files that can be experienced on
|
27
|
+
Archive.org. <br />
|
28
|
+
Please download files in this item to interact with them on your
|
29
|
+
computer.
|
30
|
+
</p>
|
31
|
+
<a href=${this.downloadUrl}>Show all files</a>
|
32
|
+
</section>
|
33
|
+
`;
|
34
|
+
}
|
35
|
+
static get styles() {
|
36
|
+
return css `
|
37
|
+
:host {
|
38
|
+
color: var(--primaryTextColor, #fff);
|
39
|
+
text-align: center;
|
40
|
+
}
|
41
|
+
section {
|
42
|
+
margin: 10% auto 0;
|
43
|
+
padding: 0 5%;
|
44
|
+
}
|
45
|
+
p {
|
46
|
+
font-size: 1.4rem;
|
47
|
+
}
|
48
|
+
a {
|
49
|
+
color: var(--primaryTextColor, #fff);
|
50
|
+
background-color: rgb(25, 72, 128);
|
51
|
+
min-height: 35px;
|
52
|
+
outline: none;
|
53
|
+
cursor: pointer;
|
54
|
+
line-height: normal;
|
55
|
+
border-radius: 0.4rem;
|
56
|
+
text-align: center;
|
57
|
+
vertical-align: middle;
|
58
|
+
font-size: 1.4rem;
|
59
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
60
|
+
display: inline-block;
|
61
|
+
padding: 0.85rem 1.2rem;
|
62
|
+
border: 1px solid rgb(197, 209, 223);
|
63
|
+
white-space: nowrap;
|
64
|
+
appearance: auto;
|
65
|
+
box-sizing: border-box;
|
66
|
+
user-select: none;
|
67
|
+
text-decoration: none;
|
68
|
+
}
|
69
|
+
`;
|
70
|
+
}
|
71
|
+
};
|
72
|
+
__decorate([
|
73
|
+
property({ type: String })
|
74
|
+
], IANoTheaterAvailable.prototype, "identifier", void 0);
|
75
|
+
IANoTheaterAvailable = __decorate([
|
76
|
+
customElement('ia-no-theater-available')
|
77
|
+
], IANoTheaterAvailable);
|
78
|
+
export { IANoTheaterAvailable };
|
79
|
+
//# sourceMappingURL=no-theater-available.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,IAAI,EAIJ,GAAG,GACJ,MAAM,aAAa,CAAC;AAGrB,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QAC8B,eAAU,GAAY,EAAE,CAAC;IAuEvD,CAAC;IArEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCT,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC;SAxEY,oBAAoB","sourcesContent":["import {\n LitElement,\n customElement,\n property,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit-element';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n })\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n margin: 10% auto 0;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ModalManagerInterface } from '@internetarchive/modal-manager';
|
2
|
+
import { MetadataResponse } from '@internetarchive/search-service';
|
3
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
4
|
+
import { LitElement } from 'lit-element';
|
5
|
+
export declare class BookNavigator extends LitElement {
|
6
|
+
modal?: ModalManagerInterface;
|
7
|
+
baseHost?: string;
|
8
|
+
book?: MetadataResponse;
|
9
|
+
signedIn?: boolean | null;
|
10
|
+
sideMenuOpen?: boolean;
|
11
|
+
sharedObserver?: SharedResizeObserver;
|
12
|
+
addMenuShortcut(menuId: string): string;
|
13
|
+
removeMenuShortcut(menuId: string): string;
|
14
|
+
sortMenuShortcuts(): void;
|
15
|
+
emitMenuShortcutsUpdated(): void;
|
16
|
+
render(): import("lit-element").TemplateResult;
|
17
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { html, customElement, LitElement, property } from 'lit-element';
|
3
|
+
let BookNavigator = class BookNavigator extends LitElement {
|
4
|
+
constructor() {
|
5
|
+
super(...arguments);
|
6
|
+
this.signedIn = null;
|
7
|
+
}
|
8
|
+
addMenuShortcut(menuId) {
|
9
|
+
return menuId;
|
10
|
+
}
|
11
|
+
removeMenuShortcut(menuId) {
|
12
|
+
return menuId;
|
13
|
+
}
|
14
|
+
sortMenuShortcuts() { }
|
15
|
+
emitMenuShortcutsUpdated() { }
|
16
|
+
render() {
|
17
|
+
return html ` <p>foo</p> `;
|
18
|
+
}
|
19
|
+
};
|
20
|
+
__decorate([
|
21
|
+
property({ attribute: false })
|
22
|
+
], BookNavigator.prototype, "modal", void 0);
|
23
|
+
__decorate([
|
24
|
+
property({ type: String })
|
25
|
+
], BookNavigator.prototype, "baseHost", void 0);
|
26
|
+
__decorate([
|
27
|
+
property({ type: Object })
|
28
|
+
], BookNavigator.prototype, "book", void 0);
|
29
|
+
__decorate([
|
30
|
+
property({ type: Boolean, reflect: true })
|
31
|
+
], BookNavigator.prototype, "signedIn", void 0);
|
32
|
+
__decorate([
|
33
|
+
property({ type: Boolean })
|
34
|
+
], BookNavigator.prototype, "sideMenuOpen", void 0);
|
35
|
+
__decorate([
|
36
|
+
property({ attribute: false })
|
37
|
+
], BookNavigator.prototype, "sharedObserver", void 0);
|
38
|
+
BookNavigator = __decorate([
|
39
|
+
customElement('book-navigator')
|
40
|
+
], BookNavigator);
|
41
|
+
export { BookNavigator };
|
42
|
+
//# sourceMappingURL=book-nav-stub.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"book-nav-stub.js","sourceRoot":"","sources":["../../test/book-nav-stub.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGxE,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,UAAU;IAA7C;;QAO8C,aAAQ,GAAoB,IAAI,CAAC;IAqB/E,CAAC;IAfC,eAAe,CAAC,MAAc;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iBAAiB,KAAI,CAAC;IAEtB,wBAAwB,KAAI,CAAC;IAE7B,MAAM;QACJ,OAAO,IAAI,CAAA,cAAc,CAAC;IAC5B,CAAC;CACF,CAAA;AA3BiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAA+B;AAElC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAyB;AAER;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkC;AAEhD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAwB;AAEpB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAX3D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA4BzB;SA5BY,aAAa","sourcesContent":["import { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { html, customElement, LitElement, property } from 'lit-element';\n\n@customElement('book-navigator')\nexport class BookNavigator extends LitElement {\n @property({ attribute: false }) modal?: ModalManagerInterface;\n\n @property({ type: String }) baseHost?: string;\n\n @property({ type: Object }) book?: MetadataResponse;\n\n @property({ type: Boolean, reflect: true }) signedIn?: boolean | null = null;\n\n @property({ type: Boolean }) sideMenuOpen?: boolean;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n addMenuShortcut(menuId: string) {\n return menuId;\n }\n\n removeMenuShortcut(menuId: string) {\n return menuId;\n }\n\n sortMenuShortcuts() {}\n\n emitMenuShortcutsUpdated() {}\n\n render() {\n return html` <p>foo</p> `;\n }\n}\n"]}
|
@@ -0,0 +1,321 @@
|
|
1
|
+
/* eslint-disable camelcase */
|
2
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
3
|
+
import Sinon from 'sinon';
|
4
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
5
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
6
|
+
import { ItemType } from '../src/item-navigator';
|
7
|
+
import '../src/item-navigator';
|
8
|
+
import '../test/book-nav-stub';
|
9
|
+
import { ItemStub, menuProvider, shortcut } from '../test/ia-stub';
|
10
|
+
afterEach(() => {
|
11
|
+
Sinon.restore();
|
12
|
+
});
|
13
|
+
describe('ItemNavigator', () => {
|
14
|
+
describe('Theaters', () => {
|
15
|
+
it('shows <ia-no-theater-available> by default', async () => {
|
16
|
+
var _a;
|
17
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
18
|
+
expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-no-theater-available')).to.exist;
|
19
|
+
});
|
20
|
+
it('shows <book-navigator> if `this.itemType = "bookreader"`', async () => {
|
21
|
+
var _a;
|
22
|
+
const el = await fixture(html `<ia-item-navigator
|
23
|
+
.itemType=${ItemType.BOOK}
|
24
|
+
.item=${new ItemStub()}
|
25
|
+
.modal=${new ModalManager()}
|
26
|
+
.sharedObserver=${new SharedResizeObserver()}
|
27
|
+
></ia-item-navigator>`);
|
28
|
+
await el.updateComplete;
|
29
|
+
el.toggleMenu();
|
30
|
+
await el.updateComplete;
|
31
|
+
const bookNavigator = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('book-navigator');
|
32
|
+
await bookNavigator.updateComplete;
|
33
|
+
console.log('132234234324324324');
|
34
|
+
// TODO: add BookNavigator type & import via @internetarchive/bookreader
|
35
|
+
// For now, let's check that the BookNavigator element and its properties exist w/ stub
|
36
|
+
expect(bookNavigator).to.exist;
|
37
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.modal).to.exist;
|
38
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.baseHost).to.exist;
|
39
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.book).to.exist;
|
40
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.signedIn).to.be.null;
|
41
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sharedObserver).to.exist;
|
42
|
+
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sideMenuOpen).to.exist;
|
43
|
+
});
|
44
|
+
});
|
45
|
+
describe('`el.loaded`', () => {
|
46
|
+
it('toggles the spinning loader', async () => {
|
47
|
+
var _a;
|
48
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
49
|
+
expect(el.loaded).to.be.null; // initial load
|
50
|
+
expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-itemnav-loader')).to.exist;
|
51
|
+
});
|
52
|
+
it('hides reader section if `!loaded`', async () => {
|
53
|
+
var _a, _b;
|
54
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
55
|
+
expect((_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hide');
|
56
|
+
});
|
57
|
+
it('shows reader when `loaded` ', async () => {
|
58
|
+
var _a, _b;
|
59
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
60
|
+
const mainTheaterSection = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader');
|
61
|
+
expect(mainTheaterSection === null || mainTheaterSection === void 0 ? void 0 : mainTheaterSection.classList.contains('hide')).to.be.false;
|
62
|
+
expect(el.loaded).to.be.true;
|
63
|
+
// `loaded` property is reflected as DOM attribute
|
64
|
+
expect(el.hasAttribute('loaded')).to.equal(true);
|
65
|
+
expect((_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('ia-no-theater-available')).to.exist;
|
66
|
+
});
|
67
|
+
it('listens to `@loadingStateUpdated` to update `loaded`', async () => {
|
68
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
69
|
+
await el.updateComplete;
|
70
|
+
const spy = Sinon.spy();
|
71
|
+
el.loadingStateUpdated = spy;
|
72
|
+
el.loaded = null;
|
73
|
+
await el.updateComplete;
|
74
|
+
// check base properties
|
75
|
+
expect(el.loaded).to.equal(null);
|
76
|
+
expect(el.item).to.be.undefined;
|
77
|
+
// hydrate item
|
78
|
+
el.item = new ItemStub();
|
79
|
+
await el.updateComplete;
|
80
|
+
// spy fires
|
81
|
+
expect(spy.called).to.equal(true);
|
82
|
+
expect(spy.callCount).to.equal(1);
|
83
|
+
});
|
84
|
+
});
|
85
|
+
describe('`el.sharedObserver`', () => {
|
86
|
+
it('uses one', async () => {
|
87
|
+
const sharedObserver = new SharedResizeObserver();
|
88
|
+
const el = await fixture(html `<ia-item-navigator
|
89
|
+
.sharedObserver=${sharedObserver}
|
90
|
+
></ia-item-navigator>`);
|
91
|
+
expect(el.sharedObserver).to.equal(sharedObserver);
|
92
|
+
expect(typeof el.handleResize).to.equal('function');
|
93
|
+
});
|
94
|
+
it('freshly registers handler', async () => {
|
95
|
+
const sharedObserver = new SharedResizeObserver();
|
96
|
+
const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');
|
97
|
+
const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');
|
98
|
+
await fixture(html `<ia-item-navigator
|
99
|
+
.sharedObserver=${sharedObserver}
|
100
|
+
></ia-item-navigator>`);
|
101
|
+
// always calls to remove first, for posterity
|
102
|
+
expect(removeObserverSpy.callCount).to.equal(1);
|
103
|
+
expect(addObserverSpy.callCount).to.equal(1);
|
104
|
+
});
|
105
|
+
it('removes handler when component disconnects', async () => {
|
106
|
+
const sharedObserver = new SharedResizeObserver();
|
107
|
+
const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');
|
108
|
+
const el = await fixture(html `<ia-item-navigator
|
109
|
+
.sharedObserver=${sharedObserver}
|
110
|
+
></ia-item-navigator>`);
|
111
|
+
// called during setup `setResizeObserver`
|
112
|
+
expect(removeObserverSpy.callCount).to.equal(1);
|
113
|
+
el.disconnectedCallback();
|
114
|
+
await el.updateComplete;
|
115
|
+
expect(removeObserverSpy.callCount).to.equal(2);
|
116
|
+
});
|
117
|
+
it('sets menu to overlay if container width is <= 600px', async () => {
|
118
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
119
|
+
expect(el.openMenuState).to.equal('shift'); // as starting point
|
120
|
+
const overlaySize = {
|
121
|
+
contentRect: { width: 600 },
|
122
|
+
};
|
123
|
+
el.handleResize(overlaySize);
|
124
|
+
await el.updateComplete;
|
125
|
+
expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay
|
126
|
+
const shiftSize = {
|
127
|
+
contentRect: { width: 601 },
|
128
|
+
};
|
129
|
+
el.handleResize(shiftSize);
|
130
|
+
await el.updateComplete;
|
131
|
+
expect(el.openMenuState).to.equal('shift');
|
132
|
+
});
|
133
|
+
});
|
134
|
+
describe('`el.modal`', () => {
|
135
|
+
it('uses one', async () => {
|
136
|
+
const modal = new ModalManager();
|
137
|
+
const el = await fixture(html `<ia-item-navigator .modal=${modal}></ia-item-navigator>`);
|
138
|
+
expect(el.modal).to.equal(modal);
|
139
|
+
});
|
140
|
+
});
|
141
|
+
describe('full browser window immersion "fullscreen"', () => {
|
142
|
+
it('creates reflected attribute `viewportinfullscreen`', async () => {
|
143
|
+
/** to help with external styling adjustmnents */
|
144
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
145
|
+
expect(el.getAttribute('viewportinfullscreen')).to.be.null;
|
146
|
+
el.viewportInFullscreen = true;
|
147
|
+
await el.updateComplete;
|
148
|
+
expect(el.getAttribute('viewportinfullscreen')).to.exist;
|
149
|
+
});
|
150
|
+
it('@ViewportInFullScreen', async () => {
|
151
|
+
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
152
|
+
expect(el.viewportInFullscreen).to.be.null;
|
153
|
+
const yesFullscreenEvent = {
|
154
|
+
detail: {
|
155
|
+
isFullScreen: true,
|
156
|
+
},
|
157
|
+
};
|
158
|
+
el.manageViewportFullscreen(yesFullscreenEvent);
|
159
|
+
await el.updateComplete;
|
160
|
+
expect(el.viewportInFullscreen).to.be.true;
|
161
|
+
const noFullscreenEvent = {
|
162
|
+
detail: {
|
163
|
+
isFullScreen: false,
|
164
|
+
},
|
165
|
+
};
|
166
|
+
el.manageViewportFullscreen(noFullscreenEvent);
|
167
|
+
await el.updateComplete;
|
168
|
+
expect(el.viewportInFullscreen).to.be.null;
|
169
|
+
});
|
170
|
+
});
|
171
|
+
/* Side menu & shortcuts tests */
|
172
|
+
describe('el.menuOpened', () => {
|
173
|
+
it('toggles side menu open', async () => {
|
174
|
+
var _a, _b, _c;
|
175
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
176
|
+
el.menuContents = [menuProvider];
|
177
|
+
await el.updateComplete;
|
178
|
+
const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
|
179
|
+
expect(nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')).to.exist;
|
180
|
+
// side menu starts closed
|
181
|
+
expect(el.menuOpened).to.be.false;
|
182
|
+
expect((_b = nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hidden');
|
183
|
+
// let's open menu
|
184
|
+
el.toggleMenu();
|
185
|
+
await el.updateComplete;
|
186
|
+
expect(el.menuOpened).to.be.true;
|
187
|
+
expect((_c = nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')) === null || _c === void 0 ? void 0 : _c.getAttribute('class')).to.not.contain('hidden');
|
188
|
+
});
|
189
|
+
it('opens menu shortcut with `@manageSideMenuEvents`', async () => {
|
190
|
+
var _a;
|
191
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
192
|
+
const detail = {
|
193
|
+
menuId: 'fullscreen',
|
194
|
+
action: 'open',
|
195
|
+
};
|
196
|
+
el.menuContents = [menuProvider];
|
197
|
+
await el.updateComplete;
|
198
|
+
const frame = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#frame');
|
199
|
+
// default menu open behavior is to side menu open, not overlay
|
200
|
+
expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.contain('shift');
|
201
|
+
expect(el.menuOpened).to.be.false;
|
202
|
+
expect(el.openMenu).to.be.empty;
|
203
|
+
expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.not.contain('open');
|
204
|
+
const event = new CustomEvent('updateSideMenu', {
|
205
|
+
detail,
|
206
|
+
});
|
207
|
+
el.manageSideMenuEvents(event);
|
208
|
+
await el.updateComplete;
|
209
|
+
expect(el.shouldRenderMenu).to.be.true;
|
210
|
+
expect(el.menuOpened).to.be.true;
|
211
|
+
expect(el.openMenu).to.equal(detail.menuId);
|
212
|
+
expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.contain('open');
|
213
|
+
// no menu provided
|
214
|
+
const openShortcutSpy = Sinon.spy(el, 'openShortcut');
|
215
|
+
const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');
|
216
|
+
const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {
|
217
|
+
detail: {},
|
218
|
+
});
|
219
|
+
el.manageSideMenuEvents(noMenuProvidedEvent);
|
220
|
+
await el.updateComplete;
|
221
|
+
expect(openShortcutSpy.called).to.be.false;
|
222
|
+
expect(toggleMenuSpy.called).to.be.false;
|
223
|
+
// toggle menu
|
224
|
+
const toggleMenuEvent = new CustomEvent('updateSideMenu', {
|
225
|
+
detail: { action: 'toggle', menuId: 'fullscreen' },
|
226
|
+
});
|
227
|
+
el.manageSideMenuEvents(toggleMenuEvent);
|
228
|
+
await el.updateComplete;
|
229
|
+
expect(toggleMenuSpy.callCount).to.equal(1);
|
230
|
+
// open menu
|
231
|
+
const openMenuEvent = new CustomEvent('updateSideMenu', {
|
232
|
+
detail: { action: 'open', menuId: 'fullscreen' },
|
233
|
+
});
|
234
|
+
el.manageSideMenuEvents(openMenuEvent);
|
235
|
+
await el.updateComplete;
|
236
|
+
expect(openShortcutSpy.callCount).to.equal(1);
|
237
|
+
});
|
238
|
+
});
|
239
|
+
describe('el.menuContents', () => {
|
240
|
+
it('draws side menu when populated', async () => {
|
241
|
+
var _a;
|
242
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
243
|
+
el.menuContents = [menuProvider];
|
244
|
+
await el.updateComplete;
|
245
|
+
expect(el.menuContents.length).to.exist;
|
246
|
+
expect(el.shouldRenderMenu).to.be.true;
|
247
|
+
const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
|
248
|
+
expect(nav).to.exist;
|
249
|
+
const menuSlider = nav === null || nav === void 0 ? void 0 : nav.querySelector('ia-menu-slider');
|
250
|
+
expect(menuSlider).to.exist;
|
251
|
+
expect(menuSlider === null || menuSlider === void 0 ? void 0 : menuSlider.getAttribute('manuallyhandleclose')).to.exist;
|
252
|
+
expect(menuSlider === null || menuSlider === void 0 ? void 0 : menuSlider.getAttribute('open')).to.exist;
|
253
|
+
});
|
254
|
+
});
|
255
|
+
describe('`el.menuShortcuts`', () => {
|
256
|
+
it('displays shortcut & toggle side menu button', async () => {
|
257
|
+
var _a;
|
258
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
259
|
+
const anotherShortcut = {
|
260
|
+
id: 'foo',
|
261
|
+
icon: html `<i class="foo-shortcut"></i>`,
|
262
|
+
};
|
263
|
+
el.menuContents = [menuProvider];
|
264
|
+
el.menuShortcuts = [shortcut, anotherShortcut];
|
265
|
+
await el.updateComplete;
|
266
|
+
const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
|
267
|
+
const shortcutsContainer = nav === null || nav === void 0 ? void 0 : nav.querySelector('.shortcuts');
|
268
|
+
expect(el.menuShortcuts.length).to.exist;
|
269
|
+
expect(nav).to.exist;
|
270
|
+
expect(shortcutsContainer).to.exist;
|
271
|
+
expect(shortcutsContainer === null || shortcutsContainer === void 0 ? void 0 : shortcutsContainer.querySelector('i.fullscreen-test')).to.exist;
|
272
|
+
expect(shortcutsContainer === null || shortcutsContainer === void 0 ? void 0 : shortcutsContainer.querySelector('button.shortcut.foo')).to.exist;
|
273
|
+
expect(nav === null || nav === void 0 ? void 0 : nav.querySelector('.toggle-menu')).to.exist;
|
274
|
+
});
|
275
|
+
});
|
276
|
+
describe('Menu events', () => {
|
277
|
+
it('`el.setMenuShortcuts`', async () => {
|
278
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
279
|
+
expect(el.menuShortcuts.length).to.equal(0);
|
280
|
+
const menuShortcuts = [shortcut];
|
281
|
+
el.setMenuShortcuts({
|
282
|
+
detail: menuShortcuts,
|
283
|
+
});
|
284
|
+
await el.updateComplete;
|
285
|
+
expect(el.menuShortcuts.length).to.equal(1);
|
286
|
+
});
|
287
|
+
it('`el.setMenuContents`', async () => {
|
288
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
289
|
+
expect(el.menuContents.length).to.equal(0);
|
290
|
+
el.setMenuShortcuts({
|
291
|
+
detail: [menuProvider],
|
292
|
+
});
|
293
|
+
await el.updateComplete;
|
294
|
+
expect(el.menuShortcuts.length).to.equal(1);
|
295
|
+
});
|
296
|
+
it('`el.setOpenMenu`', async () => {
|
297
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
298
|
+
el.setOpenMenu({
|
299
|
+
detail: { id: 'foo' },
|
300
|
+
});
|
301
|
+
await el.updateComplete;
|
302
|
+
expect(el.openMenu).to.equal('foo');
|
303
|
+
// toggles it off
|
304
|
+
el.setOpenMenu({
|
305
|
+
detail: { id: 'foo' },
|
306
|
+
});
|
307
|
+
await el.updateComplete;
|
308
|
+
expect(el.openMenu).to.equal('');
|
309
|
+
});
|
310
|
+
it('`el.closeMenu`', async () => {
|
311
|
+
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|
312
|
+
el.menuOpened = true;
|
313
|
+
await el.updateComplete;
|
314
|
+
expect(el.menuOpened).to.be.true;
|
315
|
+
el.closeMenu();
|
316
|
+
await el.updateComplete;
|
317
|
+
expect(el.menuOpened).to.be.false;
|
318
|
+
});
|
319
|
+
});
|
320
|
+
});
|
321
|
+
//# sourceMappingURL=ia-item-navigator.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ia-item-navigator.test.js","sourceRoot":"","sources":["../../test/ia-item-navigator.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAiB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,uBAAuB,CAAC;AAE/B,OAAO,uBAAuB,CAAC;AAC/B,O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AE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC9B,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,4BAA4B,IAAI,QAAQ,EAAE,uBAAuB,CACtE,CAAC;YAEF,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC;YACrB,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAEjC,EAAE,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable camelcase */\nimport { html, fixture, expect } from '@open-wc/testing';\nimport Sinon from 'sinon';\n\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { BookNavigator } from '../src/interfaces/nav-controller-interface';\nimport { ItemNavigator, ItemType } from '../src/item-navigator';\nimport '../src/item-navigator';\n\nimport '../test/book-nav-stub';\nimport { ItemStub, menuProvider, shortcut } from '../test/ia-stub';\nimport {\n IntManageFullscreenEvent,\n IntManageSideMenuEvent,\n IntSetMenuContentsEvent,\n IntSetMenuShortcutsEvent,\n IntSetOpenMenuEvent,\n} from '../src/interfaces/event-interfaces';\n\nafterEach(() => {\n Sinon.restore();\n});\n\ndescribe('ItemNavigator', () => {\n describe('Theaters', () => {\n it('shows <ia-no-theater-available> by default', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n\n it('shows <book-navigator> if `this.itemType = \"bookreader\"`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .itemType=${ItemType.BOOK}\n .item=${new ItemStub()}\n .modal=${new ModalManager()}\n .sharedObserver=${new SharedResizeObserver()}\n ></ia-item-navigator>`\n );\n\n await el.updateComplete;\n\n el.toggleMenu();\n await el.updateComplete;\n\n const bookNavigator = el.shadowRoot?.querySelector(\n 'book-navigator'\n ) as BookNavigator;\n await bookNavigator.updateComplete;\n\n console.log('132234234324324324');\n // TODO: add BookNavigator type & import via @internetarchive/bookreader\n // For now, let's check that the BookNavigator element and its properties exist w/ stub\n expect(bookNavigator).to.exist;\n expect(bookNavigator?.modal).to.exist;\n expect(bookNavigator?.baseHost).to.exist;\n expect(bookNavigator?.book).to.exist;\n expect(bookNavigator?.signedIn).to.be.null;\n expect(bookNavigator?.sharedObserver).to.exist;\n expect(bookNavigator?.sideMenuOpen).to.exist;\n });\n });\n describe('`el.loaded`', () => {\n it('toggles the spinning loader', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.loaded).to.be.null; // initial load\n expect(el.shadowRoot?.querySelector('ia-itemnav-loader')).to.exist;\n });\n it('hides reader section if `!loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(\n el.shadowRoot?.querySelector('#reader')?.getAttribute('class')\n ).to.contain('hide');\n });\n it('shows reader when `loaded` ', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const mainTheaterSection = el.shadowRoot?.querySelector('#reader');\n expect(mainTheaterSection?.classList.contains('hide')).to.be.false;\n expect(el.loaded).to.be.true;\n // `loaded` property is reflected as DOM attribute\n expect(el.hasAttribute('loaded')).to.equal(true);\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n it('listens to `@loadingStateUpdated` to update `loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n await el.updateComplete;\n const spy = Sinon.spy();\n el.loadingStateUpdated = spy;\n el.loaded = null;\n await el.updateComplete;\n // check base properties\n expect(el.loaded).to.equal(null);\n expect(el.item).to.be.undefined;\n\n // hydrate item\n el.item = new ItemStub();\n await el.updateComplete;\n\n // spy fires\n expect(spy.called).to.equal(true);\n expect(spy.callCount).to.equal(1);\n });\n });\n\n describe('`el.sharedObserver`', () => {\n it('uses one', async () => {\n const sharedObserver = new SharedResizeObserver();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(el.sharedObserver).to.equal(sharedObserver);\n expect(typeof el.handleResize).to.equal('function');\n });\n it('freshly registers handler', async () => {\n const sharedObserver = new SharedResizeObserver();\n const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');\n const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');\n\n await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n // always calls to remove first, for posterity\n expect(removeObserverSpy.callCount).to.equal(1);\n expect(addObserverSpy.callCount).to.equal(1);\n });\n it('removes handler when component disconnects', async () => {\n const sharedObserver = new SharedResizeObserver();\n const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');\n\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n // called during setup `setResizeObserver`\n expect(removeObserverSpy.callCount).to.equal(1);\n\n el.disconnectedCallback();\n await el.updateComplete;\n\n expect(removeObserverSpy.callCount).to.equal(2);\n });\n it('sets menu to overlay if container width is <= 600px', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(el.openMenuState).to.equal('shift'); // as starting point\n\n const overlaySize = {\n contentRect: { width: 600 },\n } as ResizeObserverEntry;\n el.handleResize(overlaySize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay\n\n const shiftSize = {\n contentRect: { width: 601 },\n } as ResizeObserverEntry;\n el.handleResize(shiftSize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('shift');\n });\n });\n\n describe('`el.modal`', () => {\n it('uses one', async () => {\n const modal = new ModalManager();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .modal=${modal}></ia-item-navigator>`\n );\n expect(el.modal).to.equal(modal);\n });\n });\n\n describe('full browser window immersion \"fullscreen\"', () => {\n it('creates reflected attribute `viewportinfullscreen`', async () => {\n /** to help with external styling adjustmnents */\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.getAttribute('viewportinfullscreen')).to.be.null;\n\n el.viewportInFullscreen = true;\n await el.updateComplete;\n\n expect(el.getAttribute('viewportinfullscreen')).to.exist;\n });\n it('@ViewportInFullScreen', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.viewportInFullscreen).to.be.null;\n\n const yesFullscreenEvent = {\n detail: {\n isFullScreen: true,\n },\n } as IntManageFullscreenEvent;\n el.manageViewportFullscreen(yesFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.true;\n\n const noFullscreenEvent = {\n detail: {\n isFullScreen: false,\n },\n } as IntManageFullscreenEvent;\n el.manageViewportFullscreen(noFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.null;\n });\n });\n\n /* Side menu & shortcuts tests */\n describe('el.menuOpened', () => {\n it('toggles side menu open', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n expect(nav?.querySelector('#menu')).to.exist;\n // side menu starts closed\n expect(el.menuOpened).to.be.false;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.contain(\n 'hidden'\n );\n\n // let's open menu\n el.toggleMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.not.contain(\n 'hidden'\n );\n });\n\n it('opens menu shortcut with `@manageSideMenuEvents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n const detail = {\n menuId: 'fullscreen',\n action: 'open',\n };\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n const frame = el.shadowRoot?.querySelector('#frame');\n // default menu open behavior is to side menu open, not overlay\n expect(frame?.getAttribute('class')).to.contain('shift');\n\n expect(el.menuOpened).to.be.false;\n expect(el.openMenu).to.be.empty;\n expect(frame?.getAttribute('class')).to.not.contain('open');\n\n const event = new CustomEvent('updateSideMenu', {\n detail,\n }) as IntManageSideMenuEvent;\n el.manageSideMenuEvents(event);\n await el.updateComplete;\n\n expect(el.shouldRenderMenu).to.be.true;\n expect(el.menuOpened).to.be.true;\n expect(el.openMenu).to.equal(detail.menuId);\n\n expect(frame?.getAttribute('class')).to.contain('open');\n\n // no menu provided\n const openShortcutSpy = Sinon.spy(el, 'openShortcut');\n const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');\n\n const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {\n detail: {},\n }) as any;\n el.manageSideMenuEvents(noMenuProvidedEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.called).to.be.false;\n expect(toggleMenuSpy.called).to.be.false;\n\n // toggle menu\n const toggleMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'toggle', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(toggleMenuEvent);\n await el.updateComplete;\n\n expect(toggleMenuSpy.callCount).to.equal(1);\n\n // open menu\n const openMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'open', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(openMenuEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.callCount).to.equal(1);\n });\n });\n\n describe('el.menuContents', () => {\n it('draws side menu when populated', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n expect(el.menuContents.length).to.exist;\n expect(el.shouldRenderMenu).to.be.true;\n\n const nav = el.shadowRoot?.querySelector('nav');\n expect(nav).to.exist;\n\n const menuSlider = nav?.querySelector('ia-menu-slider');\n expect(menuSlider).to.exist;\n expect(menuSlider?.getAttribute('manuallyhandleclose')).to.exist;\n expect(menuSlider?.getAttribute('open')).to.exist;\n });\n });\n\n describe('`el.menuShortcuts`', () => {\n it('displays shortcut & toggle side menu button', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const anotherShortcut = {\n id: 'foo',\n icon: html`<i class=\"foo-shortcut\"></i>`,\n };\n el.menuContents = [menuProvider];\n el.menuShortcuts = [shortcut, anotherShortcut];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n const shortcutsContainer = nav?.querySelector('.shortcuts');\n expect(el.menuShortcuts.length).to.exist;\n expect(nav).to.exist;\n expect(shortcutsContainer).to.exist;\n expect(shortcutsContainer?.querySelector('i.fullscreen-test')).to.exist;\n expect(shortcutsContainer?.querySelector('button.shortcut.foo')).to.exist;\n expect(nav?.querySelector('.toggle-menu')).to.exist;\n });\n });\n\n describe('Menu events', () => {\n it('`el.setMenuShortcuts`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuShortcuts.length).to.equal(0);\n\n const menuShortcuts = [shortcut];\n\n el.setMenuShortcuts({\n detail: menuShortcuts,\n } as IntSetMenuShortcutsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setMenuContents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuContents.length).to.equal(0);\n\n el.setMenuShortcuts({\n detail: [menuProvider],\n } as IntSetMenuContentsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setOpenMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as IntSetOpenMenuEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.equal('foo');\n\n // toggles it off\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as IntSetOpenMenuEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.equal('');\n });\n it('`el.closeMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuOpened = true;\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n\n el.closeMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.false;\n });\n });\n});\n"]}
|