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