@@ -51,6 +51,16 @@ describe('TranslocoDirective', () => {
51
51
expect ( host . queryHost ( 'div' ) ) . toHaveText ( 'Admin Lazy spanish' ) ;
52
52
}
53
53
54
+ function testLimitedTranslation ( host : SpectatorWithHost < TranslocoDirective , HostComponent > ) {
55
+ const service = host . get < TranslocoService > ( TranslocoService ) ;
56
+ initScopeTest ( host , service ) ;
57
+ expect ( host . queryHost ( 'div' ) ) . toHaveText ( 'Title english' ) ;
58
+ service . setActiveLang ( 'es' ) ;
59
+ runLoader ( ) ;
60
+ host . detectChanges ( ) ;
61
+ expect ( host . queryHost ( 'div' ) ) . toHaveText ( 'Title spanish' ) ;
62
+ }
63
+
54
64
it ( 'should unsubscribe after one emit when not in listenToLangChange mode' , fakeAsync ( ( ) => {
55
65
host = createHost ( `<div transloco="home"></div>` ) ;
56
66
runLoader ( ) ;
@@ -185,6 +195,11 @@ describe('TranslocoDirective', () => {
185
195
expect ( host . queryHost ( 'p' ) ) . toHaveText ( 'a.b.c from list english' ) ;
186
196
expect ( host . queryHostAll ( 'p' ) [ 1 ] ) . toHaveText ( 'a.b.c value english' ) ;
187
197
} ) ) ;
198
+
199
+ it ( 'should limit translation to a nested property' , fakeAsync ( ( ) => {
200
+ host = createHost ( `<section *transloco="let t; limit: 'nested'"><div>{{t.title}}</div></section>` , false ) ;
201
+ testLimitedTranslation ( host ) ;
202
+ } ) ) ;
188
203
} ) ;
189
204
190
205
describe ( 'Loading Template' , ( ) => {
@@ -195,7 +210,7 @@ describe('TranslocoDirective', () => {
195
210
<section *transloco="let t; scope: 'lazy-page'; loadingTpl: loading">
196
211
<h1 data-cy="lazy-page">{{ t.title }}</h1>
197
212
</section>
198
-
213
+
199
214
<ng-template #loading>
200
215
<h1 id="lazy-page-loading">Loading...</h1>
201
216
</ng-template>
@@ -252,7 +267,7 @@ describe('TranslocoDirective', () => {
252
267
<section *transloco="let t; scope: 'lazy-page'; loadingTpl: loading">
253
268
<h1 data-cy="lazy-page">{{ t.title }}</h1>
254
269
</section>
255
-
270
+
256
271
<ng-template #loading>
257
272
<h1 id="lazy-page-loading">Loading...</h1>
258
273
</ng-template>
0 commit comments