fix(input): adds support for name property for input element (#452)

closes #446
This commit is contained in:
Robert Messerle
2016-05-18 17:29:39 -07:00
committed by Jeremy Elbourn
parent 601204d810
commit f53ffdbab2
3 changed files with 21 additions and 0 deletions
+1
View File
@@ -27,6 +27,7 @@
[attr.step]="step"
[attr.tabindex]="tabIndex"
[type]="type"
[attr.name]="name"
(focus)="handleFocus($event)"
(blur)="handleBlur($event)"
[(ngModel)]="value"
+19
View File
@@ -645,6 +645,16 @@ export function main() {
})();
});
});
it('supports a name attribute', () => {
return builder.createAsync(MdInputWithNameTestController).then(fixture => {
const inputElement: HTMLInputElement = fixture.debugElement.query(By.css('input'))
.nativeElement;
fixture.detectChanges();
expect(inputElement.name).toBe('some-name');
});
});
});
}
@@ -814,3 +824,12 @@ class MdInputWithBlurAndFocusEvents {
directives: [MdInput]
})
class MdInputOptionalAttributeController {}
@Component({
selector: 'test-input-controller',
template: `
<md-input name="some-name"></md-input>
`,
directives: [MdInput]
})
class MdInputWithNameTestController {}
+1
View File
@@ -155,6 +155,7 @@ export class MdInput implements ControlValueAccessor, AfterContentInit, OnChange
@Input() step: number;
@Input() tabIndex: number;
@Input() type: string = 'text';
@Input() name: string = null;
private _blurEmitter: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();
private _focusEmitter: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();