@@ -594,32 +594,6 @@ describe('MatMenu', () => {
594594 expect ( panel . classList ) . toContain ( 'custom-two' ) ;
595595 } ) ) ;
596596
597- it ( 'should not remove mat-elevation class from overlay when panelClass is changed' , fakeAsync ( ( ) => {
598- const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
599-
600- fixture . componentInstance . panelClass = 'custom-one' ;
601- fixture . detectChanges ( ) ;
602- fixture . componentInstance . trigger . openMenu ( ) ;
603- fixture . detectChanges ( ) ;
604- tick ( 500 ) ;
605-
606- const panel = overlayContainerElement . querySelector ( '.mat-mdc-menu-panel' ) ! ;
607-
608- expect ( panel . classList ) . toContain ( 'custom-one' ) ;
609- expect ( panel . classList ) . toContain ( 'mat-elevation-z2' ) ;
610-
611- fixture . componentInstance . panelClass = 'custom-two' ;
612- fixture . changeDetectorRef . markForCheck ( ) ;
613- fixture . detectChanges ( ) ;
614-
615- expect ( panel . classList ) . not . toContain ( 'custom-one' ) ;
616- expect ( panel . classList ) . toContain ( 'custom-two' ) ;
617- expect ( panel . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
618- expect ( panel . classList )
619- . withContext ( 'Expected mat-elevation-z2 not to be removed' )
620- . toContain ( 'mat-elevation-z2' ) ;
621- } ) ) ;
622-
623597 it ( 'should set the "menu" role on the overlay panel' , fakeAsync ( ( ) => {
624598 const fixture = createComponent ( SimpleMenu , [ ] , [ FakeIcon ] ) ;
625599 fixture . detectChanges ( ) ;
@@ -2350,79 +2324,6 @@ describe('MatMenu', () => {
23502324 expect ( menuItems [ 0 ] . querySelector ( '.mat-mdc-menu-submenu-icon' ) ) . toBeFalsy ( ) ;
23512325 } ) ) ;
23522326
2353- it ( 'should increase the sub-menu elevation based on its depth' , fakeAsync ( ( ) => {
2354- compileTestComponent ( ) ;
2355- instance . rootTrigger . openMenu ( ) ;
2356- fixture . detectChanges ( ) ;
2357- tick ( 500 ) ;
2358-
2359- instance . levelOneTrigger . openMenu ( ) ;
2360- fixture . detectChanges ( ) ;
2361- tick ( 500 ) ;
2362-
2363- instance . levelTwoTrigger . openMenu ( ) ;
2364- fixture . detectChanges ( ) ;
2365- tick ( 500 ) ;
2366-
2367- const menus = overlay . querySelectorAll ( '.mat-mdc-menu-panel' ) ;
2368-
2369- expect ( menus [ 0 ] . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2370- expect ( menus [ 0 ] . classList )
2371- . withContext ( 'Expected root menu to have base elevation.' )
2372- . toContain ( 'mat-elevation-z2' ) ;
2373-
2374- expect ( menus [ 1 ] . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2375- expect ( menus [ 1 ] . classList )
2376- . withContext ( 'Expected first sub-menu to have base elevation + 1.' )
2377- . toContain ( 'mat-elevation-z3' ) ;
2378-
2379- expect ( menus [ 2 ] . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2380- expect ( menus [ 2 ] . classList )
2381- . withContext ( 'Expected second sub-menu to have base elevation + 2.' )
2382- . toContain ( 'mat-elevation-z4' ) ;
2383- } ) ) ;
2384-
2385- it ( 'should update the elevation when the same menu is opened at a different depth' , fakeAsync ( ( ) => {
2386- compileTestComponent ( ) ;
2387- instance . rootTrigger . openMenu ( ) ;
2388- fixture . detectChanges ( ) ;
2389-
2390- instance . levelOneTrigger . openMenu ( ) ;
2391- fixture . detectChanges ( ) ;
2392-
2393- instance . levelTwoTrigger . openMenu ( ) ;
2394- fixture . detectChanges ( ) ;
2395-
2396- let lastMenu = overlay . querySelectorAll ( '.mat-mdc-menu-panel' ) [ 2 ] ;
2397-
2398- expect ( lastMenu . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2399- expect ( lastMenu . classList )
2400- . withContext ( 'Expected menu to have the base elevation plus two.' )
2401- . toContain ( 'mat-elevation-z4' ) ;
2402-
2403- ( overlay . querySelector ( '.cdk-overlay-backdrop' ) ! as HTMLElement ) . click ( ) ;
2404- fixture . detectChanges ( ) ;
2405- tick ( 500 ) ;
2406-
2407- expect ( overlay . querySelectorAll ( '.mat-mdc-menu-panel' ) . length )
2408- . withContext ( 'Expected no open menus' )
2409- . toBe ( 0 ) ;
2410-
2411- instance . alternateTrigger . openMenu ( ) ;
2412- fixture . detectChanges ( ) ;
2413- tick ( 500 ) ;
2414-
2415- lastMenu = overlay . querySelector ( '.mat-mdc-menu-panel' ) as HTMLElement ;
2416-
2417- expect ( lastMenu . classList ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2418- expect ( lastMenu . classList )
2419- . not . withContext ( 'Expected menu not to maintain old elevation.' )
2420- . toContain ( 'mat-elevation-z4' ) ;
2421- expect ( lastMenu . classList )
2422- . withContext ( 'Expected menu to have the proper updated elevation.' )
2423- . toContain ( 'mat-elevation-z2' ) ;
2424- } ) ) ;
2425-
24262327 it ( 'should not change focus origin if origin not specified for trigger' , fakeAsync ( ( ) => {
24272328 compileTestComponent ( ) ;
24282329
@@ -2442,28 +2343,6 @@ describe('MatMenu', () => {
24422343 expect ( levelTwoTrigger . classList ) . toContain ( 'cdk-mouse-focused' ) ;
24432344 } ) ) ;
24442345
2445- it ( 'should not increase the elevation if the user specified a custom one' , fakeAsync ( ( ) => {
2446- const elevationFixture = createComponent ( NestedMenuCustomElevation ) ;
2447-
2448- elevationFixture . detectChanges ( ) ;
2449- elevationFixture . componentInstance . rootTrigger . openMenu ( ) ;
2450- elevationFixture . detectChanges ( ) ;
2451- tick ( 500 ) ;
2452-
2453- elevationFixture . componentInstance . levelOneTrigger . openMenu ( ) ;
2454- elevationFixture . detectChanges ( ) ;
2455- tick ( 500 ) ;
2456-
2457- const menuClasses =
2458- overlayContainerElement . querySelectorAll ( '.mat-mdc-menu-panel' ) [ 1 ] . classList ;
2459-
2460- expect ( menuClasses ) . toContain ( 'mat-mdc-elevation-specific' ) ;
2461- expect ( menuClasses )
2462- . withContext ( 'Expected user elevation to be maintained' )
2463- . toContain ( 'mat-elevation-z24' ) ;
2464- expect ( menuClasses ) . not . toContain ( 'mat-elevation-z2' , 'Expected no stacked elevation.' ) ;
2465- } ) ) ;
2466-
24672346 it ( 'should close all of the menus when the root is closed programmatically' , fakeAsync ( ( ) => {
24682347 compileTestComponent ( ) ;
24692348 instance . rootTrigger . openMenu ( ) ;
@@ -2934,27 +2813,6 @@ class NestedMenu {
29342813 showLazy = false ;
29352814}
29362815
2937- @Component ( {
2938- template : `
2939- <button [matMenuTriggerFor]="root" #rootTrigger="matMenuTrigger">Toggle menu</button>
2940-
2941- <mat-menu #root="matMenu">
2942- <button mat-menu-item
2943- [matMenuTriggerFor]="levelOne"
2944- #levelOneTrigger="matMenuTrigger">One</button>
2945- </mat-menu>
2946-
2947- <mat-menu #levelOne="matMenu" class="mat-elevation-z24">
2948- <button mat-menu-item>Two</button>
2949- </mat-menu>
2950- ` ,
2951- standalone : false ,
2952- } )
2953- class NestedMenuCustomElevation {
2954- @ViewChild ( 'rootTrigger' ) rootTrigger : MatMenuTrigger ;
2955- @ViewChild ( 'levelOneTrigger' ) levelOneTrigger : MatMenuTrigger ;
2956- }
2957-
29582816@Component ( {
29592817 template : `
29602818 <button [matMenuTriggerFor]="root" #rootTriggerEl>Toggle menu</button>
0 commit comments