1
- import { Component , DebugElement , EventEmitter , signal , Type , WritableSignal } from '@angular/core' ;
1
+ import { Component , DebugElement , signal , Type , WritableSignal } from '@angular/core' ;
2
2
import { CdkRadioButton , CdkRadioGroup } from './radio' ;
3
3
import { ComponentFixture , TestBed } from '@angular/core/testing' ;
4
4
import { By } from '@angular/platform-browser' ;
@@ -79,7 +79,7 @@ async function runAccessibilityChecks(root: HTMLElement): Promise<void> {
79
79
80
80
describe ( 'CdkRadioGroup' , ( ) => {
81
81
let fixture : ComponentFixture < RadioGroupExample > ;
82
- let textDirection = new EventEmitter < Direction > ( ) ;
82
+ let textDirection = signal ( 'ltr' ) ;
83
83
84
84
let radioGroup : DebugElement ;
85
85
let radioButtons : DebugElement [ ] ;
@@ -111,7 +111,7 @@ describe('CdkRadioGroup', () => {
111
111
providers : [
112
112
{
113
113
provide : Directionality ,
114
- useValue : { value : 'ltr' , change : textDirection } ,
114
+ useFactory : ( ) => ( { valueSignal : textDirection } ) ,
115
115
} ,
116
116
] ,
117
117
imports : [ BidiModule , component ] ,
@@ -120,6 +120,7 @@ describe('CdkRadioGroup', () => {
120
120
const fixture = TestBed . createComponent < T > ( component ) ;
121
121
fixture . detectChanges ( ) ;
122
122
defineTestVariables ( fixture ) ;
123
+ textDirection . set ( 'ltr' ) ;
123
124
return fixture ;
124
125
}
125
126
@@ -171,7 +172,7 @@ describe('CdkRadioGroup', () => {
171
172
} ) ;
172
173
}
173
174
if ( opts ?. textDirection !== undefined ) {
174
- textDirection . emit ( opts . textDirection ) ;
175
+ textDirection . set ( opts . textDirection ) ;
175
176
}
176
177
fixture . detectChanges ( ) ;
177
178
defineTestVariables ( fixture ) ; // Ensure env vars are up-to-date with the dom.
@@ -502,16 +503,14 @@ describe('CdkRadioGroup', () => {
502
503
} ) ;
503
504
504
505
describe ( 'text direction rtl' , ( ) => {
505
- beforeEach ( ( ) => setupRadioGroup ( { textDirection : 'rtl' } ) ) ;
506
+ beforeEach ( ( ) => setupRadioGroup ( { textDirection : 'rtl' , orientation : 'horizontal' } ) ) ;
506
507
507
508
it ( 'should move focus to the next radio button on ArrowLeft' , ( ) => {
508
- setupRadioGroup ( { orientation : 'horizontal' } ) ;
509
509
left ( ) ;
510
510
expect ( isFocused ( 1 ) ) . toBe ( true ) ;
511
511
} ) ;
512
512
513
513
it ( 'should move focus to the previous radio button on ArrowRight' , ( ) => {
514
- setupRadioGroup ( { orientation : 'horizontal' } ) ;
515
514
left ( ) ;
516
515
left ( ) ;
517
516
right ( ) ;
@@ -522,7 +521,6 @@ describe('CdkRadioGroup', () => {
522
521
setupRadioGroup ( {
523
522
skipDisabled : true ,
524
523
disabledOptions : [ 1 , 2 ] ,
525
- orientation : 'horizontal' ,
526
524
} ) ;
527
525
left ( ) ;
528
526
expect ( isFocused ( 3 ) ) . toBe ( true ) ;
0 commit comments