Como usar variáveis de escopo com a sintaxe “Controller as” no Jasmine?
Eu estou usando jasmine para teste angularJS. Em minhas visualizações, estou usando a sintaxe "Controller as":
<div ng-controller="configCtrl as config">
<div> {{ config.status }} </div>
</div>
Como posso usar essas variáveis "escopo" no jasmim? O que o "Controlador como" se refere? Meu teste parece com o seguinte:
describe('ConfigCtrl', function(){
var scope;
beforeEach(angular.mock.module('busybee'));
beforeEach(angular.mock.inject(function($rootScope){
scope = $rootScope.$new();
$controller('configCtrl', {$scope: scope});
}));
it('should have text = "any"', function(){
expect(scope.status).toBe("any");
});
});
Chamandoscope.status
termina, com certeza, com o erro:
Expected undefined to be "any".
ATUALIZAR: Controller (javascript compilado de TypeScript) se parece com isto:
var ConfigCtrl = (function () {
function ConfigCtrl($scope) {
this.status = "any";
}
ConfigCtrl.$inject = ['$scope'];
return ConfigCtrl;
})();