Skip to content

Commit bfc7c32

Browse files
authored
fix(input-group): add type for upload file button #12871 (#12880)
1 parent 0f01c63 commit bfc7c32

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

projects/igniteui-angular/src/lib/input-group/input-group.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<igx-prefix *ngIf="isFileType" class="igx-input-group__upload-button">
2323
<button
2424
igxButton="raised"
25+
type="button"
2526
(click)="uploadButtonHandler()"
2627
[displayDensity]="displayDensity"
2728
[disabled]="disabled"

projects/igniteui-angular/src/lib/input-group/input-group.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('IgxInputGroup', () => {
2727
InputGroupBoxComponent,
2828
InputGroupBorderComponent,
2929
InputGroupSearchComponent,
30+
InputGroupFileComponent,
3031
InputGroupDisabledComponent,
3132
InputGroupDisabledByDefaultComponent,
3233
InputGroupCosyDisplayDensityComponent,
@@ -94,6 +95,15 @@ describe('IgxInputGroup', () => {
9495
testInputGroupType('search', igxInputGroup, inputGroupElement);
9596
}));
9697

98+
it('Initializes upload file button with type=\'button\'.', () => {
99+
const fixture = TestBed.createComponent(InputGroupFileComponent);
100+
fixture.detectChanges();
101+
102+
const uploadFileButton = fixture.debugElement.query(By.css('button')).nativeElement;
103+
104+
expect(uploadFileButton.getAttribute('type')).toEqual('button');
105+
});
106+
97107
it('Should respect type Token and be able to change input group type programmatically.', fakeAsync(() => {
98108
const fixture = TestBed.createComponent(InputGroupComponent);
99109
fixture.detectChanges();
@@ -330,6 +340,13 @@ class InputGroupSearchComponent {
330340
@ViewChild('igxInputGroup', { static: true }) public igxInputGroup: IgxInputGroupComponent;
331341
}
332342

343+
@Component({
344+
template: `<igx-input-group>
345+
<input igxInput type="file" multiple />
346+
</igx-input-group>`
347+
})
348+
class InputGroupFileComponent { }
349+
333350
const testInputGroupType = (type: IgxInputGroupType, component: IgxInputGroupComponent, nativeElement: HTMLInputElement) => {
334351
let isLine = false;
335352
let isBorder = false;

0 commit comments

Comments
 (0)