change Fk to Id
gitea/salix/2122-entry_index This commit looks good
Details
gitea/salix/2122-entry_index This commit looks good
Details
This commit is contained in:
parent
3f978bd32b
commit
6540ef9598
|
@ -76,7 +76,7 @@
|
|||
</vn-card>
|
||||
<vn-travel-descriptor-popover
|
||||
vn-id="travelDescriptor"
|
||||
travel-fk="$ctrl.selectedTravel">
|
||||
travel-id="$ctrl.selectedTravel">
|
||||
</vn-travel-descriptor-popover>
|
||||
<vn-popup vn-id="summary">
|
||||
<vn-entry-summary
|
||||
|
|
|
@ -11,16 +11,16 @@ class Controller extends Component {
|
|||
this._quicklinks = {};
|
||||
}
|
||||
|
||||
set travelFk(travelFk) {
|
||||
if (travelFk == this._travelFk) return;
|
||||
set travelId(travelId) {
|
||||
if (travelId == this._travelId) return;
|
||||
|
||||
this._travelFk = travelFk;
|
||||
this._travelId = travelId;
|
||||
this.travel = null;
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
get travelFk() {
|
||||
return this._travelFk;
|
||||
get travelId() {
|
||||
return this._travelId;
|
||||
}
|
||||
|
||||
get quicklinks() {
|
||||
|
@ -51,7 +51,7 @@ class Controller extends Component {
|
|||
'warehouseOutFk'
|
||||
],
|
||||
where: {
|
||||
id: this._travelFk
|
||||
id: this._travelId
|
||||
},
|
||||
include: [
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ ngModule.component('vnTravelDescriptorPopover', {
|
|||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
travelFk: '<',
|
||||
travelId: '<',
|
||||
quicklinks: '<'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,26 +18,26 @@ describe('travel Component vnTravelDescriptorPopover', () => {
|
|||
controller = $componentController('vnTravelDescriptorPopover', {$scope, $element});
|
||||
}));
|
||||
|
||||
describe('travelFk()', () => {
|
||||
it(`should not apply any changes if the received id is the same stored in _travelFk`, () => {
|
||||
describe('travelId()', () => {
|
||||
it(`should not apply any changes if the received id is the same stored in _travelId`, () => {
|
||||
controller.travel = 'I exist!';
|
||||
controller._travelFk = 1;
|
||||
controller._travelId = 1;
|
||||
spyOn(controller, 'loadData');
|
||||
controller.travelFk = 1;
|
||||
controller.travelId = 1;
|
||||
|
||||
expect(controller.travel).toEqual('I exist!');
|
||||
expect(controller._travelFk).toEqual(1);
|
||||
expect(controller._travelId).toEqual(1);
|
||||
expect(controller.loadData).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it(`should set the received id into _travelFk, set the travel to null and then call loadData()`, () => {
|
||||
it(`should set the received id into _travelId, set the travel to null and then call loadData()`, () => {
|
||||
controller.travel = `Please don't`;
|
||||
controller._travelFk = 1;
|
||||
controller._travelId = 1;
|
||||
spyOn(controller, 'loadData');
|
||||
controller.travelFk = 999;
|
||||
controller.travelId = 999;
|
||||
|
||||
expect(controller.travel).toBeNull();
|
||||
expect(controller._travelFk).toEqual(999);
|
||||
expect(controller._travelId).toEqual(999);
|
||||
expect(controller.loadData).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ describe('travel Component vnTravelDescriptorPopover', () => {
|
|||
|
||||
describe('loadData()', () => {
|
||||
it(`should perform a get query to store the worker data into the controller`, () => {
|
||||
controller.travelFk = 1;
|
||||
controller.travelId = 1;
|
||||
controller.canceler = null;
|
||||
let response = {};
|
||||
|
||||
|
@ -69,7 +69,7 @@ describe('travel Component vnTravelDescriptorPopover', () => {
|
|||
'warehouseOutFk'
|
||||
],
|
||||
where: {
|
||||
id: controller.travelFk
|
||||
id: controller.travelId
|
||||
},
|
||||
include: [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue