diff --git a/src/validate/html/index.js b/src/validate/html/index.js index a7feafc42b..09a9816952 100644 --- a/src/validate/html/index.js +++ b/src/validate/html/index.js @@ -23,6 +23,10 @@ export default function validateHtml ( validator, html ) { node.children.forEach( visit ); } + if (node.else ) { + visit( node.else ); + } + if ( node.type === 'Element' ) { elementDepth -= 1; } diff --git a/test/validate.js b/test/validate.js index 4f82cba06b..6708074338 100644 --- a/test/validate.js +++ b/test/validate.js @@ -38,11 +38,13 @@ describe( 'validate', () => { const expectedErrors = tryToLoadJson( `test/validator/${dir}/errors.json` ) || []; const expectedWarnings = tryToLoadJson( `test/validator/${dir}/warnings.json` ) || []; - const expectedNames = tryToLoadJson( `test/validator/${dir}/names.json` ) || []; + const expectedNames = tryToLoadJson( `test/validator/${dir}/names.json` ); assert.deepEqual( errors, expectedErrors ); assert.deepEqual( warnings, expectedWarnings ); - assert.deepEqual( names, expectedNames ); + if ( expectedNames ) { + assert.deepEqual( names, expectedNames ); + } } catch ( err ) { if ( err.name !== 'ParseError' ) throw err; diff --git a/test/validator/names/input.html b/test/validator/names/input.html index a944d5fec0..ba836ddb90 100644 --- a/test/validator/names/input.html +++ b/test/validator/names/input.html @@ -1,3 +1,27 @@ {{#each things as thing, index}} +
{{index}}: {{thing}}
+ +{{else}} + + {{#each things as thingEachElse, indexEachElse}} +{{indexEachElse}}: {{thingEachElse}}
+ {{/each}} + {{/each}} + +{{#if foo}} + +{{elseif bar}} + + {{#each things as thingIfElse, indexIfElse}} +{{indexIfElse}}: {{thingIfElse}}
+ {{/each}} + +{{else}} + + {{#each things as thingElse, indexElse}} +{{indexElse}}: {{thingElse}}
+ {{/each}} + + {{/if}} diff --git a/test/validator/names/names.json b/test/validator/names/names.json index 01151a29fd..e044812999 100644 --- a/test/validator/names/names.json +++ b/test/validator/names/names.json @@ -1,4 +1,10 @@ [ "thing", - "index" + "index", + "thingEachElse", + "indexEachElse", + "thingIfElse", + "indexIfElse", + "thingElse", + "indexElse" ] diff --git a/test/validator/svg-child-component-undeclared-namespace/input.html b/test/validator/svg-child-component-undeclared-namespace/input.html index b9c3fae27b..ab75adcc59 100644 --- a/test/validator/svg-child-component-undeclared-namespace/input.html +++ b/test/validator/svg-child-component-undeclared-namespace/input.html @@ -1 +1,29 @@