@@ -330,6 +330,216 @@ define(function (require, exports, module) {
330330 // Verify the tab bar is not visible
331331 expect ( $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ) . toBe ( false ) ;
332332 } ) ;
333+
334+ it ( "should show working set when the option is enabled" , async function ( ) {
335+ // Enable the working set feature
336+ PreferencesManager . set ( "showWorkingSet" , true ) ;
337+
338+ // Wait for the working set to become visible
339+ await awaitsFor (
340+ function ( ) {
341+ return ! $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ;
342+ } ,
343+ "Working set to become visible" ,
344+ 1000
345+ ) ;
346+
347+ // Verify the working set is visible
348+ expect ( $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ) . toBe ( false ) ;
349+ } ) ;
350+
351+ it ( "should hide working set when the option is disabled" , async function ( ) {
352+ // Disable the working set feature
353+ PreferencesManager . set ( "showWorkingSet" , false ) ;
354+
355+ // Wait for the working set to become hidden
356+ await awaitsFor (
357+ function ( ) {
358+ return $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ;
359+ } ,
360+ "Working set to become hidden" ,
361+ 1000
362+ ) ;
363+
364+ // Verify the working set is not visible
365+ expect ( $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ) . toBe ( true ) ;
366+ } ) ;
367+ } ) ;
368+
369+ describe ( "Configure Working Set Button" , function ( ) {
370+ it ( "should have a working set configuration button in the sidebar" , function ( ) {
371+ // Verify the button exists
372+ const $configButton = $ ( ".working-set-splitview-btn" ) ;
373+ expect ( $configButton . length ) . toBe ( 1 ) ;
374+ } ) ;
375+
376+ it ( "should open a menu with 'Show working set' and 'Show file tab bar' options when clicked" , async function ( ) {
377+ // Click the configure working set button
378+ const $configButton = $ ( ".working-set-splitview-btn" ) ;
379+ $configButton . click ( ) ;
380+
381+ // Wait for the menu to appear
382+ await awaitsFor (
383+ function ( ) {
384+ return $ ( ".dropdown-menu:visible" ) . length > 0 ;
385+ } ,
386+ "Context menu to appear" ,
387+ 1000
388+ ) ;
389+
390+ // Verify the menu contains the expected options
391+ const $menu = $ ( ".dropdown-menu:visible" ) ;
392+ const showWorkingSetItem = $menu . find ( "li a[id$='cmd.toggleShowWorkingSet']" ) ;
393+ const showFileTabsItem = $menu . find ( "li a[id$='cmd.toggleShowFileTabs']" ) ;
394+
395+ expect ( showWorkingSetItem . length ) . toBe ( 1 ) ;
396+ expect ( showFileTabsItem . length ) . toBe ( 1 ) ;
397+
398+ // Clean up - close the menu
399+ $ ( "body" ) . click ( ) ;
400+ } ) ;
401+
402+ it ( "should toggle working set visibility when 'Show working set' option is clicked" , async function ( ) {
403+ // First, ensure working set is visible
404+ PreferencesManager . set ( "showWorkingSet" , true ) ;
405+ await awaitsFor (
406+ function ( ) {
407+ return ! $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ;
408+ } ,
409+ "Working set to become visible" ,
410+ 1000
411+ ) ;
412+
413+ // Click the configure working set button
414+ const $configButton = $ ( ".working-set-splitview-btn" ) ;
415+ $configButton . click ( ) ;
416+
417+ // Wait for the menu to appear
418+ await awaitsFor (
419+ function ( ) {
420+ return $ ( ".dropdown-menu:visible" ) . length > 0 ;
421+ } ,
422+ "Context menu to appear" ,
423+ 1000
424+ ) ;
425+
426+ // Click the "Show working set" option
427+ const $menu = $ ( ".dropdown-menu:visible" ) ;
428+ const showWorkingSetItem = $menu . find ( "li a[id$='cmd.toggleShowWorkingSet']" ) ;
429+ showWorkingSetItem . click ( ) ;
430+
431+ // Wait for the working set to become hidden
432+ await awaitsFor (
433+ function ( ) {
434+ return $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ;
435+ } ,
436+ "Working set to become hidden" ,
437+ 1000
438+ ) ;
439+
440+ // Verify the working set is hidden
441+ expect ( $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ) . toBe ( true ) ;
442+
443+ // Click the configure working set button again
444+ $configButton . click ( ) ;
445+
446+ // Wait for the menu to appear
447+ await awaitsFor (
448+ function ( ) {
449+ return $ ( ".dropdown-menu:visible" ) . length > 0 ;
450+ } ,
451+ "Context menu to appear" ,
452+ 1000
453+ ) ;
454+
455+ // Click the "Show working set" option again
456+ const $menu2 = $ ( ".dropdown-menu:visible" ) ;
457+ const showWorkingSetItem2 = $menu2 . find ( "li a[id$='cmd.toggleShowWorkingSet']" ) ;
458+ showWorkingSetItem2 . click ( ) ;
459+
460+ // Wait for the working set to become visible
461+ await awaitsFor (
462+ function ( ) {
463+ return ! $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ;
464+ } ,
465+ "Working set to become visible" ,
466+ 1000
467+ ) ;
468+
469+ // Verify the working set is visible
470+ expect ( $ ( "#working-set-list-container" ) . hasClass ( "working-set-hidden" ) ) . toBe ( false ) ;
471+ } ) ;
472+
473+ it ( "should toggle tab bar visibility when 'Show file tab bar' option is clicked" , async function ( ) {
474+ // First, ensure tab bar is visible
475+ PreferencesManager . set ( "tabBar.options" , { showTabBar : true , numberOfTabs : - 1 } ) ;
476+ await awaitsFor (
477+ function ( ) {
478+ return $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ;
479+ } ,
480+ "Tab bar to become visible" ,
481+ 1000
482+ ) ;
483+
484+ // Click the configure working set button
485+ const $configButton = $ ( ".working-set-splitview-btn" ) ;
486+ $configButton . click ( ) ;
487+
488+ // Wait for the menu to appear
489+ await awaitsFor (
490+ function ( ) {
491+ return $ ( ".dropdown-menu:visible" ) . length > 0 ;
492+ } ,
493+ "Context menu to appear" ,
494+ 1000
495+ ) ;
496+
497+ // Click the "Show file tab bar" option
498+ const $menu = $ ( ".dropdown-menu:visible" ) ;
499+ const showFileTabsItem = $menu . find ( "li a[id$='cmd.toggleShowFileTabs']" ) ;
500+ showFileTabsItem . click ( ) ;
501+
502+ // Wait for the tab bar to become hidden
503+ await awaitsFor (
504+ function ( ) {
505+ return ! $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ;
506+ } ,
507+ "Tab bar to become hidden" ,
508+ 1000
509+ ) ;
510+
511+ // Verify the tab bar is hidden
512+ expect ( $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ) . toBe ( false ) ;
513+
514+ // Click the configure working set button again
515+ $configButton . click ( ) ;
516+
517+ // Wait for the menu to appear
518+ await awaitsFor (
519+ function ( ) {
520+ return $ ( ".dropdown-menu:visible" ) . length > 0 ;
521+ } ,
522+ "Context menu to appear" ,
523+ 1000
524+ ) ;
525+
526+ // Click the "Show file tab bar" option again
527+ const $menu2 = $ ( ".dropdown-menu:visible" ) ;
528+ const showFileTabsItem2 = $menu2 . find ( "li a[id$='cmd.toggleShowFileTabs']" ) ;
529+ showFileTabsItem2 . click ( ) ;
530+
531+ // Wait for the tab bar to become visible
532+ await awaitsFor (
533+ function ( ) {
534+ return $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ;
535+ } ,
536+ "Tab bar to become visible" ,
537+ 1000
538+ ) ;
539+
540+ // Verify the tab bar is visible
541+ expect ( $ ( "#phoenix-tab-bar" ) . is ( ":visible" ) ) . toBe ( true ) ;
542+ } ) ;
333543 } ) ;
334544
335545 describe ( "Drag and Drop" , function ( ) {
@@ -3070,28 +3280,6 @@ define(function (require, exports, module) {
30703280 // Should not go below 0
30713281 expect ( $tabBar . scrollLeft ( ) ) . toBeGreaterThanOrEqual ( 0 ) ;
30723282 } ) ;
3073-
3074- it ( "should handle rapid consecutive scroll events" , function ( ) {
3075- const $tabBar = $ ( "#phoenix-tab-bar" ) ;
3076- expect ( $tabBar . length ) . toBe ( 1 ) ;
3077-
3078- const initialScrollLeft = $tabBar . scrollLeft ( ) ;
3079-
3080- // Trigger multiple rapid scroll events
3081- for ( let i = 0 ; i < 10 ; i ++ ) {
3082- const wheelEvent = $ . Event ( "wheel" ) ;
3083- wheelEvent . originalEvent = { deltaY : 50 } ;
3084- $tabBar . trigger ( wheelEvent ) ;
3085- }
3086-
3087- // Should have scrolled significantly
3088- const finalScrollLeft = $tabBar . scrollLeft ( ) ;
3089- expect ( finalScrollLeft ) . toBeGreaterThan ( initialScrollLeft + 100 ) ;
3090-
3091- // Verify the total scroll amount after multiple events
3092- // 10 scrolls of 50 * 2.5 = 1250 pixels total
3093- expect ( finalScrollLeft - initialScrollLeft ) . toBeCloseTo ( 10 * 50 * 2.5 , 0 ) ;
3094- } ) ;
30953283 } ) ;
30963284 } ) ;
30973285} ) ;
0 commit comments