From bef7e29a3f994074abbea10512b8ec1ce213110e Mon Sep 17 00:00:00 2001 From: Wenqi Chen <1264578441@qq.com> Date: Wed, 6 Jan 2021 20:50:37 -0600 Subject: [PATCH] fix(module:carousel): throw error when changing rtl (#6318) close #6301 --- components/carousel/carousel.component.ts | 4 +--- components/carousel/carousel.spec.ts | 21 --------------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/components/carousel/carousel.component.ts b/components/carousel/carousel.component.ts index c740d0d5983..0ed55642cdc 100644 --- a/components/carousel/carousel.component.ts +++ b/components/carousel/carousel.component.ts @@ -92,8 +92,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'carousel'; `, host: { - '[class.ant-carousel-vertical]': 'vertical', - '[class.ant-carousel-rtl]': `dir ==='rtl'` + '[class.ant-carousel-vertical]': 'vertical' } }) export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnDestroy, OnChanges, OnInit { @@ -173,7 +172,6 @@ export class NzCarouselComponent implements AfterContentInit, AfterViewInit, OnD this.dir = this.directionality.value; this.directionality.change?.pipe(takeUntil(this.destroy$)).subscribe((direction: Direction) => { this.dir = direction; - this.switchStrategy(); }); } diff --git a/components/carousel/carousel.spec.ts b/components/carousel/carousel.spec.ts index 75cd8609012..546f50677b0 100644 --- a/components/carousel/carousel.spec.ts +++ b/components/carousel/carousel.spec.ts @@ -277,27 +277,6 @@ describe('carousel', () => { // Already covered in components specs. // describe('opacity strategy', () => {}); }); - - describe('RTL', () => { - let fixture: ComponentFixture; - let carouselWrapper: DebugElement; - - beforeEach(() => { - fixture = TestBed.createComponent(NzTestCarouselRtlComponent); - fixture.detectChanges(); - carouselWrapper = fixture.debugElement.query(By.directive(NzCarouselComponent)); - }); - - it('should className correct', () => { - fixture.detectChanges(); - expect(carouselWrapper.nativeElement.classList).toContain('ant-carousel-rtl'); - - fixture.componentInstance.direction = 'ltr'; - fixture.detectChanges(); - - expect(carouselWrapper.nativeElement.classList).not.toContain('ant-carousel-rtl'); - }); - }); }); describe('carousel custom strategies', () => {