Ocelot-Social/pages/admin/categories.vue
Robert Schäfer 92b06a352c Try write a component test for categories page
@visualjerk could you help us out on this PR? I'm trying to get rid of
this error:
```
Unknown custom element: <ds-table> - did you register the component
correctly? For recursive components, make sure to provide the "name"
option.
```
How do we tell @vue/test-utils to stub globally registered components?

Second, I don't understand why the resulting html() of the categories
components looks so odd:

```
<h1 class="ds-heading ds-heading-h1" space="small" categories="[object Object],[object Object],[object Object],[object Object],[object Object]">
<h3 class="ds-card"><!----> <!----> <!----> <div class="ds-card-content">
  Themen / Kategorien
</div> <!----></h3> <ds-table data="" fields="icon,name,postCount" condensed=""></ds-table></h1>
```
Why on earth does the categories array end up in the `categories`
property of `ds-heading` component?

@visualjerk and @appinteractive have a look, please 😘
2018-12-11 01:36:45 +01:00

55 lines
1.0 KiB
Vue

<template>
<ds-card space="small">
<ds-heading tag="h3">
Themen / Kategorien
</ds-heading>
<ds-table
:data="Category"
:fields="['icon', 'name', 'postCount']"
condensed
>
<template
slot="icon"
slot-scope="scope"
>
<ds-icon :name="scope.row.icon" />
</template>
</ds-table>
</ds-card>
</template>
<script>
import gql from 'graphql-tag'
import DsCard from '@@/components/typography/Heading/Heading.vue'
import DsHeading from '@@/components/layout/Card/Card.vue'
import DsTable from '@@/components/data-display/Table/Table.vue'
export default {
components: {
'ds-card': DsCard,
'ds-heading': DsHeading,
'ds-table': DsTable
},
data() {
return {
Category: []
}
},
apollo: {
Category: {
query: gql(`
query {
Category(orderBy: postCount_desc) {
id
name
slug
icon
postCount
}
}
`)
}
}
}
</script>