Skip to content

Instantly share code, notes, and snippets.

@roll
Last active February 2, 2017 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roll/665bf8cb19e5ec9b4fef52320402807b to your computer and use it in GitHub Desktop.
Save roll/665bf8cb19e5ec9b4fef52320402807b to your computer and use it in GitHub Desktop.
// It's a plain javascript file vue component
// It should work for tests with mocha + JSDom
export default {
props: ['table'],
template: `
<div>
<table class="error">
<thead>
<tr>
<th>Row</th>
<th>Col</th>
<th>Code</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<tr v-for="error of table.errors">
<td>{{ error['row-number'] || 'H' }}</td>
<td>{{ error['column-number'] || '-' }}</td>
<td>{{ error.code }}</td>
<td>{{ error.message }}</td>
</tr>
</tbody>
</table>
</div>
`
}
<script>
// It's a one-file vue component
// It should work for tests with mocha+karma+webpack
// https://vue-loader.vuejs.org/en/workflow/testing.html
export default {
props: ['table'],
}
</script>
<template>
<div>
<table class="error">
<thead>
<tr>
<th>Row</th>
<th>Col</th>
<th>Code</th>
<th>Message</th>
</tr>
</thead>
<tbody>
<tr v-for="error of table.errors">
<td>{{ error['row-number'] || 'H' }}</td>
<td>{{ error['column-number'] || '-' }}</td>
<td>{{ error.code }}</td>
<td>{{ error.message }}</td>
</tr>
</tbody>
</table>
</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment