forked from hflabs/suggestions-jquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff.patch
More file actions
85 lines (82 loc) · 2.89 KB
/
diff.patch
File metadata and controls
85 lines (82 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
diff --git a/src/includes/geolocation.js b/src/includes/geolocation.js
index e735181..af93abd 100644
--- a/src/includes/geolocation.js
+++ b/src/includes/geolocation.js
@@ -28,7 +28,7 @@ var methods = {
that.geoLocation.resolve(providedLocation);
} else {
if (!locationRequest) {
- locationRequest = $.ajax(that.getAjaxParams('iplocate'));
+ locationRequest = $.ajax(that.getAjaxParams('iplocate/address'));
}
locationRequest
diff --git a/src/includes/suggestions.js b/src/includes/suggestions.js
index 776dfd7..1059a1e 100644
--- a/src/includes/suggestions.js
+++ b/src/includes/suggestions.js
@@ -15,12 +15,12 @@ var serviceMethods = {
},
addTypeInUrl: true
},
- 'iplocate': {
+ 'iplocate/address': {
defaultParams: {
type: 'GET',
dataType: 'json'
},
- addTypeInUrl: true
+ addTypeInUrl: false
},
'status': {
defaultParams: {
diff --git a/test/specs/geolocation_spec.js b/test/specs/geolocation_spec.js
index 33bab8e..b8bd6ab 100644
--- a/test/specs/geolocation_spec.js
+++ b/test/specs/geolocation_spec.js
@@ -38,8 +38,47 @@ describe('Geolocation', function () {
expect(this.server.requests[0].url).toContain('iplocate/address');
});
- it('Should send location with request', function () {
+ it('Should send geolocation request for party', function () {
+ $.Suggestions.resetLocation();
+ this.server.requests.length = 0;
+ this.server.respond('GET', /status\/party/, [
+ 200,
+ { 'Content-type': 'application/json' },
+ JSON.stringify({
+ enrich: false,
+ name: "party",
+ search: true,
+ state: "ENABLED"
+ })
+ ]);
+ this.$input.suggestions({
+ serviceUrl: serviceUrl,
+ type: 'PARTY'
+ });
+ expect(this.server.requests[1].url).toContain('iplocate/address');
+ });
+ it('Should send geolocation request for bank', function () {
+ $.Suggestions.resetLocation();
+ this.server.requests.length = 0;
+ this.server.respond('GET', /status\/bank/, [
+ 200,
+ { 'Content-type': 'application/json' },
+ JSON.stringify({
+ enrich: false,
+ name: "bank",
+ search: true,
+ state: "ENABLED"
+ })
+ ]);
+ this.$input.suggestions({
+ serviceUrl: serviceUrl,
+ type: 'BANK'
+ });
+ expect(this.server.requests[1].url).toContain('iplocate/address');
+ });
+
+ it('Should send location with request', function () {
this.server.respond('GET', /iplocate\/address/, [200, { 'Content-type': 'application/json' }, JSON.stringify({
location: {
data: {