Skip to content

Commit 3f50a06

Browse files
committed
fix(modal): attempt to focus when there is no focusable element on modal dialog
1 parent bb89f06 commit 3f50a06

13 files changed

+64
-52
lines changed

projects/coreui-angular/src/lib/modal/modal-body/modal-body.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ describe('ModalBodyComponent', () => {
99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
1111
imports: [ModalBodyComponent]
12-
})
13-
.compileComponents();
12+
}).compileComponents();
1413
});
1514

1615
beforeEach(() => {
@@ -22,4 +21,8 @@ describe('ModalBodyComponent', () => {
2221
it('should create', () => {
2322
expect(component).toBeTruthy();
2423
});
24+
25+
it('should have css classes', () => {
26+
expect(fixture.nativeElement).toHaveClass('modal-body');
27+
});
2528
});

projects/coreui-angular/src/lib/modal/modal-body/modal-body.component.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ import { Component, HostBinding } from '@angular/core';
22

33
@Component({
44
selector: 'c-modal-body',
5-
template: '<ng-content></ng-content>',
5+
template: '<ng-content />',
66
styleUrls: ['./modal-body.component.scss'],
77
standalone: true
88
})
99
export class ModalBodyComponent {
10-
1110
@HostBinding('class')
1211
get hostClasses(): any {
1312
return {
14-
'modal-body': true,
13+
'modal-body': true
1514
};
1615
}
1716
}

projects/coreui-angular/src/lib/modal/modal-content/modal-content.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ describe('ModalContentComponent', () => {
99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
1111
imports: [ModalContentComponent]
12-
})
13-
.compileComponents();
12+
}).compileComponents();
1413
});
1514

1615
beforeEach(() => {
@@ -22,4 +21,8 @@ describe('ModalContentComponent', () => {
2221
it('should create', () => {
2322
expect(component).toBeTruthy();
2423
});
24+
25+
it('should have css classes', () => {
26+
expect(fixture.nativeElement).toHaveClass('modal-content');
27+
});
2528
});

projects/coreui-angular/src/lib/modal/modal-content/modal-content.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, HostBinding } from '@angular/core';
22

33
@Component({
44
selector: 'c-modal-content',
5-
template: '<ng-content></ng-content>',
5+
template: '<ng-content />',
66
standalone: true
77
})
88
export class ModalContentComponent {

projects/coreui-angular/src/lib/modal/modal-dialog/modal-dialog.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ describe('ModalDialogComponent', () => {
99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
1111
imports: [ModalDialogComponent]
12-
})
13-
.compileComponents();
12+
}).compileComponents();
1413
});
1514

1615
beforeEach(() => {
@@ -22,4 +21,8 @@ describe('ModalDialogComponent', () => {
2221
it('should create', () => {
2322
expect(component).toBeTruthy();
2423
});
24+
25+
it('should have css classes', () => {
26+
expect(fixture.nativeElement).toHaveClass('modal-dialog');
27+
});
2528
});

projects/coreui-angular/src/lib/modal/modal-dialog/modal-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, HostBinding, Input } from '@angular/core';
22

33
@Component({
44
selector: 'c-modal-dialog',
5-
template: '<ng-content></ng-content>',
5+
template: '<ng-content />',
66
styleUrls: ['./modal-dialog.component.scss'],
77
standalone: true
88
})

projects/coreui-angular/src/lib/modal/modal-footer/modal-footer.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ describe('ModalFooterComponent', () => {
99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
1111
imports: [ModalFooterComponent]
12-
})
13-
.compileComponents();
12+
}).compileComponents();
1413
});
1514

1615
beforeEach(() => {
@@ -22,4 +21,8 @@ describe('ModalFooterComponent', () => {
2221
it('should create', () => {
2322
expect(component).toBeTruthy();
2423
});
24+
25+
it('should have css classes', () => {
26+
expect(fixture.nativeElement).toHaveClass('modal-footer');
27+
});
2528
});

projects/coreui-angular/src/lib/modal/modal-footer/modal-footer.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ import { Component, HostBinding } from '@angular/core';
22

33
@Component({
44
selector: 'c-modal-footer',
5-
template: '<ng-content></ng-content>',
5+
template: '<ng-content />',
66
standalone: true
77
})
88
export class ModalFooterComponent {
9-
109
@HostBinding('class')
1110
get hostClasses(): any {
1211
return {
13-
'modal-footer': true,
12+
'modal-footer': true
1413
};
1514
}
16-
1715
}

projects/coreui-angular/src/lib/modal/modal-header/modal-header.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ describe('ModalHeaderComponent', () => {
99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
1111
imports: [ModalHeaderComponent]
12-
})
13-
.compileComponents();
12+
}).compileComponents();
1413
});
1514

1615
beforeEach(() => {
@@ -22,4 +21,8 @@ describe('ModalHeaderComponent', () => {
2221
it('should create', () => {
2322
expect(component).toBeTruthy();
2423
});
24+
25+
it('should have css classes', () => {
26+
expect(fixture.nativeElement).toHaveClass('modal-header');
27+
});
2528
});

projects/coreui-angular/src/lib/modal/modal-header/modal-header.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ import { Component, HostBinding } from '@angular/core';
22

33
@Component({
44
selector: 'c-modal-header',
5-
template: `<ng-content></ng-content>`,
5+
template: '<ng-content />',
66
standalone: true
77
})
88
export class ModalHeaderComponent {
9-
109
@HostBinding('class')
1110
get hostClasses(): any {
1211
return {
1312
'modal-header': true
1413
};
1514
}
16-
1715
}

0 commit comments

Comments
 (0)