refs #5673 feat(crudModel): works with null values
gitea/salix-front/pipeline/head This commit looks good
Details
gitea/salix-front/pipeline/head This commit looks good
Details
This commit is contained in:
parent
3a5002b3a7
commit
ea8a7de6d2
|
@ -226,7 +226,7 @@ function getDifferences(obj1, obj2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let key in obj2) {
|
for (let key in obj2) {
|
||||||
if (obj1[key] === undefined && obj2[key]) {
|
if (obj1[key] === undefined || obj1[key] !== obj2[key]) {
|
||||||
diff[key] = obj2[key];
|
diff[key] = obj2[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,5 +63,7 @@ watch(options, (newValue) => {
|
||||||
map-options
|
map-options
|
||||||
use-input
|
use-input
|
||||||
@filter="filterHandler"
|
@filter="filterHandler"
|
||||||
|
clearable
|
||||||
|
clear-icon="close"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -34,7 +34,7 @@ const developmentsFilter = {
|
||||||
|
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'reason',
|
name: 'claimReason',
|
||||||
label: t('Reason'),
|
label: t('Reason'),
|
||||||
field: (row) => row.claimReasonFk,
|
field: (row) => row.claimReasonFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -45,7 +45,7 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'result',
|
name: 'claimResult',
|
||||||
label: t('Result'),
|
label: t('Result'),
|
||||||
field: (row) => row.claimResultFk,
|
field: (row) => row.claimResultFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -56,7 +56,7 @@ const columns = computed(() => [
|
||||||
optionLabel: 'description',
|
optionLabel: 'description',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'responsible',
|
name: 'claimResponsible',
|
||||||
label: t('Responsible'),
|
label: t('Responsible'),
|
||||||
field: (row) => row.claimResponsibleFk,
|
field: (row) => row.claimResponsibleFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -77,7 +77,7 @@ const columns = computed(() => [
|
||||||
optionLabel: 'nickname',
|
optionLabel: 'nickname',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'redelivery',
|
name: 'claimRedelivery',
|
||||||
label: t('Redelivery'),
|
label: t('Redelivery'),
|
||||||
field: (row) => row.claimRedeliveryFk,
|
field: (row) => row.claimRedeliveryFk,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
|
|
@ -95,8 +95,8 @@ describe('CrudModel', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: remove test
|
// TODO: test .onOk()
|
||||||
describe.skip('remove()', () => {
|
describe('remove()', () => {
|
||||||
it('should remove', async () => {
|
it('should remove', async () => {
|
||||||
vi.spyOn(vm.quasar, 'dialog');
|
vi.spyOn(vm.quasar, 'dialog');
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ describe('CrudModel', () => {
|
||||||
{ id: 3, name: 'Bruce Wayne', $index: 3 },
|
{ id: 3, name: 'Bruce Wayne', $index: 3 },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
vm.remove([{ id: 1 }]);
|
await vm.remove([{ id: 1 }]);
|
||||||
|
|
||||||
expect(vm.quasar.dialog).toHaveBeenCalled();
|
expect(vm.quasar.dialog).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@ -125,7 +125,7 @@ describe('CrudModel', () => {
|
||||||
c: 3,
|
c: 3,
|
||||||
};
|
};
|
||||||
const obj2 = {
|
const obj2 = {
|
||||||
a: 1,
|
a: null,
|
||||||
b: 4,
|
b: 4,
|
||||||
d: 5,
|
d: 5,
|
||||||
};
|
};
|
||||||
|
@ -133,6 +133,7 @@ describe('CrudModel', () => {
|
||||||
const result = vm.getDifferences(obj1, obj2);
|
const result = vm.getDifferences(obj1, obj2);
|
||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
|
a: null,
|
||||||
b: 4,
|
b: 4,
|
||||||
d: 5,
|
d: 5,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue