@@ -1328,6 +1328,7 @@ describe('NzModal', () => {
13281328 fixture . detectChanges ( ) ;
13291329 expect ( ( overlayContainerElement . querySelector ( '.ant-modal' ) as HTMLDivElement ) . style . width ) . toBe ( '416px' ) ;
13301330 expect ( modalRef . getConfig ( ) . nzMaskClosable ) . toBe ( false ) ;
1331+ expect ( modalRef . getConfig ( ) . nzDraggable ) . toBe ( false ) ;
13311332 expect ( modalRef . getConfig ( ) . nzCentered ) . toBe ( false ) ;
13321333 expect ( overlayContainerElement . querySelectorAll ( 'nz-modal-confirm-container' ) . length ) . toBe ( 1 ) ;
13331334 expect ( overlayContainerElement . querySelector ( '.ant-modal-confirm-title' ) ! . textContent ) . toBe ( 'Test Title' ) ;
@@ -1680,6 +1681,37 @@ describe('NzModal', () => {
16801681
16811682 expect ( overlayContainerElement . querySelector ( 'nz-modal-container' ) ) . toBeNull ( ) ;
16821683 } ) ) ;
1684+
1685+ it ( 'should be draggable when nzDraggable is set to true' , fakeAsync ( ( ) => {
1686+ componentInstance . isVisible = true ;
1687+ componentInstance . isDraggable = true ;
1688+ componentFixture . detectChanges ( ) ;
1689+ flush ( ) ;
1690+ expect ( overlayContainerElement . querySelector ( '.cdk-drag' ) ) . not . toBeNull ( ) ;
1691+
1692+ componentInstance . isDraggable = false ;
1693+ componentFixture . detectChanges ( ) ;
1694+ flush ( ) ;
1695+
1696+ expect ( overlayContainerElement . querySelector ( '.cdk-drag-disabled' ) ) . not . toBeNull ( ) ;
1697+
1698+ componentFixture . destroy ( ) ;
1699+ } ) ) ;
1700+
1701+ it ( 'should have "move" cursor on the top of modal when modal is draggable' , fakeAsync ( ( ) => {
1702+ componentInstance . isVisible = true ;
1703+ componentInstance . isDraggable = true ;
1704+ componentFixture . detectChanges ( ) ;
1705+ flush ( ) ;
1706+ const modalHeader = overlayContainerElement . querySelector ( '.ant-modal-header' ) ;
1707+ expect ( getComputedStyle ( modalHeader ! ) . cursor ) . toEqual ( 'move' ) ;
1708+
1709+ componentInstance . isVisible = true ;
1710+ componentInstance . isDraggable = false ;
1711+ componentFixture . detectChanges ( ) ;
1712+ flush ( ) ;
1713+ expect ( getComputedStyle ( modalHeader ! ) . cursor ) . toEqual ( 'auto' ) ;
1714+ } ) ) ;
16831715 } ) ;
16841716} ) ;
16851717
@@ -1764,6 +1796,7 @@ class TestWithModalContentComponent {
17641796 <nz-modal
17651797 [(nzVisible)]="isVisible"
17661798 [nzContent]="content"
1799+ [nzDraggable]="isDraggable"
17671800 nzTitle="Test Title"
17681801 (nzOnCancel)="handleCancel()"
17691802 (nzOnOk)="handleOk()"
@@ -1775,6 +1808,7 @@ class TestWithModalContentComponent {
17751808} )
17761809class TestModalComponent {
17771810 isVisible = false ;
1811+ isDraggable = false ;
17781812 cancelSpy = jasmine . createSpy ( 'cancel spy' ) ;
17791813 okSpy = jasmine . createSpy ( 'ok spy' ) ;
17801814 @ViewChild ( NzModalComponent ) nzModalComponent ! : NzModalComponent ;
0 commit comments