Skip to content

Commit

Permalink
Merge pull request #1093 from sveltejs/gh-1061-a
Browse files Browse the repository at this point in the history
validate contents of await blocks
  • Loading branch information
Rich-Harris authored Jan 11, 2018
2 parents 664da84 + 5fea63a commit 2537db9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/validate/html/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ export default function validateHtml(validator: Validator, html: Node) {
if (node.else) {
visit(node.else);
}

if (node.type === 'AwaitBlock') {
visit(node.pending);
visit(node.then);
visit(node.catch);
}
}

html.children.forEach(visit);
Expand Down
17 changes: 17 additions & 0 deletions test/validator/samples/await-component-is-used/input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{#await promise}}
<p>Loading</p>
{{then data}}
<Component :data />
{{catch err}}
<p>Error: {{err}}</p>
{{/await}}

<script>
import Component from './Component.html';

export default {
components: {
Component
}
};
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 2537db9

Please sign in to comment.