Additional unit tests for form widgets

This commit is contained in:
Denys Vuika
2016-10-12 14:24:21 +01:00
parent 39178f1788
commit ccd41ba6e1
10 changed files with 223 additions and 26 deletions

View File

@@ -15,7 +15,7 @@
* limitations under the License.
*/
import { Input, AfterViewInit, Output, EventEmitter } from '@angular/core';
import { Input, AfterViewInit, Output, EventEmitter, ElementRef } from '@angular/core';
import { FormFieldModel } from './core/index';
/**
@@ -63,6 +63,18 @@ export class WidgetComponent implements AfterViewInit {
return false;
}
setupMaterialTextField(elementRef: ElementRef, handler: any, value: string) {
if (elementRef && handler) {
let el = elementRef.nativeElement;
if (el) {
let container = el.querySelector('.mdl-textfield');
if (container) {
container.MaterialTextfield.change(value);
}
}
}
}
checkVisibility(field: FormFieldModel) {
this.fieldChanged.emit(field);
}