@triptease/tt-navbar 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/TtNavbar.d.ts +1 -3
- package/dist/src/TtNavbar.js +14 -20
- package/dist/src/TtNavbar.js.map +1 -1
- package/dist/src/styles.d.ts +1 -0
- package/dist/src/styles.js +3 -0
- package/dist/src/styles.js.map +1 -0
- package/dist/test/tt-navbar.test.js +0 -20
- package/dist/test/tt-navbar.test.js.map +1 -1
- package/dist/web/TtNavbar.js +15 -20
- package/dist/web/TtNavbar.js.map +3 -3
- package/dist/web/index.js +15 -20
- package/dist/web/index.js.map +3 -3
- package/dist/web/styles.js +595 -0
- package/dist/web/styles.js.map +7 -0
- package/dist/web/tt-navbar.js +15 -20
- package/dist/web/tt-navbar.js.map +3 -3
- package/package.json +1 -1
- package/src/TtNavbar.ts +13 -17
- package/src/styles.ts +3 -0
- package/test/tt-navbar.test.ts +0 -27
package/package.json
CHANGED
package/src/TtNavbar.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { html,
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
2
|
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { styles } from './styles.js';
|
|
3
4
|
|
|
4
5
|
export class TtNavbar extends LitElement {
|
|
5
|
-
static styles =
|
|
6
|
-
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
padding: 25px;
|
|
9
|
-
color: var(--tt-navbar-text-color, #000);
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
6
|
+
static styles = styles;
|
|
12
7
|
|
|
13
|
-
@property(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__increment() {
|
|
18
|
-
this.counter += 1;
|
|
19
|
-
}
|
|
8
|
+
@property()
|
|
9
|
+
onNavigate: (e: MouseEvent) => void = () => {
|
|
10
|
+
// Do nothing by default
|
|
11
|
+
};
|
|
20
12
|
|
|
21
13
|
render() {
|
|
22
14
|
return html`
|
|
23
|
-
<
|
|
24
|
-
|
|
15
|
+
<nav id=${this.id}>
|
|
16
|
+
<a href="/">Dashboard</a>
|
|
17
|
+
<a href="/campaigns">Campaigns</a>
|
|
18
|
+
<a href="/channels">Channels</a>
|
|
19
|
+
<a href="/guest-insights/zxd47KQGAP">Guest insights</a>
|
|
20
|
+
</nav>
|
|
25
21
|
`;
|
|
26
22
|
}
|
|
27
23
|
}
|
package/src/styles.ts
ADDED
package/test/tt-navbar.test.ts
CHANGED
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { fixture, expect } from '@open-wc/testing';
|
|
3
|
-
import { TtNavbar } from '../src/TtNavbar.js';
|
|
4
1
|
import '../src/tt-navbar.js';
|
|
5
2
|
|
|
6
3
|
describe('TtNavbar', () => {
|
|
7
|
-
it('has a default header "Hey there" and counter 5', async () => {
|
|
8
|
-
const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
|
|
9
4
|
|
|
10
|
-
expect(el.header).to.equal('Hey there');
|
|
11
|
-
expect(el.counter).to.equal(5);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('increases the counter on button click', async () => {
|
|
15
|
-
const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
|
|
16
|
-
el.shadowRoot!.querySelector('button')!.click();
|
|
17
|
-
|
|
18
|
-
expect(el.counter).to.equal(6);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('can override the header via attribute', async () => {
|
|
22
|
-
const el = await fixture<TtNavbar>(html`<tt-navbar header="attribute header"></tt-navbar>`);
|
|
23
|
-
|
|
24
|
-
expect(el.header).to.equal('attribute header');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('passes the a11y audit', async () => {
|
|
28
|
-
const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
|
|
29
|
-
|
|
30
|
-
await expect(el).shadowDom.to.be.accessible();
|
|
31
|
-
});
|
|
32
5
|
});
|