formations/javascript/angular/exercices/karma/test/ExoControllerSpec.js

30 lines
566 B
JavaScript
Raw Permalink Normal View History

2015-04-10 00:30:02 +02:00
describe('ExoController', function() {
beforeEach(module('myApp'));
var $controller;
beforeEach(inject(function(_$controller_){
$controller = _$controller_;
}));
describe('$scope.add', function() {
it('Il additionne les valeurs $scope.val1 et $scope.val2 et stocke le résultat dans $scope.result', function() {
var $scope = {};
var controller = $controller('ExoCtrl', {$scope: $scope});
$scope.val1 = 2;
$scope.val2 = 4;
$scope.add();
expect($scope.result).toEqual(6);
});
});
});