Skip to content

Instantly share code, notes, and snippets.

@javaeeeee
Last active February 6, 2017 17:13
Show Gist options
  • Save javaeeeee/403566e62e28a0caced3a6034963e0b2 to your computer and use it in GitHub Desktop.
Save javaeeeee/403566e62e28a0caced3a6034963e0b2 to your computer and use it in GitHub Desktop.
A test for an AngularJS controller that uses Controller As syntax relying on this syntax
describe('HelloController scope tests', function () {
var scope;
beforeEach(function () {
module('app');
inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
$controller('HelloController as vm', { $scope: scope });
});
});
it('should be World', function () {
expect(scope.vm.myModel).toEqual('World');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment