From e1e2b71e82b9d65762d4275984c6796af6c10b94 Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Fri, 14 Oct 2016 01:58:56 -0400 Subject: [PATCH 1/3] fix root v-else not rendering in production and switched examples to minified vue for better prod coverage --- examples/commits/index.html | 2 +- examples/elastic-header/index.html | 2 +- examples/firebase/index.html | 2 +- examples/grid/index.html | 5 +++-- examples/markdown/index.html | 2 +- examples/modal/index.html | 2 +- examples/move-animations/index.html | 2 +- examples/select2/index.html | 2 +- examples/svg/index.html | 2 +- examples/todomvc/index.html | 2 +- examples/tree/index.html | 2 +- package.json | 2 +- src/compiler/parser/index.js | 8 +++++--- test/e2e/specs/grid.js | 6 ++++++ 14 files changed, 25 insertions(+), 16 deletions(-) diff --git a/examples/commits/index.html b/examples/commits/index.html index a80eaa4604e..40f9e0aaf91 100644 --- a/examples/commits/index.html +++ b/examples/commits/index.html @@ -18,7 +18,7 @@ font-weight: bold; } - +
diff --git a/examples/elastic-header/index.html b/examples/elastic-header/index.html index 63f75fa0246..f0407656d63 100644 --- a/examples/elastic-header/index.html +++ b/examples/elastic-header/index.html @@ -4,7 +4,7 @@ - + diff --git a/examples/firebase/index.html b/examples/firebase/index.html index e8c54bd5a85..d657df79e9c 100644 --- a/examples/firebase/index.html +++ b/examples/firebase/index.html @@ -5,7 +5,7 @@ - + diff --git a/examples/grid/index.html b/examples/grid/index.html index c9d58fd4f69..7887d317c9e 100644 --- a/examples/grid/index.html +++ b/examples/grid/index.html @@ -4,13 +4,13 @@ Vue.js grid component example - + diff --git a/examples/markdown/index.html b/examples/markdown/index.html index 42f228fa7a8..f7167a5d4d0 100644 --- a/examples/markdown/index.html +++ b/examples/markdown/index.html @@ -6,7 +6,7 @@ - + diff --git a/examples/modal/index.html b/examples/modal/index.html index 5f530ab924b..df6540c430a 100644 --- a/examples/modal/index.html +++ b/examples/modal/index.html @@ -3,7 +3,7 @@ Vue.js Modal Example - + diff --git a/examples/move-animations/index.html b/examples/move-animations/index.html index dc0f80e0c28..fd47f5c9ff8 100644 --- a/examples/move-animations/index.html +++ b/examples/move-animations/index.html @@ -29,7 +29,7 @@ } - +
diff --git a/examples/select2/index.html b/examples/select2/index.html index f625c8a5b13..692d3ef150a 100644 --- a/examples/select2/index.html +++ b/examples/select2/index.html @@ -3,7 +3,7 @@ Vue.js custom directive integration example (select2) - + diff --git a/examples/svg/index.html b/examples/svg/index.html index 7b4ca5dbc8e..d201cae85d8 100644 --- a/examples/svg/index.html +++ b/examples/svg/index.html @@ -4,7 +4,7 @@ Vue.js SVG example - + diff --git a/examples/todomvc/index.html b/examples/todomvc/index.html index 063229bc3fe..6672771885f 100644 --- a/examples/todomvc/index.html +++ b/examples/todomvc/index.html @@ -62,7 +62,7 @@

todos

// for testing if (navigator.userAgent.indexOf('PhantomJS') > -1) localStorage.clear() - + diff --git a/examples/tree/index.html b/examples/tree/index.html index 1bb8611ccc3..235c8e487d6 100644 --- a/examples/tree/index.html +++ b/examples/tree/index.html @@ -20,7 +20,7 @@ list-style-type: dot; } - + diff --git a/package.json b/package.json index c16ceefbba4..794bcaa4b03 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "test": "npm run lint && flow check && npm run test:types && npm run test:cover && npm run test:e2e -- --env phantomjs && npm run test:ssr", "test:unit": "karma start build/karma.unit.config.js", "test:cover": "karma start build/karma.cover.config.js", - "test:e2e": "npm run build -- vue.js && node test/e2e/runner.js", + "test:e2e": "npm run build -- vue.min.js && node test/e2e/runner.js", "test:ssr": "npm run build:ssr && VUE_ENV=server jasmine JASMINE_CONFIG_PATH=test/ssr/jasmine.json", "test:sauce": "npm run sauce -- 0 && npm run sauce -- 1 && npm run sauce -- 2", "test:types": "tsc -p ./types/test/tsconfig.json", diff --git a/src/compiler/parser/index.js b/src/compiler/parser/index.js index 4b51151c46c..4978390dd12 100644 --- a/src/compiler/parser/index.js +++ b/src/compiler/parser/index.js @@ -130,14 +130,16 @@ export function parse ( } function checkRootConstraints (el) { - if (process.env.NODE_ENV !== 'production') { + if (process.env.NODE_ENV !== 'production' && !warned) { if (el.tag === 'slot' || el.tag === 'template') { + warned = true warn( `Cannot use <${el.tag}> as component root element because it may ` + 'contain multiple nodes:\n' + template ) } if (el.attrsMap.hasOwnProperty('v-for')) { + warned = true warn( 'Cannot use v-for on stateful component root element because ' + 'it renders multiple elements:\n' + template @@ -150,12 +152,12 @@ export function parse ( if (!root) { root = element checkRootConstraints(root) - } else if (process.env.NODE_ENV !== 'production' && !stack.length && !warned) { + } else if (!stack.length) { // allow 2 root elements with v-if and v-else if (root.if && element.else) { checkRootConstraints(element) root.elseBlock = element - } else { + } else if (process.env.NODE_ENV !== 'production' && !warned) { warned = true warn( `Component template should contain exactly one root element:\n\n${template}` diff --git a/test/e2e/specs/grid.js b/test/e2e/specs/grid.js index ad47c8ff893..7c273359e1b 100644 --- a/test/e2e/specs/grid.js +++ b/test/e2e/specs/grid.js @@ -82,6 +82,12 @@ module.exports = { { name: 'Chuck Norris', power: Infinity } ]) + browser + .clearValue('input[name="query"]') + .assert.count('p', 0) + .setValue('input[name="query"]', 'stringthatdoesnotexistanywhere') + .assert.count('p', 1) + browser.end() function assertTable (data) { From 91ce318f0a7f78fdfa55c2d10ca5e135280ab527 Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Fri, 14 Oct 2016 02:25:02 -0400 Subject: [PATCH 2/3] add dev build comment to examples --- examples/commits/index.html | 1 + examples/elastic-header/index.html | 1 + examples/firebase/index.html | 1 + examples/grid/index.html | 1 + examples/markdown/index.html | 1 + examples/modal/index.html | 1 + examples/move-animations/index.html | 1 + examples/select2/index.html | 1 + examples/svg/index.html | 1 + examples/todomvc/index.html | 3 ++- examples/tree/index.html | 1 + 11 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/commits/index.html b/examples/commits/index.html index 40f9e0aaf91..116fb86f159 100644 --- a/examples/commits/index.html +++ b/examples/commits/index.html @@ -18,6 +18,7 @@ font-weight: bold; } + diff --git a/examples/elastic-header/index.html b/examples/elastic-header/index.html index f0407656d63..81df1c9404e 100644 --- a/examples/elastic-header/index.html +++ b/examples/elastic-header/index.html @@ -4,6 +4,7 @@ + diff --git a/examples/firebase/index.html b/examples/firebase/index.html index d657df79e9c..eee783ac0df 100644 --- a/examples/firebase/index.html +++ b/examples/firebase/index.html @@ -5,6 +5,7 @@ + diff --git a/examples/grid/index.html b/examples/grid/index.html index 7887d317c9e..d668cd76cc5 100644 --- a/examples/grid/index.html +++ b/examples/grid/index.html @@ -4,6 +4,7 @@ Vue.js grid component example + diff --git a/examples/markdown/index.html b/examples/markdown/index.html index f7167a5d4d0..9ca987466ba 100644 --- a/examples/markdown/index.html +++ b/examples/markdown/index.html @@ -6,6 +6,7 @@ + diff --git a/examples/modal/index.html b/examples/modal/index.html index df6540c430a..302e947023d 100644 --- a/examples/modal/index.html +++ b/examples/modal/index.html @@ -3,6 +3,7 @@ Vue.js Modal Example + diff --git a/examples/move-animations/index.html b/examples/move-animations/index.html index fd47f5c9ff8..ae246607b63 100644 --- a/examples/move-animations/index.html +++ b/examples/move-animations/index.html @@ -29,6 +29,7 @@ } + diff --git a/examples/select2/index.html b/examples/select2/index.html index 692d3ef150a..b2344c6e69b 100644 --- a/examples/select2/index.html +++ b/examples/select2/index.html @@ -3,6 +3,7 @@ Vue.js custom directive integration example (select2) + diff --git a/examples/svg/index.html b/examples/svg/index.html index d201cae85d8..faf731dfd71 100644 --- a/examples/svg/index.html +++ b/examples/svg/index.html @@ -4,6 +4,7 @@ Vue.js SVG example + diff --git a/examples/todomvc/index.html b/examples/todomvc/index.html index 6672771885f..84113e7f05c 100644 --- a/examples/todomvc/index.html +++ b/examples/todomvc/index.html @@ -62,7 +62,8 @@

todos

// for testing if (navigator.userAgent.indexOf('PhantomJS') > -1) localStorage.clear() - + + diff --git a/examples/tree/index.html b/examples/tree/index.html index 235c8e487d6..05df32066a9 100644 --- a/examples/tree/index.html +++ b/examples/tree/index.html @@ -20,6 +20,7 @@ list-style-type: dot; } + From 8b6d22fea34c378993f3b566a72d4e17427cb563 Mon Sep 17 00:00:00 2001 From: Chris Fritz Date: Fri, 14 Oct 2016 02:26:07 -0400 Subject: [PATCH 3/3] convert tabs to spaces in todomvc example for consistency --- examples/todomvc/index.html | 126 ++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/examples/todomvc/index.html b/examples/todomvc/index.html index 84113e7f05c..0477f0d014f 100644 --- a/examples/todomvc/index.html +++ b/examples/todomvc/index.html @@ -1,69 +1,69 @@ - - - Vue.js • TodoMVC - - - - - -
-
-

todos

- -
-
- -
    -
  • -
    - - - -
    - -
  • -
-
-
- - {{ remaining }} {{ remaining | pluralize }} left - - - -
-
- + + + Vue.js • TodoMVC + + + + + +
+
+

todos

+ +
+
+ +
    +
  • +
    + + + +
    + +
  • +
+
+
+ + {{ remaining }} {{ remaining | pluralize }} left + + + +
+
+ - + - - + +