Loading appinfo/routes.php +2 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ return [ ['name' => 'settings#getConfig', 'url' => '/v1/config', 'verb' => 'GET'], ['name' => 'settings#setConfig', 'url' => '/v1/config', 'verb' => 'POST'], //Autocompletion ['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'GET'], ['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'GET'], ['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'POST'], ['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'POST'], ['name' => 'proxy#proxy', 'url' => '/v1/proxy', 'verb' => 'GET'], ] Loading js/app/service/autocompletionservice.js +4 −8 Original line number Diff line number Diff line Loading @@ -26,20 +26,16 @@ app.service('AutoCompletionService', ['$rootScope', '$http', 'use strict'; this.searchAttendee = function(name) { return $http.get($rootScope.baseUrl + 'autocompletion/attendee', { params: { return $http.post($rootScope.baseUrl + 'autocompletion/attendee', { search: name } }).then(function (response) { return response.data; }); }; this.searchLocation = function(address) { return $http.get($rootScope.baseUrl + 'autocompletion/location', { params: { return $http.post($rootScope.baseUrl + 'autocompletion/location', { location: address } }).then(function (response) { return response.data; }); Loading tests/js/unit/services/autocompletionServiceSpec.js +8 −4 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ describe('AutoCompletion Service', function () { }); it('should load attendees from the server', function() { http.expect('GET', 'fancy-url/autocompletion/attendee?search=hans+dieter').respond(200, [{ foo: 'bar' }]); var search = 'hans dieter'; AutoCompletionService.searchAttendee('hans dieter').then(function(result) { http.expect('POST', 'fancy-url/autocompletion/attendee', { search: search }).respond(200, [{ foo: 'bar' }]); AutoCompletionService.searchAttendee(search).then(function(result) { expect(result).toEqual([{ foo: 'bar' }]); }); Loading @@ -27,9 +29,11 @@ describe('AutoCompletion Service', function () { }); it('should load locations from the server', function() { http.expect('GET', 'fancy-url/autocompletion/location?location=place+123').respond(200, [{ bar: 'foo' }]); var location = 'place 123'; http.expect('POST', 'fancy-url/autocompletion/location', { location: location }).respond(200, [{ bar: 'foo' }]); AutoCompletionService.searchLocation('place 123').then(function(result) { AutoCompletionService.searchLocation(location).then(function(result) { expect(result).toEqual([{ bar: 'foo' }]); }); Loading Loading
appinfo/routes.php +2 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,8 @@ return [ ['name' => 'settings#getConfig', 'url' => '/v1/config', 'verb' => 'GET'], ['name' => 'settings#setConfig', 'url' => '/v1/config', 'verb' => 'POST'], //Autocompletion ['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'GET'], ['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'GET'], ['name' => 'contact#searchAttendee', 'url' => '/v1/autocompletion/attendee', 'verb' => 'POST'], ['name' => 'contact#searchLocation', 'url' => '/v1/autocompletion/location', 'verb' => 'POST'], ['name' => 'proxy#proxy', 'url' => '/v1/proxy', 'verb' => 'GET'], ] Loading
js/app/service/autocompletionservice.js +4 −8 Original line number Diff line number Diff line Loading @@ -26,20 +26,16 @@ app.service('AutoCompletionService', ['$rootScope', '$http', 'use strict'; this.searchAttendee = function(name) { return $http.get($rootScope.baseUrl + 'autocompletion/attendee', { params: { return $http.post($rootScope.baseUrl + 'autocompletion/attendee', { search: name } }).then(function (response) { return response.data; }); }; this.searchLocation = function(address) { return $http.get($rootScope.baseUrl + 'autocompletion/location', { params: { return $http.post($rootScope.baseUrl + 'autocompletion/location', { location: address } }).then(function (response) { return response.data; }); Loading
tests/js/unit/services/autocompletionServiceSpec.js +8 −4 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ describe('AutoCompletion Service', function () { }); it('should load attendees from the server', function() { http.expect('GET', 'fancy-url/autocompletion/attendee?search=hans+dieter').respond(200, [{ foo: 'bar' }]); var search = 'hans dieter'; AutoCompletionService.searchAttendee('hans dieter').then(function(result) { http.expect('POST', 'fancy-url/autocompletion/attendee', { search: search }).respond(200, [{ foo: 'bar' }]); AutoCompletionService.searchAttendee(search).then(function(result) { expect(result).toEqual([{ foo: 'bar' }]); }); Loading @@ -27,9 +29,11 @@ describe('AutoCompletion Service', function () { }); it('should load locations from the server', function() { http.expect('GET', 'fancy-url/autocompletion/location?location=place+123').respond(200, [{ bar: 'foo' }]); var location = 'place 123'; http.expect('POST', 'fancy-url/autocompletion/location', { location: location }).respond(200, [{ bar: 'foo' }]); AutoCompletionService.searchLocation('place 123').then(function(result) { AutoCompletionService.searchLocation(location).then(function(result) { expect(result).toEqual([{ bar: 'foo' }]); }); Loading