@@ -240,6 +240,66 @@ describe("Navigation Marker", function () {
240240 ) ;
241241 expect ( current_link . classList . contains ( "current" ) ) . toBe ( true ) ;
242242 } ) ;
243+
244+ it ( "uses custom in-path-class and current-class when specified via pattern arguments" , async function ( ) {
245+ // Set up custom class names via data attributes
246+ document . body . innerHTML = `
247+ <nav class="pat-navigationmarker" data-pat-navigationmarker="in-path-class: in-path; current-class: active">
248+ <ul>
249+ <li>
250+ <a href="http://example.com">Home</a>
251+ </li>
252+ <li>
253+ <input type="checkbox" id="news-toggle">
254+ <a href="http://example.com/news">News</a>
255+ <ul>
256+ <li>
257+ <a href="http://example.com/news/article-1">Article 1</a>
258+ </li>
259+ <li>
260+ <a href="http://example.com/news/article-2">Article 2</a>
261+ </li>
262+ </ul>
263+ </li>
264+ <li>
265+ <a href="http://example.com/about">About</a>
266+ </li>
267+ </ul>
268+ </nav>
269+ ` ;
270+
271+ this . nav_element = document . querySelector ( ".pat-navigationmarker" ) ;
272+ registry . scan ( document . body ) ;
273+ await utils . timeout ( 1 ) ;
274+
275+ // Test custom current-class "active"
276+ const current_link = this . nav_element . querySelector (
277+ "a[href='http://example.com/news/article-1']" ,
278+ ) ;
279+ const current_item = current_link . parentElement ;
280+ expect ( current_link . classList . contains ( "active" ) ) . toBe ( true ) ;
281+ expect ( current_item . classList . contains ( "active" ) ) . toBe ( true ) ;
282+ // Should NOT contain the default "current" class
283+ expect ( current_link . classList . contains ( "current" ) ) . toBe ( false ) ;
284+ expect ( current_item . classList . contains ( "current" ) ) . toBe ( false ) ;
285+
286+ // Test custom in-path-class "in-path"
287+ const news_link = this . nav_element . querySelector (
288+ "a[href='http://example.com/news']" ,
289+ ) ;
290+ const news_item = news_link . parentElement ;
291+ expect ( news_item . classList . contains ( "in-path" ) ) . toBe ( true ) ;
292+ // Should NOT contain the default "inPath" class
293+ expect ( news_item . classList . contains ( "inPath" ) ) . toBe ( false ) ;
294+
295+ // Verify other items don't have the custom classes
296+ const home_link = this . nav_element . querySelector ( "a[href='http://example.com']" ) ;
297+ const about_link = this . nav_element . querySelector ( "a[href='http://example.com/about']" ) ;
298+ expect ( home_link . classList . contains ( "in-path" ) ) . toBe ( false ) ;
299+ expect ( home_link . classList . contains ( "active" ) ) . toBe ( false ) ;
300+ expect ( about_link . classList . contains ( "in-path" ) ) . toBe ( false ) ;
301+ expect ( about_link . classList . contains ( "active" ) ) . toBe ( false ) ;
302+ } ) ;
243303} ) ;
244304
245305describe ( "Navigation Marker - Portal URL Edge Cases" , function ( ) {
0 commit comments