#5085 restructured unit tests for AutocompleteCtrl

This commit is contained in:
Joy Clark
2015-04-25 23:22:39 +02:00
parent 3458815f28
commit 913afc8f39

View File

@@ -67,21 +67,12 @@ describe('Groups Controller', function() {
});
describe("Autocomplete controller", function() {
beforeEach(module('habitrpg'));
var $controller;
beforeEach(inject(function(_$controller_) {
$controller = _$controller_;
}));
describe("AutocompleteCtrl", function() {
var $scope, controller;
beforeEach(function() {
$scope = {query: undefined, $watch: function(task,fn) {}}; // mock watch function
beforeEach(inject(function($controller) {
$scope = {query: undefined, $watch: function(task,fn) {}}; // mock watch & t function
controller = $controller('AutocompleteCtrl', {$scope: $scope});
})
}));
it('filtering with undefined query (not loaded yet) defaults to true', function() {
expect($scope.filterUser({user: "boo"})).to.be.ok
@@ -101,6 +92,4 @@ describe("Autocomplete controller", function() {
$scope.query = {text: "noprefix"}
expect($scope.filterUser({user: "prefix"})).to.not.be.ok
})
});
});