-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Changelog: * Feature(frontend): Add to container CSS classes from fields inside NestedObjectField. * Fix(frontend): Remove empty css classes generated for fields values.
- Loading branch information
Showing
10 changed files
with
123 additions
and
18 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
frontend_src/vstutils/fields/__tests__/fields-container-classes.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { expect, test } from '@jest/globals'; | ||
import { createApp, createSchema } from '@/unittests'; | ||
import { useEntityViewClasses } from '@/vstutils/store'; | ||
import { ref } from 'vue'; | ||
import { emptyRepresentData } from '@/vstutils/utils'; | ||
|
||
test('fields container classes', async () => { | ||
const app = await createApp({ schema: createSchema() }); | ||
|
||
const TestModel = app.modelsResolver.bySchemaObject({ | ||
properties: { | ||
some_boolean: { type: 'boolean' }, | ||
some_choice: { type: 'string', enum: ['option1', 'option2'] }, | ||
some_string: { type: 'string' }, | ||
some_object: { | ||
type: 'object', | ||
properties: { | ||
some_boolean: { type: 'boolean' }, | ||
some_choice: { type: 'string', enum: ['option1', 'option2'] }, | ||
some_string: { type: 'string' }, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const data = ref(emptyRepresentData()); | ||
const classes = useEntityViewClasses(ref(TestModel), data); | ||
|
||
expect(classes.value).toStrictEqual([]); | ||
|
||
data.value = { | ||
...emptyRepresentData(), | ||
some_boolean: true, | ||
some_choice: 'option1', | ||
some_string: 'some str', | ||
some_object: { | ||
some_boolean: false, | ||
some_choice: 'option2', | ||
some_string: 'other str', | ||
}, | ||
}; | ||
|
||
expect(classes.value).toStrictEqual([ | ||
'field-some_boolean-true', | ||
'field-some_choice-option1', | ||
'field-some_object-some_boolean-false', | ||
'field-some_object-some_choice-option2', | ||
]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# pylint: disable=django-not-available | ||
__version__: str = '5.8.5' | ||
__version__: str = '5.8.6' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters