@@ -10,7 +10,7 @@ import {
10
10
dispatchKeyboardEvent ,
11
11
dispatchMouseEvent ,
12
12
patchElementFocus ,
13
- } from '../.. /cdk/testing/private' ;
13
+ } from '@angular /cdk/testing/private' ;
14
14
import { Location } from '@angular/common' ;
15
15
import { SpyLocation } from '@angular/common/testing' ;
16
16
import {
@@ -29,6 +29,7 @@ import {
29
29
ViewChild ,
30
30
ViewContainerRef ,
31
31
ViewEncapsulation ,
32
+ forwardRef ,
32
33
} from '@angular/core' ;
33
34
import {
34
35
ComponentFixture ,
@@ -49,6 +50,10 @@ import {
49
50
MatDialogRef ,
50
51
MAT_DIALOG_DATA ,
51
52
MAT_DIALOG_DEFAULT_OPTIONS ,
53
+ MatDialogContent ,
54
+ MatDialogTitle ,
55
+ MatDialogActions ,
56
+ MatDialogClose ,
52
57
} from './index' ;
53
58
import { CLOSE_ANIMATION_DURATION , OPEN_ANIMATION_DURATION } from './dialog-container' ;
54
59
@@ -64,8 +69,9 @@ describe('MDC-based MatDialog', () => {
64
69
65
70
beforeEach ( fakeAsync ( ( ) => {
66
71
TestBed . configureTestingModule ( {
67
- imports : [ MatDialogModule , NoopAnimationsModule ] ,
68
- declarations : [
72
+ imports : [
73
+ MatDialogModule ,
74
+ NoopAnimationsModule ,
69
75
ComponentWithChildViewContainer ,
70
76
ComponentWithTemplateRef ,
71
77
PizzaMsg ,
@@ -1839,8 +1845,7 @@ describe('MDC-based MatDialog with a parent MatDialog', () => {
1839
1845
1840
1846
beforeEach ( fakeAsync ( ( ) => {
1841
1847
TestBed . configureTestingModule ( {
1842
- imports : [ MatDialogModule , NoopAnimationsModule ] ,
1843
- declarations : [ ComponentThatProvidesMatDialog ] ,
1848
+ imports : [ MatDialogModule , NoopAnimationsModule , ComponentThatProvidesMatDialog ] ,
1844
1849
providers : [
1845
1850
{
1846
1851
provide : OverlayContainer ,
@@ -1953,8 +1958,12 @@ describe('MDC-based MatDialog with default options', () => {
1953
1958
} ;
1954
1959
1955
1960
TestBed . configureTestingModule ( {
1956
- imports : [ MatDialogModule , NoopAnimationsModule ] ,
1957
- declarations : [ ComponentWithChildViewContainer , DirectiveWithViewContainer ] ,
1961
+ imports : [
1962
+ MatDialogModule ,
1963
+ NoopAnimationsModule ,
1964
+ ComponentWithChildViewContainer ,
1965
+ DirectiveWithViewContainer ,
1966
+ ] ,
1958
1967
providers : [ { provide : MAT_DIALOG_DEFAULT_OPTIONS , useValue : defaultConfig } ] ,
1959
1968
} ) ;
1960
1969
@@ -2021,8 +2030,12 @@ describe('MDC-based MatDialog with animations enabled', () => {
2021
2030
2022
2031
beforeEach ( fakeAsync ( ( ) => {
2023
2032
TestBed . configureTestingModule ( {
2024
- imports : [ MatDialogModule , BrowserAnimationsModule ] ,
2025
- declarations : [ ComponentWithChildViewContainer , DirectiveWithViewContainer ] ,
2033
+ imports : [
2034
+ MatDialogModule ,
2035
+ BrowserAnimationsModule ,
2036
+ ComponentWithChildViewContainer ,
2037
+ DirectiveWithViewContainer ,
2038
+ ] ,
2026
2039
} ) ;
2027
2040
2028
2041
TestBed . compileComponents ( ) ;
@@ -2081,8 +2094,7 @@ describe('MatDialog with explicit injector provided', () => {
2081
2094
2082
2095
beforeEach ( fakeAsync ( ( ) => {
2083
2096
TestBed . configureTestingModule ( {
2084
- imports : [ MatDialogModule , BrowserAnimationsModule ] ,
2085
- declarations : [ ModuleBoundDialogParentComponent ] ,
2097
+ imports : [ MatDialogModule , BrowserAnimationsModule , ModuleBoundDialogParentComponent ] ,
2086
2098
} ) ;
2087
2099
2088
2100
TestBed . compileComponents ( ) ;
@@ -2106,7 +2118,10 @@ describe('MatDialog with explicit injector provided', () => {
2106
2118
} ) ;
2107
2119
} ) ;
2108
2120
2109
- @Directive ( { selector : 'dir-with-view-container' } )
2121
+ @Directive ( {
2122
+ selector : 'dir-with-view-container' ,
2123
+ standalone : true ,
2124
+ } )
2110
2125
class DirectiveWithViewContainer {
2111
2126
constructor ( public viewContainerRef : ViewContainerRef ) { }
2112
2127
}
@@ -2122,6 +2137,8 @@ class ComponentWithOnPushViewContainer {
2122
2137
@Component ( {
2123
2138
selector : 'arbitrary-component' ,
2124
2139
template : `@if (showChildView) {<dir-with-view-container></dir-with-view-container>}` ,
2140
+ standalone : true ,
2141
+ imports : [ DirectiveWithViewContainer ] ,
2125
2142
} )
2126
2143
class ComponentWithChildViewContainer {
2127
2144
showChildView = true ;
@@ -2137,6 +2154,7 @@ class ComponentWithChildViewContainer {
2137
2154
selector : 'arbitrary-component-with-template-ref' ,
2138
2155
template : `<ng-template let-data let-dialogRef="dialogRef">
2139
2156
Cheese {{localValue}} {{data?.value}}{{setDialogRef(dialogRef)}}</ng-template>` ,
2157
+ standalone : true ,
2140
2158
} )
2141
2159
class ComponentWithTemplateRef {
2142
2160
localValue : string ;
@@ -2151,7 +2169,10 @@ class ComponentWithTemplateRef {
2151
2169
}
2152
2170
2153
2171
/** Simple component for testing ComponentPortal. */
2154
- @Component ( { template : '<p>Pizza</p> <input> <button>Close</button>' } )
2172
+ @Component ( {
2173
+ template : '<p>Pizza</p> <input> <button>Close</button>' ,
2174
+ standalone : true ,
2175
+ } )
2155
2176
class PizzaMsg {
2156
2177
constructor (
2157
2178
public dialogRef : MatDialogRef < PizzaMsg > ,
@@ -2183,6 +2204,8 @@ class PizzaMsg {
2183
2204
<button class="with-submit" type="submit" mat-dialog-close>Should have submit</button>
2184
2205
</mat-dialog-actions>
2185
2206
` ,
2207
+ standalone : true ,
2208
+ imports : [ MatDialogTitle , MatDialogContent , MatDialogActions , MatDialogClose ] ,
2186
2209
} )
2187
2210
class ContentElementDialog {
2188
2211
shownTitle : 'first' | 'second' | 'third' | 'all' = 'first' ;
@@ -2217,6 +2240,8 @@ class ContentElementDialog {
2217
2240
</mat-dialog-actions>
2218
2241
</ng-template>
2219
2242
` ,
2243
+ standalone : true ,
2244
+ imports : [ MatDialogTitle , MatDialogContent , MatDialogActions , MatDialogClose ] ,
2220
2245
} )
2221
2246
class ComponentWithContentElementTemplateRef {
2222
2247
@ViewChild ( TemplateRef ) templateRef : TemplateRef < any > ;
@@ -2228,18 +2253,28 @@ class ComponentWithContentElementTemplateRef {
2228
2253
}
2229
2254
}
2230
2255
2231
- @Component ( { template : '' , providers : [ MatDialog ] } )
2256
+ @Component ( {
2257
+ template : '' ,
2258
+ providers : [ MatDialog ] ,
2259
+ standalone : true ,
2260
+ } )
2232
2261
class ComponentThatProvidesMatDialog {
2233
2262
constructor ( public dialog : MatDialog ) { }
2234
2263
}
2235
2264
2236
2265
/** Simple component for testing ComponentPortal. */
2237
- @Component ( { template : '' } )
2266
+ @Component ( {
2267
+ template : '' ,
2268
+ standalone : true ,
2269
+ } )
2238
2270
class DialogWithInjectedData {
2239
2271
constructor ( @Inject ( MAT_DIALOG_DATA ) public data : any ) { }
2240
2272
}
2241
2273
2242
- @Component ( { template : '<p>Pasta</p>' } )
2274
+ @Component ( {
2275
+ template : '<p>Pasta</p>' ,
2276
+ standalone : true ,
2277
+ } )
2243
2278
class DialogWithoutFocusableElements { }
2244
2279
2245
2280
@Component ( {
@@ -2248,7 +2283,10 @@ class DialogWithoutFocusableElements {}
2248
2283
} )
2249
2284
class ShadowDomComponent { }
2250
2285
2251
- @Component ( { template : '' } )
2286
+ @Component ( {
2287
+ template : '' ,
2288
+ standalone : true ,
2289
+ } )
2252
2290
class ModuleBoundDialogParentComponent {
2253
2291
constructor (
2254
2292
private _injector : Injector ,
@@ -2272,16 +2310,22 @@ class ModuleBoundDialogService {
2272
2310
2273
2311
@Component ( {
2274
2312
template : '<module-bound-dialog-child-component></module-bound-dialog-child-component>' ,
2313
+ standalone : true ,
2314
+ imports : [ forwardRef ( ( ) => ModuleBoundDialogChildComponent ) ] ,
2275
2315
} )
2276
2316
class ModuleBoundDialogComponent { }
2277
2317
2278
- @Component ( { selector : 'module-bound-dialog-child-component' , template : '<p>{{service.name}}</p>' } )
2318
+ @Component ( {
2319
+ selector : 'module-bound-dialog-child-component' ,
2320
+ template : '<p>{{service.name}}</p>' ,
2321
+ standalone : true ,
2322
+ } )
2279
2323
class ModuleBoundDialogChildComponent {
2280
2324
constructor ( public service : ModuleBoundDialogService ) { }
2281
2325
}
2282
2326
2283
2327
@NgModule ( {
2284
- declarations : [ ModuleBoundDialogComponent , ModuleBoundDialogChildComponent ] ,
2328
+ imports : [ ModuleBoundDialogComponent , ModuleBoundDialogChildComponent ] ,
2285
2329
providers : [ ModuleBoundDialogService ] ,
2286
2330
} )
2287
2331
class ModuleBoundDialogModule { }
0 commit comments