@internetarchive/ia-topnav 1.3.6 → 1.3.7
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/.eslintrc +16 -16
- package/LICENSE +661 -661
- package/README.md +147 -147
- package/index.d.ts +109 -109
- package/index.js +3 -3
- package/package.json +61 -61
- package/src/assets/img/hamburger.js +38 -38
- package/src/assets/img/ia-icon.js +33 -33
- package/src/assets/img/icon-audio.js +23 -23
- package/src/assets/img/icon-close.js +16 -16
- package/src/assets/img/icon-donate-unpadded.js +16 -16
- package/src/assets/img/icon-donate.js +15 -15
- package/src/assets/img/icon-ellipses.js +15 -15
- package/src/assets/img/icon-ia-logo.js +22 -22
- package/src/assets/img/icon-images.js +15 -15
- package/src/assets/img/icon-search.js +15 -15
- package/src/assets/img/icon-software.js +15 -15
- package/src/assets/img/icon-texts.js +15 -15
- package/src/assets/img/icon-upload-unpadded.js +14 -14
- package/src/assets/img/icon-upload.js +15 -15
- package/src/assets/img/icon-user.js +15 -15
- package/src/assets/img/icon-video.js +15 -15
- package/src/assets/img/icon-web.js +15 -15
- package/src/assets/img/icon.js +18 -18
- package/src/assets/img/icons.js +33 -33
- package/src/assets/img/wordmark-stacked.js +13 -13
- package/src/data/menus.js +646 -646
- package/src/desktop-subnav.js +45 -45
- package/src/dropdown-menu.js +110 -109
- package/src/ia-topnav.js +324 -314
- package/src/lib/formatUrl.js +1 -1
- package/src/lib/keyboard-navigation.js +128 -0
- package/src/lib/location-handler.js +5 -5
- package/src/lib/query-handler.js +7 -7
- package/src/lib/toSentenceCase.js +8 -8
- package/src/login-button.js +79 -79
- package/src/media-button.js +113 -113
- package/src/media-menu.js +154 -133
- package/src/media-slider.js +118 -104
- package/src/media-subnav.js +112 -112
- package/src/more-slider.js +33 -33
- package/src/nav-search.js +111 -117
- package/src/primary-nav.js +258 -224
- package/src/save-page-form.js +59 -59
- package/src/search-menu.js +145 -115
- package/src/signed-out-dropdown.js +10 -10
- package/src/styles/base.js +48 -48
- package/src/styles/desktop-subnav.js +37 -37
- package/src/styles/dropdown-menu.js +168 -166
- package/src/styles/ia-topnav.js +87 -87
- package/src/styles/login-button.js +82 -79
- package/src/styles/media-button.js +156 -156
- package/src/styles/media-menu.js +66 -70
- package/src/styles/media-slider.js +81 -81
- package/src/styles/media-subnav.js +156 -156
- package/src/styles/more-slider.js +15 -15
- package/src/styles/nav-search.js +136 -136
- package/src/styles/primary-nav.js +311 -300
- package/src/styles/save-page-form.js +54 -54
- package/src/styles/search-menu.js +105 -99
- package/src/styles/signed-out-dropdown.js +31 -31
- package/src/styles/user-menu.js +31 -31
- package/src/styles/wayback-search.js +48 -48
- package/src/styles/wayback-slider.js +30 -30
- package/src/tracked-element.js +29 -27
- package/src/user-menu.js +56 -42
- package/src/wayback-search.js +18 -18
- package/src/wayback-slider.js +87 -87
- package/test/assets/img/hamburger.test.js +15 -15
- package/test/assets/img/user.test.js +15 -15
- package/test/data/menus.test.js +19 -19
- package/test/dropdown-menu.test.js +25 -25
- package/test/ia-icon.test.js +13 -13
- package/test/ia-topnav.test.js +273 -273
- package/test/login-button.test.js +15 -15
- package/test/media-button.test.js +19 -19
- package/test/media-menu.test.js +40 -40
- package/test/media-slider.test.js +57 -57
- package/test/more-slider.test.js +13 -13
- package/test/nav-search.test.js +61 -61
- package/test/primary-nav.test.js +82 -82
- package/test/save-page-form.test.js +35 -35
- package/test/search-menu.test.js +49 -49
- package/test/user-menu.test.js +33 -33
- package/test/wayback-slider.test.js +80 -80
package/src/user-menu.js
CHANGED
|
@@ -1,42 +1,56 @@
|
|
|
1
|
-
import { html } from 'https://offshoot.prod.archive.org/lit.js';
|
|
2
|
-
import DropdownMenu from './dropdown-menu.js';
|
|
3
|
-
import userMenuCSS from './styles/user-menu.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
import { html } from 'https://offshoot.prod.archive.org/lit.js';
|
|
2
|
+
import DropdownMenu from './dropdown-menu.js';
|
|
3
|
+
import userMenuCSS from './styles/user-menu.js';
|
|
4
|
+
import KeyboardNavigation from './lib/keyboard-navigation.js';
|
|
5
|
+
|
|
6
|
+
class UserMenu extends DropdownMenu {
|
|
7
|
+
static get styles() {
|
|
8
|
+
return [DropdownMenu.styles, userMenuCSS];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static get properties() {
|
|
12
|
+
const props = {
|
|
13
|
+
...DropdownMenu.properties,
|
|
14
|
+
username: { type: String },
|
|
15
|
+
screenName: { type: String },
|
|
16
|
+
};
|
|
17
|
+
return props;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.username = '';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
updated(props) {
|
|
26
|
+
if (props.has('open') && this.open) {
|
|
27
|
+
const container = this.shadowRoot?.querySelector('.nav-container');
|
|
28
|
+
|
|
29
|
+
if (container) {
|
|
30
|
+
const keyboardNavigation = new KeyboardNavigation(container, 'usermenu');
|
|
31
|
+
this.addEventListener('keydown', keyboardNavigation.handleKeyDown);
|
|
32
|
+
this.removeEventListener('keydown', this.previousKeydownListener);
|
|
33
|
+
this.previousKeydownListener = keyboardNavigation.handleKeyDown;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
return html`
|
|
40
|
+
<div class="nav-container">
|
|
41
|
+
<nav
|
|
42
|
+
class="${this.menuClass}"
|
|
43
|
+
aria-hidden="${this.ariaHidden}"
|
|
44
|
+
aria-expanded="${this.ariaExpanded}"
|
|
45
|
+
>
|
|
46
|
+
<h3>${this.screenName}</h3>
|
|
47
|
+
<ul>
|
|
48
|
+
${this.dropdownItems}
|
|
49
|
+
</ul>
|
|
50
|
+
</nav>
|
|
51
|
+
</div>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
customElements.define('user-menu', UserMenu);
|
package/src/wayback-search.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// NOTE: for fully local testing, you can toggle these two lines
|
|
2
|
-
import WaybackSearch from '@internetarchive/ia-wayback-search';
|
|
3
|
-
// import WaybackSearch from '../../../packages/ia-wayback-search/index.js';
|
|
4
|
-
|
|
5
|
-
// future way we could move to:
|
|
6
|
-
// import WaybackSearch from 'https://esm.archive.org/@internetarchive/ia-wayback-search@^0.2.3';
|
|
7
|
-
|
|
8
|
-
import waybackSearchCSS from './styles/wayback-search.js';
|
|
9
|
-
|
|
10
|
-
class NavWaybackSearch extends WaybackSearch {
|
|
11
|
-
static get styles() {
|
|
12
|
-
return [WaybackSearch.styles, waybackSearchCSS];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
customElements.define('wayback-search', NavWaybackSearch);
|
|
17
|
-
|
|
18
|
-
export default NavWaybackSearch;
|
|
1
|
+
// NOTE: for fully local testing, you can toggle these two lines
|
|
2
|
+
import WaybackSearch from '@internetarchive/ia-wayback-search';
|
|
3
|
+
// import WaybackSearch from '../../../packages/ia-wayback-search/index.js';
|
|
4
|
+
|
|
5
|
+
// future way we could move to:
|
|
6
|
+
// import WaybackSearch from 'https://esm.archive.org/@internetarchive/ia-wayback-search@^0.2.3';
|
|
7
|
+
|
|
8
|
+
import waybackSearchCSS from './styles/wayback-search.js';
|
|
9
|
+
|
|
10
|
+
class NavWaybackSearch extends WaybackSearch {
|
|
11
|
+
static get styles() {
|
|
12
|
+
return [WaybackSearch.styles, waybackSearchCSS];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
customElements.define('wayback-search', NavWaybackSearch);
|
|
17
|
+
|
|
18
|
+
export default NavWaybackSearch;
|
package/src/wayback-slider.js
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { html } from 'https://offshoot.prod.archive.org/lit.js';
|
|
2
|
-
import './wayback-search.js';
|
|
3
|
-
import TrackedElement from './tracked-element.js';
|
|
4
|
-
import './save-page-form.js';
|
|
5
|
-
import queryHandler from './lib/query-handler.js';
|
|
6
|
-
import waybackSliderCSS from './styles/wayback-slider.js';
|
|
7
|
-
import toSentenceCase from './lib/toSentenceCase.js';
|
|
8
|
-
import formatUrl from './lib/formatUrl.js';
|
|
9
|
-
|
|
10
|
-
class WaybackSlider extends TrackedElement {
|
|
11
|
-
static get styles() {
|
|
12
|
-
return waybackSliderCSS;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static get properties() {
|
|
16
|
-
return {
|
|
17
|
-
archiveItLinks: { type: Array },
|
|
18
|
-
baseHost: { type: String },
|
|
19
|
-
browserExtensionsLinks: { type: Array },
|
|
20
|
-
config: { type: Object },
|
|
21
|
-
mobileAppsLinks: { type: Array },
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
constructor() {
|
|
26
|
-
super();
|
|
27
|
-
|
|
28
|
-
this.archiveItLinks = [];
|
|
29
|
-
this.browserExtensionsLinks = [];
|
|
30
|
-
this.mobileAppsLinks = [];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get mobileAppsItems() {
|
|
34
|
-
return this.linkList('mobileAppsLinks', 'Wayback');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get browserExtensionsItems() {
|
|
38
|
-
return this.linkList('browserExtensionsLinks', 'Wayback');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get archiveItItems() {
|
|
42
|
-
return this.linkList('archiveItLinks', 'ArchiveIt');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
linkList(linkType, eventPrefix) {
|
|
46
|
-
return this[linkType].map(link => html`<li>
|
|
47
|
-
<a href=${formatUrl(link.url, this.baseHost)} @click=${this.trackClick} data-event-click-tracking="${this.analyticsEvent(`${eventPrefix}${link.title}`)}" target=${link.external ? '_blank' : ''} rel=${link.external ? 'noreferrer noopener' : ''}>${link.title}</a>
|
|
48
|
-
</li>`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
analyticsEvent(title) {
|
|
52
|
-
return `${this.config.eventCategory}|${toSentenceCase(title)}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
render() {
|
|
56
|
-
return html`
|
|
57
|
-
<div class="grid">
|
|
58
|
-
<wayback-search
|
|
59
|
-
waybackPagesArchived=${this.config.waybackPagesArchived}
|
|
60
|
-
.queryHandler=${queryHandler}></wayback-search>
|
|
61
|
-
<div class="link-lists">
|
|
62
|
-
<div>
|
|
63
|
-
<h4>Mobile Apps</h4>
|
|
64
|
-
<ul class="mobile-apps">
|
|
65
|
-
${this.mobileAppsItems}
|
|
66
|
-
</ul>
|
|
67
|
-
<h4>Browser Extensions</h4>
|
|
68
|
-
<ul class="browser-extensions">
|
|
69
|
-
${this.browserExtensionsItems}
|
|
70
|
-
</ul>
|
|
71
|
-
</div>
|
|
72
|
-
<div>
|
|
73
|
-
<h4>Archive-It Subscription</h4>
|
|
74
|
-
<ul class="archive-it">
|
|
75
|
-
${this.archiveItItems}
|
|
76
|
-
</ul>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
<save-page-form .config=${this.config}></save-page-form>
|
|
80
|
-
</div>
|
|
81
|
-
`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
customElements.define('wayback-slider', WaybackSlider);
|
|
86
|
-
|
|
87
|
-
export default WaybackSlider;
|
|
1
|
+
import { html } from 'https://offshoot.prod.archive.org/lit.js';
|
|
2
|
+
import './wayback-search.js';
|
|
3
|
+
import TrackedElement from './tracked-element.js';
|
|
4
|
+
import './save-page-form.js';
|
|
5
|
+
import queryHandler from './lib/query-handler.js';
|
|
6
|
+
import waybackSliderCSS from './styles/wayback-slider.js';
|
|
7
|
+
import toSentenceCase from './lib/toSentenceCase.js';
|
|
8
|
+
import formatUrl from './lib/formatUrl.js';
|
|
9
|
+
|
|
10
|
+
class WaybackSlider extends TrackedElement {
|
|
11
|
+
static get styles() {
|
|
12
|
+
return waybackSliderCSS;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
archiveItLinks: { type: Array },
|
|
18
|
+
baseHost: { type: String },
|
|
19
|
+
browserExtensionsLinks: { type: Array },
|
|
20
|
+
config: { type: Object },
|
|
21
|
+
mobileAppsLinks: { type: Array },
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
|
|
28
|
+
this.archiveItLinks = [];
|
|
29
|
+
this.browserExtensionsLinks = [];
|
|
30
|
+
this.mobileAppsLinks = [];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get mobileAppsItems() {
|
|
34
|
+
return this.linkList('mobileAppsLinks', 'Wayback');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get browserExtensionsItems() {
|
|
38
|
+
return this.linkList('browserExtensionsLinks', 'Wayback');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get archiveItItems() {
|
|
42
|
+
return this.linkList('archiveItLinks', 'ArchiveIt');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
linkList(linkType, eventPrefix) {
|
|
46
|
+
return this[linkType].map(link => html`<li>
|
|
47
|
+
<a href=${formatUrl(link.url, this.baseHost)} @click=${this.trackClick} data-event-click-tracking="${this.analyticsEvent(`${eventPrefix}${link.title}`)}" target=${link.external ? '_blank' : ''} rel=${link.external ? 'noreferrer noopener' : ''}>${link.title}</a>
|
|
48
|
+
</li>`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
analyticsEvent(title) {
|
|
52
|
+
return `${this.config.eventCategory}|${toSentenceCase(title)}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
render() {
|
|
56
|
+
return html`
|
|
57
|
+
<div class="grid">
|
|
58
|
+
<wayback-search
|
|
59
|
+
waybackPagesArchived=${this.config.waybackPagesArchived}
|
|
60
|
+
.queryHandler=${queryHandler}></wayback-search>
|
|
61
|
+
<div class="link-lists">
|
|
62
|
+
<div>
|
|
63
|
+
<h4>Mobile Apps</h4>
|
|
64
|
+
<ul class="mobile-apps">
|
|
65
|
+
${this.mobileAppsItems}
|
|
66
|
+
</ul>
|
|
67
|
+
<h4>Browser Extensions</h4>
|
|
68
|
+
<ul class="browser-extensions">
|
|
69
|
+
${this.browserExtensionsItems}
|
|
70
|
+
</ul>
|
|
71
|
+
</div>
|
|
72
|
+
<div>
|
|
73
|
+
<h4>Archive-It Subscription</h4>
|
|
74
|
+
<ul class="archive-it">
|
|
75
|
+
${this.archiveItItems}
|
|
76
|
+
</ul>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<save-page-form .config=${this.config}></save-page-form>
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
customElements.define('wayback-slider', WaybackSlider);
|
|
86
|
+
|
|
87
|
+
export default WaybackSlider;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
-
import '../../../src/assets/img/hamburger';
|
|
3
|
-
|
|
4
|
-
describe('<icon-hamburger>', () => {
|
|
5
|
-
it('toggles close icon when property toggled', async () => {
|
|
6
|
-
const icon = await fixture(html`<icon-hamburger></icon-hamburger>`);
|
|
7
|
-
|
|
8
|
-
icon.active = true;
|
|
9
|
-
await icon.updateComplete;
|
|
10
|
-
|
|
11
|
-
const titleElement = icon.shadowRoot.querySelector('svg title');
|
|
12
|
-
|
|
13
|
-
expect(titleElement.getAttribute('id')).to.match(/close/);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
1
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
+
import '../../../src/assets/img/hamburger';
|
|
3
|
+
|
|
4
|
+
describe('<icon-hamburger>', () => {
|
|
5
|
+
it('toggles close icon when property toggled', async () => {
|
|
6
|
+
const icon = await fixture(html`<icon-hamburger></icon-hamburger>`);
|
|
7
|
+
|
|
8
|
+
icon.active = true;
|
|
9
|
+
await icon.updateComplete;
|
|
10
|
+
|
|
11
|
+
const titleElement = icon.shadowRoot.querySelector('svg title');
|
|
12
|
+
|
|
13
|
+
expect(titleElement.getAttribute('id')).to.match(/close/);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
-
import '../../../src/assets/img/user';
|
|
3
|
-
|
|
4
|
-
describe('<user-image>', () => {
|
|
5
|
-
it('toggles active class when property toggled', async () => {
|
|
6
|
-
const icon = await fixture(html`<user-image></user-image>`);
|
|
7
|
-
|
|
8
|
-
icon.active = true;
|
|
9
|
-
await icon.updateComplete;
|
|
10
|
-
|
|
11
|
-
const styleElement = icon.shadowRoot.querySelector('svg > path');
|
|
12
|
-
|
|
13
|
-
expect(styleElement.classList.contains('active')).to.be.true;
|
|
14
|
-
});
|
|
15
|
-
});
|
|
1
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
+
import '../../../src/assets/img/user';
|
|
3
|
+
|
|
4
|
+
describe('<user-image>', () => {
|
|
5
|
+
it('toggles active class when property toggled', async () => {
|
|
6
|
+
const icon = await fixture(html`<user-image></user-image>`);
|
|
7
|
+
|
|
8
|
+
icon.active = true;
|
|
9
|
+
await icon.updateComplete;
|
|
10
|
+
|
|
11
|
+
const styleElement = icon.shadowRoot.querySelector('svg > path');
|
|
12
|
+
|
|
13
|
+
expect(styleElement.classList.contains('active')).to.be.true;
|
|
14
|
+
});
|
|
15
|
+
});
|
package/test/data/menus.test.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import { buildTopNavMenus } from '../../src/data/menus.js';
|
|
3
|
-
|
|
4
|
-
describe('Menu data', () => {
|
|
5
|
-
it('returns a collection for each media category', () => {
|
|
6
|
-
[
|
|
7
|
-
'texts',
|
|
8
|
-
'video',
|
|
9
|
-
'audio',
|
|
10
|
-
'software',
|
|
11
|
-
'images',
|
|
12
|
-
'user',
|
|
13
|
-
'more',
|
|
14
|
-
].forEach((category) => {
|
|
15
|
-
const menus = buildTopNavMenus();
|
|
16
|
-
expect(menus[category]).to.not.be.undefined;
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { buildTopNavMenus } from '../../src/data/menus.js';
|
|
3
|
+
|
|
4
|
+
describe('Menu data', () => {
|
|
5
|
+
it('returns a collection for each media category', () => {
|
|
6
|
+
[
|
|
7
|
+
'texts',
|
|
8
|
+
'video',
|
|
9
|
+
'audio',
|
|
10
|
+
'software',
|
|
11
|
+
'images',
|
|
12
|
+
'user',
|
|
13
|
+
'more',
|
|
14
|
+
].forEach((category) => {
|
|
15
|
+
const menus = buildTopNavMenus();
|
|
16
|
+
expect(menus[category]).to.not.be.undefined;
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
-
|
|
3
|
-
import DropdownMenu from '../src/dropdown-menu';
|
|
4
|
-
|
|
5
|
-
customElements.define('dropdown-menu', DropdownMenu);
|
|
6
|
-
|
|
7
|
-
const component = html`<dropdown-menu></dropdown-menu>`;
|
|
8
|
-
|
|
9
|
-
describe('<dropdown-menu>', () => {
|
|
10
|
-
it('sets default properties', async () => {
|
|
11
|
-
const el = await fixture(component);
|
|
12
|
-
|
|
13
|
-
expect(el.animate).to.be.false;
|
|
14
|
-
expect(el.open).to.be.false;
|
|
15
|
-
expect(el.menuItems.length).to.equal(0);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders a closed class if component is animating', async () => {
|
|
19
|
-
const el = await fixture(component);
|
|
20
|
-
|
|
21
|
-
el.animate = true;
|
|
22
|
-
await el.updateComplete;
|
|
23
|
-
expect(el.shadowRoot.querySelector('.closed')).to.not.be.undefined;
|
|
24
|
-
});
|
|
25
|
-
});
|
|
1
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
+
|
|
3
|
+
import DropdownMenu from '../src/dropdown-menu';
|
|
4
|
+
|
|
5
|
+
customElements.define('dropdown-menu', DropdownMenu);
|
|
6
|
+
|
|
7
|
+
const component = html`<dropdown-menu></dropdown-menu>`;
|
|
8
|
+
|
|
9
|
+
describe('<dropdown-menu>', () => {
|
|
10
|
+
it('sets default properties', async () => {
|
|
11
|
+
const el = await fixture(component);
|
|
12
|
+
|
|
13
|
+
expect(el.animate).to.be.false;
|
|
14
|
+
expect(el.open).to.be.false;
|
|
15
|
+
expect(el.menuItems.length).to.equal(0);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('renders a closed class if component is animating', async () => {
|
|
19
|
+
const el = await fixture(component);
|
|
20
|
+
|
|
21
|
+
el.animate = true;
|
|
22
|
+
await el.updateComplete;
|
|
23
|
+
expect(el.shadowRoot.querySelector('.closed')).to.not.be.undefined;
|
|
24
|
+
});
|
|
25
|
+
});
|
package/test/ia-icon.test.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
-
import '../src/assets/img/ia-icon';
|
|
3
|
-
|
|
4
|
-
describe('<ia-icon>', () => {
|
|
5
|
-
it('renders an icon with a fill color', async () => {
|
|
6
|
-
const iconType = 'web';
|
|
7
|
-
const fill = '#999';
|
|
8
|
-
const iaIcon = await fixture(html`<ia-icon .icon=${iconType} .fill=${fill}></ia-icon>`);
|
|
9
|
-
|
|
10
|
-
expect(iaIcon.icon).to.equal(iconType);
|
|
11
|
-
expect(iaIcon.fill).to.equal(fill);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
1
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
|
2
|
+
import '../src/assets/img/ia-icon';
|
|
3
|
+
|
|
4
|
+
describe('<ia-icon>', () => {
|
|
5
|
+
it('renders an icon with a fill color', async () => {
|
|
6
|
+
const iconType = 'web';
|
|
7
|
+
const fill = '#999';
|
|
8
|
+
const iaIcon = await fixture(html`<ia-icon .icon=${iconType} .fill=${fill}></ia-icon>`);
|
|
9
|
+
|
|
10
|
+
expect(iaIcon.icon).to.equal(iconType);
|
|
11
|
+
expect(iaIcon.fill).to.equal(fill);
|
|
12
|
+
});
|
|
13
|
+
});
|