mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
fix(ngMock): $httpBackend should match data containing Date objects correctly
If a response or expectation contained a date object then `$httpBackend.expect` was not matching correctly. This commit encodes then decodes the object being matched to ensure consistency. Closes #5127
This commit is contained in:
committed by
Peter Bacon Darwin
parent
a7f886e6c8
commit
1025f6ebf4
@@ -929,6 +929,12 @@ describe('$http', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should transform object with date into json', function() {
|
||||
$httpBackend.expect('POST', '/url', {"date": new Date(Date.UTC(2013, 11, 25))}).respond('');
|
||||
$http({method: 'POST', url: '/url', data: {date: new Date(Date.UTC(2013, 11, 25))}});
|
||||
});
|
||||
|
||||
|
||||
it('should ignore strings', function() {
|
||||
$httpBackend.expect('POST', '/url', 'string-data').respond('');
|
||||
$http({method: 'POST', url: '/url', data: 'string-data'});
|
||||
|
||||
Reference in New Issue
Block a user