1- import { Directionality } from '../../bidi' ;
2- import { Platform , _supportsShadowDom } from '../../platform' ;
3- import { CdkScrollable , ViewportRuler } from '../../scrolling' ;
4- import {
5- createMouseEvent ,
6- createTouchEvent ,
7- dispatchEvent ,
8- dispatchFakeEvent ,
9- dispatchMouseEvent ,
10- dispatchTouchEvent ,
11- } from '../../testing/private' ;
121import {
132 AfterViewInit ,
143 ChangeDetectionStrategy ,
@@ -25,20 +14,33 @@ import {
2514 signal ,
2615} from '@angular/core' ;
2716import { ComponentFixture , TestBed , fakeAsync , flush , tick } from '@angular/core/testing' ;
28- import { of as observableOf } from 'rxjs' ;
17+ import { Platform , _supportsShadowDom } from '../../platform' ;
18+ import { CdkScrollable , ViewportRuler } from '../../scrolling' ;
19+ import {
20+ createMouseEvent ,
21+ createTouchEvent ,
22+ dispatchEvent ,
23+ dispatchFakeEvent ,
24+ dispatchMouseEvent ,
25+ dispatchTouchEvent ,
26+ } from '../../testing/private' ;
2927
3028import { extendStyles } from '../dom/styling' ;
3129import { CdkDragDrop , CdkDragEnter , CdkDragStart } from '../drag-events' ;
3230import { DragRef , Point , PreviewContainer } from '../drag-ref' ;
3331import { moveItemInArray } from '../drag-utils' ;
3432
33+ import { provideFakeDirectionality } from '@angular/cdk/testing/private/fake-directionality' ;
34+ import { NgClass , NgFor , NgIf , NgTemplateOutlet } from '@angular/common' ;
3535import { CDK_DRAG_CONFIG , DragAxis , DragDropConfig , DropListOrientation } from './config' ;
3636import { CdkDrag } from './drag' ;
37+ import { CdkDragPlaceholder } from './drag-placeholder' ;
38+ import { CdkDragPreview } from './drag-preview' ;
3739import { CdkDropList } from './drop-list' ;
3840import { CdkDropListGroup } from './drop-list-group' ;
3941import {
40- createComponent as _createComponent ,
4142 DragDropTestConfig ,
43+ createComponent as _createComponent ,
4244 continueDraggingViaTouch ,
4345 dragElementViaMouse ,
4446 makeScrollable ,
@@ -47,9 +49,6 @@ import {
4749 stopDraggingViaTouch ,
4850 tickAnimationFrames ,
4951} from './test-utils.spec' ;
50- import { NgClass , NgFor , NgIf , NgTemplateOutlet } from '@angular/common' ;
51- import { CdkDragPreview } from './drag-preview' ;
52- import { CdkDragPlaceholder } from './drag-placeholder' ;
5352
5453export const ITEM_HEIGHT = 25 ;
5554export const ITEM_WIDTH = 75 ;
@@ -551,12 +550,7 @@ export function defineCommonDropListTests(config: {
551550
552551 it ( 'should dispatch the correct `dropped` event in RTL horizontal drop zone' , fakeAsync ( ( ) => {
553552 const fixture = createComponent ( DraggableInHorizontalDropZone , {
554- providers : [
555- {
556- provide : Directionality ,
557- useValue : { value : 'rtl' , change : observableOf ( ) } ,
558- } ,
559- ] ,
553+ providers : [ provideFakeDirectionality ( 'rtl' ) ] ,
560554 } ) ;
561555
562556 fixture . nativeElement . setAttribute ( 'dir' , 'rtl' ) ;
@@ -1200,12 +1194,7 @@ export function defineCommonDropListTests(config: {
12001194
12011195 it ( 'should pass the proper direction to the preview in rtl' , fakeAsync ( ( ) => {
12021196 const fixture = createComponent ( DraggableInDropZone , {
1203- providers : [
1204- {
1205- provide : Directionality ,
1206- useValue : { value : 'rtl' , change : observableOf ( ) } ,
1207- } ,
1208- ] ,
1197+ providers : [ provideFakeDirectionality ( 'rtl' ) ] ,
12091198 } ) ;
12101199
12111200 fixture . detectChanges ( ) ;
@@ -2500,12 +2489,7 @@ export function defineCommonDropListTests(config: {
25002489
25012490 it ( 'should auto-scroll right if the user holds their pointer at right edge in rtl' , fakeAsync ( ( ) => {
25022491 const fixture = createComponent ( DraggableInScrollableHorizontalDropZone , {
2503- providers : [
2504- {
2505- provide : Directionality ,
2506- useValue : { value : 'rtl' , change : observableOf ( ) } ,
2507- } ,
2508- ] ,
2492+ providers : [ provideFakeDirectionality ( 'rtl' ) ] ,
25092493 } ) ;
25102494 fixture . nativeElement . setAttribute ( 'dir' , 'rtl' ) ;
25112495 fixture . detectChanges ( ) ;
@@ -2529,12 +2513,7 @@ export function defineCommonDropListTests(config: {
25292513
25302514 it ( 'should auto-scroll left if the user holds their pointer at left edge in rtl' , fakeAsync ( ( ) => {
25312515 const fixture = createComponent ( DraggableInScrollableHorizontalDropZone , {
2532- providers : [
2533- {
2534- provide : Directionality ,
2535- useValue : { value : 'rtl' , change : observableOf ( ) } ,
2536- } ,
2537- ] ,
2516+ providers : [ provideFakeDirectionality ( 'rtl' ) ] ,
25382517 } ) ;
25392518 fixture . nativeElement . setAttribute ( 'dir' , 'rtl' ) ;
25402519 fixture . detectChanges ( ) ;
0 commit comments