Skip to content

Commit 5c6806f

Browse files
authored
vue-vanilla: Add configurable style class to OneOfRenderer (#2272)
1 parent e06f5e8 commit 5c6806f

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

Diff for: packages/vue-vanilla/src/complex/OneOfRenderer.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div v-if="control.visible">
2+
<div v-if="control.visible" :class="styles.oneOf.root">
33
<combinator-properties
44
:schema="control.schema"
55
combinator-keyword="oneOf"

Diff for: packages/vue-vanilla/src/styles/defaultStyles.ts

+3
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@ export const defaultStyles: Styles = {
5252
buttonPrimary: 'dialog-button-primary',
5353
buttonSecondary: 'dialog-button-secondary',
5454
},
55+
oneOf: {
56+
root: 'one-of',
57+
},
5558
};

Diff for: packages/vue-vanilla/src/styles/styles.ts

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const createEmptyStyles = (): Styles => ({
1111
arrayList: {},
1212
label: {},
1313
dialog: {},
14+
oneOf: {},
1415
});
1516

1617
export interface Styles {
@@ -65,6 +66,9 @@ export interface Styles {
6566
label: {
6667
root?: string;
6768
};
69+
oneOf: {
70+
root?: string;
71+
};
6872
}
6973

7074
export const useStyles = (element?: UISchemaElement) => {

Diff for: packages/vue-vanilla/tests/unit/complex/OneOfRenderer.spec.ts

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ const uischema = {
3434
};
3535

3636
describe('OneOfRenderer.vue', () => {
37+
it('render has a class', () => {
38+
const wrapper = mountJsonForms({ variant: 'b', b: 'b' }, schema, uischema);
39+
expect(wrapper.find('div.one-of').exists()).to.be.true;
40+
});
41+
3742
it('renders select label', () => {
3843
const wrapper = mountJsonForms({ variant: 'b', b: 'b' }, schema, uischema);
3944
expect(wrapper.find('label').text()).to.equal('My Object');

0 commit comments

Comments
 (0)