77 */
88
99import { Direction , Directionality } from '@angular/cdk/bidi' ;
10-
1110import {
1211 ChangeDetectionStrategy ,
1312 ChangeDetectorRef ,
@@ -25,7 +24,9 @@ import {MatListModule} from '@angular/material/list';
2524import { MatSidenavModule } from '@angular/material/sidenav' ;
2625import { MatToolbarModule } from '@angular/material/toolbar' ;
2726import { MatTooltip , MatTooltipModule } from '@angular/material/tooltip' ;
28- import { RouterModule } from '@angular/router' ;
27+ import { ActivatedRoute , RouterModule } from '@angular/router' ;
28+ import { Observable } from 'rxjs' ;
29+ import { map } from 'rxjs/operators' ;
2930import { getAppState , setAppState } from './dev-app-state' ;
3031import { DevAppRippleOptions } from './ripple-options' ;
3132import { DevAppDirectionality } from './dev-app-directionality' ;
@@ -54,8 +55,10 @@ export class DevAppLayout {
5455 private _changeDetectorRef = inject ( ChangeDetectorRef ) ;
5556 private _document = inject ( DOCUMENT ) ;
5657 private _iconRegistry = inject ( MatIconRegistry ) ;
58+ private _route = inject ( ActivatedRoute ) ;
5759
5860 state = getAppState ( ) ;
61+ testMode : Observable < boolean > ;
5962 navItems = [
6063 { name : 'Examples' , route : '/examples' } ,
6164 { name : 'CDK Dialog' , route : '/cdk-dialog' } ,
@@ -135,6 +138,7 @@ export class DevAppLayout {
135138 readonly isZoneless = this . _ngZone instanceof ɵNoopNgZone ;
136139
137140 constructor ( ) {
141+ this . testMode = this . _route . queryParams . pipe ( map ( params => params [ 'testonly' ] === 'true' ) ) ;
138142 this . toggleTheme ( this . state . darkTheme ) ;
139143 this . toggleSystemTheme ( this . state . systemTheme ) ;
140144 this . toggleStrongFocus ( this . state . strongFocusEnabled ) ;
@@ -143,6 +147,14 @@ export class DevAppLayout {
143147 this . toggleDirection ( this . state . direction ) ;
144148 this . toggleM3 ( this . state . m3Enabled ) ;
145149 this . toggleColorApiBackCompat ( this . state . colorApiBackCompat ) ;
150+
151+ this . testMode . subscribe ( isTestOnly => {
152+ if ( isTestOnly ) {
153+ this . toggleM3 ( true ) ;
154+ this . toggleSystemTheme ( true ) ;
155+ this . _document . body . classList . add ( 'demo-testonly-mode' ) ;
156+ }
157+ } ) ;
146158 }
147159
148160 toggleTheme ( value = ! this . state . darkTheme ) {
0 commit comments