JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://searls.github.com/jasmine-all/jasmine-all-min.js"></script>
<script src="https://code.angularjs.org/1.3.0-rc.4/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.0-rc.4/angular-mocks.js"></script>
JavaScript
angular.module('edumatcherApp', [])
.controller('ClassroomsCtrl', function ($scope) {
$scope.subject_list = [];
$scope.$watchCollection('subject_list', function (newValue, oldValue) {
if (newValue !== oldValue) {
console.log('testing');
$scope.test = 'test';
}
});
});
describe('this is a test', function () {
beforeEach(function(){
module('edumatcherApp');
});
it('should set scope.test', function () {
var scope;
inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
var controller = $controller('ClassroomsCtrl', {
$scope: scope
});
});
scope.subject_list.push(1);
scope.$digest();
expect(scope.test).toBeDefined();
});
});