refs #5673 feat(crudModel): works with null values
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-09-18 14:56:14 +02:00
parent 3a5002b3a7
commit ea8a7de6d2
4 changed files with 12 additions and 9 deletions

View File

@ -226,7 +226,7 @@ function getDifferences(obj1, obj2) {
}
}
for (let key in obj2) {
if (obj1[key] === undefined && obj2[key]) {
if (obj1[key] === undefined || obj1[key] !== obj2[key]) {
diff[key] = obj2[key];
}
}

View File

@ -63,5 +63,7 @@ watch(options, (newValue) => {
map-options
use-input
@filter="filterHandler"
clearable
clear-icon="close"
/>
</template>

View File

@ -34,7 +34,7 @@ const developmentsFilter = {
const columns = computed(() => [
{
name: 'reason',
name: 'claimReason',
label: t('Reason'),
field: (row) => row.claimReasonFk,
sortable: true,
@ -45,7 +45,7 @@ const columns = computed(() => [
optionLabel: 'description',
},
{
name: 'result',
name: 'claimResult',
label: t('Result'),
field: (row) => row.claimResultFk,
sortable: true,
@ -56,7 +56,7 @@ const columns = computed(() => [
optionLabel: 'description',
},
{
name: 'responsible',
name: 'claimResponsible',
label: t('Responsible'),
field: (row) => row.claimResponsibleFk,
sortable: true,
@ -77,7 +77,7 @@ const columns = computed(() => [
optionLabel: 'nickname',
},
{
name: 'redelivery',
name: 'claimRedelivery',
label: t('Redelivery'),
field: (row) => row.claimRedeliveryFk,
sortable: true,

View File

@ -95,8 +95,8 @@ describe('CrudModel', () => {
});
});
// TODO: remove test
describe.skip('remove()', () => {
// TODO: test .onOk()
describe('remove()', () => {
it('should remove', async () => {
vi.spyOn(vm.quasar, 'dialog');
@ -111,7 +111,7 @@ describe('CrudModel', () => {
{ id: 3, name: 'Bruce Wayne', $index: 3 },
]);
vm.remove([{ id: 1 }]);
await vm.remove([{ id: 1 }]);
expect(vm.quasar.dialog).toHaveBeenCalled();
});
@ -125,7 +125,7 @@ describe('CrudModel', () => {
c: 3,
};
const obj2 = {
a: 1,
a: null,
b: 4,
d: 5,
};
@ -133,6 +133,7 @@ describe('CrudModel', () => {
const result = vm.getDifferences(obj1, obj2);
expect(result).toEqual({
a: null,
b: 4,
d: 5,
});