@triptease/tt-navbar 0.0.32 → 0.0.34

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @triptease/tt-navbar v0.0.32
2
+ * @triptease/tt-navbar v0.0.34
3
3
  */
4
4
 
5
5
  // src/urlMappings.ts
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent tt-navbar following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "tt-navbar",
6
- "version": "0.0.32",
6
+ "version": "0.0.34",
7
7
  "type": "module",
8
8
  "main": "dist/src/index.js",
9
9
  "module": "dist/src/index.js",
package/src/TtNavbar.ts CHANGED
@@ -141,6 +141,12 @@ export class TtNavbar extends LitElement {
141
141
  if (bestMatch) {
142
142
  bestMatch.classList.add('current-page');
143
143
  bestMatch.setAttribute('aria-current', 'page');
144
+
145
+ // Auto-expand parent details if the active link is within a collapsible section
146
+ const parentDetails = bestMatch.closest('details');
147
+ if (parentDetails) {
148
+ parentDetails.setAttribute('open', '');
149
+ }
144
150
  } else {
145
151
  console.error(`No matching nav link found for path: ${currentPath}`);
146
152
  }
@@ -227,7 +233,7 @@ export class TtNavbar extends LitElement {
227
233
  >
228
234
  <a
229
235
  class="nav-item"
230
- href=${this.buildUrl('/channels')}
236
+ href=${this.buildUrl('/$CLIENT_KEY/channels')}
231
237
  @click=${this.onAnchorClick}
232
238
  >${unsafeSVG(channels)}<span>Channels</span></a
233
239
  >
@@ -61,7 +61,7 @@ describe('TtNavbar', () => {
61
61
  expect(getLinkByHref(links, '/')).to.exist;
62
62
  expect(getLinkByHref(links, 'https://app.campaign-manager.triptease.io'))
63
63
  .to.exist;
64
- expect(getLinkByHref(links, '/channels')).to.exist;
64
+ expect(getLinkByHref(links, `/${CLIENT_KEY}/channels`)).to.exist;
65
65
  expect(getLinkByHref(links, `/parity/${CLIENT_KEY}`)).to.exist;
66
66
  expect(getLinkByHref(links, `/guest-insights/${CLIENT_KEY}`)).to.exist;
67
67
  expect(getLinkByHref(links, `/${CLIENT_KEY}/guest-behavioural-data`)).to
@@ -88,7 +88,7 @@ describe('TtNavbar', () => {
88
88
  expect(getLinkByHref(links, `${platformUrl}/`)).to.exist;
89
89
  expect(getLinkByHref(links, 'https://app.campaign-manager.triptease.io'))
90
90
  .to.exist; // This shouldn't change
91
- expect(getLinkByHref(links, `${platformUrl}/channels`)).to.exist;
91
+ expect(getLinkByHref(links, `${platformUrl}/${CLIENT_KEY}/channels`)).to.exist;
92
92
  }
93
93
  });
94
94
 
@@ -266,7 +266,7 @@ describe('TtNavbar', () => {
266
266
 
267
267
  const URLs = [
268
268
  ['/', 'Dashboard'],
269
- ['/channels', 'Channels'],
269
+ [`/${CLIENT_KEY}/channels`, 'Channels'],
270
270
  [`/parity/${CLIENT_KEY}`, 'Parity'],
271
271
  [`/parity/${CLIENT_KEY}`, 'Parity'],
272
272
  [`/parity/${CLIENT_KEY}/foo`, 'Parity'],
@@ -318,7 +318,6 @@ describe('TtNavbar', () => {
318
318
  ];
319
319
  navbar.onClientChange = onClientChange;
320
320
 
321
- console.log(getComputedStyle(navbar).getPropertyValue('--nav-bar-width'));
322
321
  await navbar.updateComplete;
323
322
 
324
323
  const combobox = navbar.shadowRoot?.querySelector('tt-combobox');
@@ -346,4 +345,18 @@ describe('TtNavbar', () => {
346
345
  await expect(getComputedStyle(navbar).getPropertyValue('--nav-bar-width').trim()).to.equal('fit-content');
347
346
 
348
347
  });
348
+
349
+ it('should expand the details when the current page is within that section', async () => {
350
+ // eslint-disable-next-line no-restricted-globals
351
+ history.pushState({}, '', `/parity/${CLIENT_KEY}`);
352
+
353
+ const navbar = await fixture<TtNavbar>(
354
+ `<tt-navbar client-key=${CLIENT_KEY}></tt-navbar>`
355
+ );
356
+
357
+ const marketInsightsDetails = navbar.shadowRoot!.querySelector('#market-insights') as HTMLDetailsElement;
358
+
359
+ expect(marketInsightsDetails).to.exist;
360
+ expect(marketInsightsDetails.open).to.be.true;
361
+ })
349
362
  });