I'm trying to test out a case when the select changes and I seem to be having problems - Here's what I have
The test -
describe('Unit: MainCtrl', function() {
// Load the module with MainCtrl
beforeEach(module('myApp'));
var ctrl, scope;
// inject the $controller and $rootScope services
// in the beforeEach block
beforeEach(inject(function($controller, $rootScope) {
// Create a new scope that's a child of the $rootScope
scope = $rootScope.$new();
// Create the controller
ctrl = $controller('MainCtrl', {
$scope: scope
});
}));
it('should create $scope.myPass when type of pass is selected and purchasePass is run',
function() {
expect(scope.myPass).toBeUndefined();
select('itemSelected').option(0);
scope.purchasePass();
expect(scope.myPass).toEqual(5);
});
})
And inside the template I have
<select ng-model="itemSelected" ng-options="item as item.name for item in selectItems"> </select>
And this is giving me back the error -
ReferenceError: Can't find variable: select
Says I don't have variable select, but I am unsure what I am doing wrong to cause this. Would very much appreciate some help. Thanks!