2225 Prevent location override
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
80a5200281
commit
d082f5d6c2
|
@ -3,8 +3,9 @@ describe('Percentage filter', () => {
|
|||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(_percentageFilter_ => {
|
||||
beforeEach(inject((_percentageFilter_, $translate) => {
|
||||
percentageFilter = _percentageFilter_;
|
||||
jest.spyOn($translate, 'use').mockReturnValue('en-US');
|
||||
}));
|
||||
|
||||
it('should return null for input null', () => {
|
||||
|
|
|
@ -45,6 +45,7 @@ export default class Controller extends Section {
|
|||
const province = selection.province;
|
||||
const postcodes = selection.postcodes;
|
||||
|
||||
if (!this.address.provinceI)
|
||||
this.address.provinceId = province.id;
|
||||
|
||||
if (postcodes.length === 1)
|
||||
|
@ -64,7 +65,10 @@ export default class Controller extends Section {
|
|||
const town = selection.town;
|
||||
const province = town.province;
|
||||
|
||||
if (!this.address.city)
|
||||
this.address.city = town.name;
|
||||
|
||||
if (!this.address.provinceId)
|
||||
this.address.provinceId = province.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,14 +42,14 @@ export default class Controller extends Section {
|
|||
|
||||
// Town auto complete
|
||||
set town(selection) {
|
||||
const oldValue = this._town;
|
||||
this._town = selection;
|
||||
|
||||
if (!oldValue) return;
|
||||
if (!selection) return;
|
||||
|
||||
const province = selection.province;
|
||||
const postcodes = selection.postcodes;
|
||||
|
||||
if (!this.address.provinceFk)
|
||||
this.address.provinceFk = province.id;
|
||||
|
||||
if (postcodes.length === 1)
|
||||
|
@ -62,15 +62,17 @@ export default class Controller extends Section {
|
|||
|
||||
// Postcode auto complete
|
||||
set postcode(selection) {
|
||||
const oldValue = this._postcode;
|
||||
this._postcode = selection;
|
||||
|
||||
if (!oldValue) return;
|
||||
if (!selection) return;
|
||||
|
||||
const town = selection.town;
|
||||
const province = town.province;
|
||||
|
||||
if (!this.address.city)
|
||||
this.address.city = town.name;
|
||||
|
||||
if (!this.address.provinceFk)
|
||||
this.address.provinceFk = province.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ export default class Controller extends Section {
|
|||
|
||||
const country = selection.country;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,10 @@ export default class Controller extends Section {
|
|||
const country = province.country;
|
||||
const postcodes = selection.postcodes;
|
||||
|
||||
if (!this.client.provinceFk)
|
||||
this.client.provinceFk = province.id;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
|
||||
if (postcodes.length === 1)
|
||||
|
@ -65,8 +69,13 @@ export default class Controller extends Section {
|
|||
const province = town.province;
|
||||
const country = province.country;
|
||||
|
||||
if (!this.client.city)
|
||||
this.client.city = town.name;
|
||||
|
||||
if (!this.client.provinceFk)
|
||||
this.client.provinceFk = province.id;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ describe('Client', () => {
|
|||
|
||||
describe('province() setter', () => {
|
||||
it(`should set countryFk property`, () => {
|
||||
controller.client.countryFk = null;
|
||||
controller.province = {
|
||||
id: 1,
|
||||
name: 'New york',
|
||||
|
|
|
@ -98,13 +98,13 @@ export default class Controller extends Section {
|
|||
|
||||
// Province auto complete
|
||||
set province(selection) {
|
||||
const oldValue = this._province;
|
||||
this._province = selection;
|
||||
|
||||
if (!selection || !oldValue) return;
|
||||
if (!selection) return;
|
||||
|
||||
const country = selection.country;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
}
|
||||
|
||||
|
@ -114,16 +114,18 @@ export default class Controller extends Section {
|
|||
|
||||
// Town auto complete
|
||||
set town(selection) {
|
||||
const oldValue = this._town;
|
||||
this._town = selection;
|
||||
|
||||
if (!selection || !oldValue) return;
|
||||
if (!selection) return;
|
||||
|
||||
const province = selection.province;
|
||||
const country = province.country;
|
||||
const postcodes = selection.postcodes;
|
||||
|
||||
if (!this.client.provinceFk)
|
||||
this.client.provinceFk = province.id;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
|
||||
if (postcodes.length === 1)
|
||||
|
@ -145,8 +147,13 @@ export default class Controller extends Section {
|
|||
const province = town.province;
|
||||
const country = province.country;
|
||||
|
||||
if (!this.client.city)
|
||||
this.client.city = town.name;
|
||||
|
||||
if (!this.client.provinceFk)
|
||||
this.client.provinceFk = province.id;
|
||||
|
||||
if (!this.client.countryFk)
|
||||
this.client.countryFk = country.id;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ describe('Client', () => {
|
|||
isTaxDataChecked: false
|
||||
};
|
||||
|
||||
controller.province = {};
|
||||
controller.town = {};
|
||||
controller.postcode = {};
|
||||
controller._province = {};
|
||||
controller._town = {};
|
||||
controller._postcode = {};
|
||||
}));
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
|
@ -135,6 +135,7 @@ describe('Client', () => {
|
|||
|
||||
describe('province() setter', () => {
|
||||
it(`should set countryFk property`, () => {
|
||||
controller.client.countryFk = null;
|
||||
controller.province = {
|
||||
id: 1,
|
||||
name: 'New york',
|
||||
|
|
Loading…
Reference in New Issue