Merge branch 'dev' into 7305-CustomerFiscalDataWarning
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
9cb0292361
14
package.json
14
package.json
|
@ -21,24 +21,24 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@quasar/cli": "^2.3.0",
|
||||
"@quasar/extras": "^1.16.9",
|
||||
"@quasar/extras": "^1.16.14",
|
||||
"axios": "^1.4.0",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"moment": "^2.30.1",
|
||||
"pinia": "^2.1.3",
|
||||
"quasar": "^2.14.5",
|
||||
"quasar": "^2.17.4",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "^4.2.1"
|
||||
"vue": "^3.5.13",
|
||||
"vue-i18n": "^9.3.0",
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.2.1",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@quasar/app-vite": "^1.7.3",
|
||||
"@quasar/app-vite": "^1.11.0",
|
||||
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
|
||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
|
@ -52,7 +52,7 @@
|
|||
"husky": "^8.0.0",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "^2.8.8",
|
||||
"vitest": "^0.31.1"
|
||||
"vitest": "^0.34.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
|
|
1079
pnpm-lock.yaml
1079
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
|||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { createWrapper } from 'app/test/vitest/helper';
|
||||
import VnVisibleColumn from '../VnVisibleColumn.vue';
|
||||
import { axios } from 'app/test/vitest/helper';
|
||||
|
||||
describe('VnVisibleColumns', () => {
|
||||
let wrapper;
|
||||
let vm;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = createWrapper(VnVisibleColumn, {
|
||||
propsData: {
|
||||
tableCode: 'testTable',
|
||||
skip: ['skippedColumn'],
|
||||
},
|
||||
});
|
||||
vm = wrapper.vm;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('setUserConfigViewData()', () => {
|
||||
it('should initialize localColumns with visible configuration', () => {
|
||||
vm.columns = [
|
||||
{ name: 'columnMockName', label: undefined },
|
||||
{ name: 'columnMockAddress', label: undefined },
|
||||
{ name: 'columnMockId', label: undefined },
|
||||
];
|
||||
const configuration = {
|
||||
columnMockName: true,
|
||||
columnMockAddress: false,
|
||||
columnMockId: true,
|
||||
};
|
||||
const expectedColumns = [
|
||||
{ name: 'columnMockName', label: undefined, visible: true },
|
||||
{ name: 'columnMockAddress', label: undefined, visible: false },
|
||||
{ name: 'columnMockId', label: undefined, visible: true },
|
||||
];
|
||||
|
||||
vm.setUserConfigViewData(configuration, false);
|
||||
|
||||
expect(vm.localColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('should skip columns based on props', () => {
|
||||
vm.columns = [
|
||||
{ name: 'columnMockName', label: undefined },
|
||||
{ name: 'columnMockId', label: undefined },
|
||||
{ name: 'skippedColumn', label: 'Skipped Column' },
|
||||
];
|
||||
const configuration = {
|
||||
columnMockName: true,
|
||||
skippedColumn: false,
|
||||
columnMockId: true,
|
||||
};
|
||||
const expectedColumns = [
|
||||
{ name: 'columnMockName', label: undefined, visible: true },
|
||||
{ name: 'columnMockId', label: undefined, visible: true },
|
||||
];
|
||||
|
||||
vm.setUserConfigViewData(configuration, false);
|
||||
|
||||
expect(vm.localColumns).toEqual(expectedColumns);
|
||||
});
|
||||
});
|
||||
|
||||
describe('toggleMarkAll()', () => {
|
||||
it('should set all localColumns to visible=true', () => {
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: false },
|
||||
{ name: 'columnMockId', visible: false },
|
||||
];
|
||||
|
||||
vm.toggleMarkAll(true);
|
||||
|
||||
expect(vm.localColumns.every((col) => col.visible)).toBe(true);
|
||||
});
|
||||
|
||||
it('should set all localColumns to visible=false', () => {
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: true },
|
||||
{ name: 'columnMockId', visible: true },
|
||||
];
|
||||
|
||||
vm.toggleMarkAll(false);
|
||||
|
||||
expect(vm.localColumns.every((col) => col.visible)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('saveConfig()', () => {
|
||||
it('should call setUserConfigViewData and axios.post with correct params', async () => {
|
||||
const mockAxiosPost = vi.spyOn(axios, 'post').mockResolvedValue({
|
||||
data: [{ id: 1 }],
|
||||
});
|
||||
|
||||
vm.localColumns = [
|
||||
{ name: 'columnMockName', visible: true },
|
||||
{ name: 'columnMockId', visible: false },
|
||||
];
|
||||
|
||||
await vm.saveConfig();
|
||||
|
||||
expect(mockAxiosPost).toHaveBeenCalledWith('UserConfigViews/crud', {
|
||||
creates: [
|
||||
{
|
||||
userFk: vm.user.id,
|
||||
tableCode: vm.tableCode,
|
||||
tableConfig: vm.tableCode,
|
||||
configuration: {
|
||||
columnMockName: true,
|
||||
columnMockId: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -299,11 +299,12 @@ defineExpose({
|
|||
:url="$props.model"
|
||||
:user-filter="dmsFilter"
|
||||
:order="['dmsFk DESC']"
|
||||
:auto-load="true"
|
||||
auto-load
|
||||
@on-fetch="setData"
|
||||
>
|
||||
<template #body>
|
||||
<QTable
|
||||
v-if="rows"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
class="full-width q-mt-md"
|
||||
|
|
|
@ -175,7 +175,7 @@ async function fetch() {
|
|||
display: inline-block;
|
||||
}
|
||||
.header.link:hover {
|
||||
color: lighten($primary, 20%);
|
||||
color: rgba(var(--q-primary), 0.8);
|
||||
}
|
||||
.q-checkbox {
|
||||
& .q-checkbox__label {
|
||||
|
|
Loading…
Reference in New Issue