Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 7bf70bc

Browse files
committed
test documenting null to object transition bug
1 parent bab99d9 commit 7bf70bc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unit/FirebaseObject.spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,21 @@ describe('$FirebaseObject', function() {
322322
expect($scope.test).toEqual({$value: null, $id: obj.$id, $priority: obj.$priority});
323323
});
324324

325+
it('should delete $value if set to an object', function () {
326+
var $scope = $rootScope.$new();
327+
var obj = makeObject();
328+
obj.$bindTo($scope, 'test');
329+
obj.$$$ready(null);
330+
expect($scope.test).toEqual({$value: null, $id: obj.$id, $priority: obj.$priority});
331+
$scope.$apply(function() {
332+
$scope.test.text = 'hello';
333+
});
334+
$interval.flush(500);
335+
$timeout.flush(); // for $interval
336+
//$timeout.flush(); // for $watch
337+
expect($scope.test).toEqual({text: 'hello', $id: obj.$id, $priority: obj.$priority});
338+
});
339+
325340
it('should update $priority if $priority changed in $scope', function () {
326341
var $scope = $rootScope.$new();
327342
var spy = obj.$inst().$set;

0 commit comments

Comments
 (0)