@triptease/tt-navbar 0.0.33 → 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.33
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.33",
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
  }
@@ -345,4 +345,18 @@ describe('TtNavbar', () => {
345
345
  await expect(getComputedStyle(navbar).getPropertyValue('--nav-bar-width').trim()).to.equal('fit-content');
346
346
 
347
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
+ })
348
362
  });