6994-vnLog_descriptors #1579

Merged
alexm merged 34 commits from 6994-vnLog_descriptors into dev 2025-03-20 06:58:21 +00:00
2 changed files with 27 additions and 2 deletions
Showing only changes of commit fc549cae97 - Show all commits
src
components/common/__tests__
stores

View File

@ -0,0 +1,26 @@
import { describe, it, expect } from 'vitest';
import VnLogValue from 'src/components/common/VnLogValue.vue';
import { createWrapper } from 'app/test/vitest/helper';
const buildComponent = (props) => {
return createWrapper(VnLogValue, {
props,
global: {},
}).wrapper;
};
describe('VnLogValue', () => {
const id = 1;
it('renders without descriptor', async () => {
expect(getIcon('inventFk').exists()).toBe(false);
});
it('renders with descriptor', async () => {
expect(getIcon('claimFk').text()).toBe('launch');
});
function getIcon(name) {
const wrapper = buildComponent({ value: { val: id }, name });
return wrapper.find('.q-icon');
}
});

View File

@ -2,9 +2,8 @@ import { defineAsyncComponent } from 'vue';
import { defineStore } from 'pinia';
import { useStateStore } from 'stores/useStateStore';
const { descriptors, setDescriptors } = useStateStore();
export const useDescriptorStore = defineStore('descriptorStore', () => {
const { descriptors, setDescriptors } = useStateStore();
function get() {
if (Object.keys(descriptors).length) return descriptors;