Permalink
Browse files

feat(fields): show warning when model is undefined

  • Loading branch information...
bas080
bas080 committed May 23, 2016
1 parent dc0bd12 commit 714c3722cc04969fec96abda256bc54b281c2070
Showing with 11 additions and 9 deletions.
  1. +4 −9 src/form-field.js
  2. +7 −0 src/form-fields.js
@@ -25,11 +25,6 @@ export class FormFieldCustomElement {
}
}

valueChanged(a, b) {
//TODO: this is where we could validate
return a;
}

@computedFrom('schema')
get label() {
let str = this.schema.label || this.schema.name;
@@ -42,7 +37,6 @@ export class FormFieldCustomElement {
@computedFrom('schema')
get component() {
this.schema.type = aliasOf(this.config, this.schema.type);
console.log(this.schema);
return component(this.config, this.schema);
}

@@ -69,7 +63,8 @@ export class FormFieldCustomElement {
* @returns {string}
*/
function aliasOf(config, type) {
return config.aliases[type] ?
config.aliases[type] :
type;
if (type === undefined) {
return 'text';
}
return (config.aliases[type] !== undefined) ? config.aliases[type] : type;
}
@@ -5,4 +5,11 @@ export class FormFieldsCustomElement {

@bindable({defaultBindingMode: bindingMode.twoWay})
model

attached() {
if (typeof this.model !== 'object') {
// eslint-disable-next-line
console.warn(`model is not an object`);
}
}
}

0 comments on commit 714c372

Please sign in to comment.