Skip to content

Commit 581cc66

Browse files
authored
Merge pull request #163 from opencloud-eu/chore/remove-component-doc-blocks
chore: remove component doc blocks
2 parents 1bac632 + 533ef8c commit 581cc66

File tree

14 files changed

+327
-871
lines changed

14 files changed

+327
-871
lines changed

packages/design-system/docs/.vitepress/config.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ export default defineConfig({
2121
}
2222
},
2323
plugins: [
24-
// TODO: remove when doc blocks have been removed
25-
{
26-
name: '@opencloud-eu/vite-plugin-docs',
27-
transform(src, id) {
28-
if (id.includes('type=docs')) {
29-
return {
30-
code: 'export default {}',
31-
map: null
32-
}
33-
}
34-
}
35-
},
3624
{
3725
name: '@opencloud-eu/vite-plugin-strip-css',
3826
transform(src, id) {

packages/design-system/docs/.vitepress/theme/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ export default {
1010
const gettext = createGettext()
1111
app.use(gettext)
1212

13-
// TODO: remove `|| c.name` when all components follow the script setup syntax
14-
Object.values(components).forEach((c) => app.component(c.__name || c.name, c))
13+
Object.values(components).forEach((c) => app.component(c.__name, c))
1514
Object.values(directives).forEach((d) => app.directive(d.name, d))
1615
}
1716
}

packages/design-system/src/components/OcSelect/OcSelect.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,6 @@ import { useGettext } from 'vue3-gettext'
108108
import 'vue-select/dist/vue-select.css'
109109
import { ContextualHelper } from '../../helpers'
110110
111-
// the keycode property is deprecated in the JS event API, vue-select still works with it though
112-
enum KeyCode {
113-
Enter = 13,
114-
ArrowDown = 40,
115-
ArrowUp = 38
116-
}
117-
118111
export interface Props {
119112
id?: string
120113
filter?: (items: unknown[], search: string, { label }: { label?: string }) => unknown[]
@@ -135,6 +128,13 @@ export interface Props {
135128
positionFixed?: boolean
136129
}
137130
131+
// the keycode property is deprecated in the JS event API, vue-select still works with it though
132+
enum KeyCode {
133+
Enter = 13,
134+
ArrowDown = 40,
135+
ArrowUp = 38
136+
}
137+
138138
const {
139139
id = uniqueId('oc-select-'),
140140
filter = (items: unknown[], search: string, { label }: { label?: string }) => {

packages/design-system/src/components/OcTable/OcTable.sort.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe('OcTable.sort', () => {
111111
async (name, { sortBy, sortDir, ariaSort }) => {
112112
await wrapper.setProps({
113113
sortBy,
114-
sortDir
114+
sortDir: sortDir as 'asc' | 'desc'
115115
})
116116
expect(headers.at(1).attributes()['aria-sort']).toBe(ariaSort)
117117
}
@@ -124,7 +124,7 @@ describe('OcTable.sort', () => {
124124
props: {
125125
fields: tableFields,
126126
sortBy: tableFieldId.name,
127-
sortDir: tableFieldId.sortDir,
127+
sortDir: tableFieldId.sortDir as 'asc' | 'desc',
128128
data
129129
},
130130
global: {
@@ -171,7 +171,7 @@ describe('OcTable.sort', () => {
171171
fields: tableFields,
172172
data,
173173
sortBy: sortByOld,
174-
sortDir: sortDirOld
174+
sortDir: sortDirOld as 'asc' | 'desc'
175175
},
176176
global: {
177177
plugins: [...defaultPlugins()],

packages/design-system/src/components/OcTable/OcTable.spec.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { shallowMount, mount } from '@opencloud-eu/web-test-helpers'
1+
import { shallowMount, mount, defaultPlugins } from '@opencloud-eu/web-test-helpers'
22
import Table from './OcTable.vue'
33

44
const fields = [
@@ -46,6 +46,7 @@ const data = [
4646
describe('OcTable', () => {
4747
it('displays all field types', () => {
4848
const wrapper = mount(Table, {
49+
global: { plugins: defaultPlugins() },
4950
props: {
5051
fields,
5152
data
@@ -70,6 +71,7 @@ describe('OcTable', () => {
7071

7172
it('hides header', () => {
7273
const wrapper = shallowMount(Table, {
74+
global: { plugins: defaultPlugins() },
7375
props: {
7476
fields,
7577
data,
@@ -82,6 +84,7 @@ describe('OcTable', () => {
8284

8385
it('enables hover effect', () => {
8486
const wrapper = shallowMount(Table, {
87+
global: { plugins: defaultPlugins() },
8588
props: {
8689
fields,
8790
data,
@@ -107,7 +110,7 @@ describe('OcTable', () => {
107110
}
108111
]
109112
},
110-
global: { renderStubDefaultSlot: true }
113+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
111114
})
112115

113116
expect(wrapper.html().indexOf('resource-name')).toBeGreaterThan(-1)
@@ -137,7 +140,7 @@ describe('OcTable', () => {
137140
}
138141
]
139142
},
140-
global: { renderStubDefaultSlot: true }
143+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
141144
})
142145

143146
expect(wrapper.html().indexOf('alignh="right"')).toBeGreaterThan(-1)
@@ -147,6 +150,7 @@ describe('OcTable', () => {
147150

148151
it('adds sticky header', () => {
149152
const wrapper = shallowMount(Table, {
153+
global: { plugins: defaultPlugins() },
150154
props: {
151155
fields,
152156
data,
@@ -164,7 +168,7 @@ describe('OcTable', () => {
164168
data,
165169
highlighted: '4b136c0a-5057-11eb-ac70-eba264112003'
166170
},
167-
global: { renderStubDefaultSlot: true }
171+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
168172
})
169173

170174
expect(wrapper.findAll('.oc-table-highlighted').length).toEqual(1)
@@ -180,7 +184,7 @@ describe('OcTable', () => {
180184
'8468c9f0-5057-11eb-924b-934c6fd827a2'
181185
]
182186
},
183-
global: { renderStubDefaultSlot: true }
187+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
184188
})
185189

186190
expect(wrapper.findAll('.oc-table-highlighted').length).toEqual(2)
@@ -193,7 +197,7 @@ describe('OcTable', () => {
193197
data,
194198
highlighted: []
195199
},
196-
global: { renderStubDefaultSlot: true }
200+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
197201
})
198202
expect(wrapper.html().indexOf('data-item-id')).toBeGreaterThan(-1)
199203
})
@@ -206,7 +210,7 @@ describe('OcTable', () => {
206210
highlighted: [],
207211
itemDomSelector: (item: { id: string }) => ['custom', item.id].join('-')
208212
},
209-
global: { renderStubDefaultSlot: true }
213+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
210214
})
211215
data.forEach((item) => {
212216
expect(wrapper.find(['.oc-tbody-tr-custom', item.id].join('-')).exists()).toBeTruthy()
@@ -220,7 +224,7 @@ describe('OcTable', () => {
220224
data,
221225
highlighted: []
222226
},
223-
global: { renderStubDefaultSlot: true, stubs: { OcTr: false } }
227+
global: { renderStubDefaultSlot: true, stubs: { OcTr: false }, plugins: defaultPlugins() }
224228
})
225229
await wrapper.find('.oc-tbody-tr').trigger('contextmenu')
226230
expect(wrapper.emitted().contextmenuClicked.length).toBe(1)
@@ -234,7 +238,7 @@ describe('OcTable', () => {
234238
highlighted: [],
235239
dragDrop: true
236240
},
237-
global: { renderStubDefaultSlot: true }
241+
global: { renderStubDefaultSlot: true, plugins: defaultPlugins() }
238242
})
239243
expect(wrapper.html().indexOf('draggable')).toBeGreaterThan(-1)
240244
})

0 commit comments

Comments
 (0)