mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 22:45:52 +08:00
test($resource): enhance test-case to verify correct behaviour
Previously, the test-case verified that calling `toJson()`, would remove the `$promise` and `$resolved`, but not that other `$`-prefixed properties would not be removed. Closes #9628
This commit is contained in:
committed by
Igor Minar
parent
8b2f1a47b5
commit
c2fb4b6986
@@ -658,13 +658,15 @@ describe("resource", function() {
|
||||
var cc = CreditCard.get({id: 123});
|
||||
$httpBackend.flush();
|
||||
|
||||
cc.$myProp = 'still here';
|
||||
|
||||
expect(cc.$promise).toBeDefined();
|
||||
expect(cc.$resolved).toBe(true);
|
||||
|
||||
var json = JSON.parse(angular.toJson(cc));
|
||||
expect(json.$promise).not.toBeDefined();
|
||||
expect(json.$resolved).not.toBeDefined();
|
||||
expect(json).toEqual({id: 123, number: '9876'});
|
||||
expect(json).toEqual({id: 123, number: '9876', $myProp: 'still here'});
|
||||
});
|
||||
|
||||
describe('promise api', function() {
|
||||
|
||||
Reference in New Issue
Block a user