尝试更改范围值,但未更新
Js档案
$scope.$watch('match.Type', function (newValue) {
if ($scope.match.Type === 'NIGHT') {
$scope.value = false;
} else {
$scope.value = true;
}
});
茉莉
it('should watches match type function', function() {
scope.match= {};
scope.match.Type = '';
describe('DAY', function() {
beforeEach(function() {
scope.match.Type = 'DAY';
scope.$digest();
});
it('DAY', function () {
expect(scope.value).toBe(true);
});
});
describe('NIGHT', function() {
beforeEach(function() {
scope.match.Type = 'NIGHT';
scope.$digest();
});
it('NIGHT', function () {
expect(scope.value).toBe(false);
});
});
})
只更新了一个值,而没有更新第二个值
我是为了jasmine代码和angularjs 请帮我解决这个问题