diff --git a/src/generators/Generator.js b/src/generators/Generator.js index 83f726cab6..f7ba312078 100644 --- a/src/generators/Generator.js +++ b/src/generators/Generator.js @@ -148,7 +148,9 @@ export default class Generator { }); dependencies.forEach( name => { - this.expectedProperties.add( name ); + if ( !globalWhitelist.has( name ) ) { + this.expectedProperties.add( name ); + } }); return { diff --git a/src/generators/dom/index.js b/src/generators/dom/index.js index 385690d715..3e994e0b39 100644 --- a/src/generators/dom/index.js +++ b/src/generators/dom/index.js @@ -218,7 +218,7 @@ export default function dom ( parsed, source, options ) { if ( options.dev ) { generator.expectedProperties.forEach( prop => { constructorBlock.addLine( - `if ( !( '${prop}' in this._state ) ) throw new Error( "Component was created without expected data property '${prop}'" );` + `if ( !( '${prop}' in this._state ) ) console.warn( "Component was created without expected data property '${prop}'" );` ); }); diff --git a/test/runtime/samples/dev-warning-missing-data-binding/_config.js b/test/runtime/samples/dev-warning-missing-data-binding/_config.js index 7b3e61fcda..a95a23b2b0 100644 --- a/test/runtime/samples/dev-warning-missing-data-binding/_config.js +++ b/test/runtime/samples/dev-warning-missing-data-binding/_config.js @@ -1,7 +1,7 @@ export default { dev: true, - error ( assert, err ) { - assert.equal( err.message, `Component was created without expected data property 'value'` ); - } -}; \ No newline at end of file + warnings: [ + `Component was created without expected data property 'value'` + ] +}; diff --git a/test/runtime/samples/dev-warning-missing-data/_config.js b/test/runtime/samples/dev-warning-missing-data/_config.js index da44c09cc1..90238c598b 100644 --- a/test/runtime/samples/dev-warning-missing-data/_config.js +++ b/test/runtime/samples/dev-warning-missing-data/_config.js @@ -1,7 +1,8 @@ export default { dev: true, - error ( assert, err ) { - assert.equal( err.message, `Component was created without expected data property 'foo'` ); - } -}; \ No newline at end of file + warnings: [ + `Component was created without expected data property 'foo'`, + `Component was created without expected data property 'bar'` + ] +}; diff --git a/test/runtime/samples/dev-warning-missing-data/main.html b/test/runtime/samples/dev-warning-missing-data/main.html index 083fa61785..f2b243bada 100644 --- a/test/runtime/samples/dev-warning-missing-data/main.html +++ b/test/runtime/samples/dev-warning-missing-data/main.html @@ -1 +1,4 @@ -
{{foo}}
\ No newline at end of file ++ {{Math.max(0, foo)}} + {{bar}} +