[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -51,7 +51,7 @@ define([
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ '$watch' ]
|
||||
['$watch']
|
||||
);
|
||||
mockScope.ngModel = {};
|
||||
mockScope.ngModel.input = 'test input';
|
||||
@@ -61,11 +61,11 @@ define([
|
||||
|
||||
mockSearchService = jasmine.createSpyObj(
|
||||
'searchService',
|
||||
[ 'query' ]
|
||||
['query']
|
||||
);
|
||||
mockPromise = jasmine.createSpyObj(
|
||||
'promise',
|
||||
[ 'then' ]
|
||||
['then']
|
||||
);
|
||||
mockSearchService.query.andReturn(mockPromise);
|
||||
|
||||
@@ -73,11 +73,11 @@ define([
|
||||
|
||||
mockSearchResult = jasmine.createSpyObj(
|
||||
'searchResult',
|
||||
[ '' ]
|
||||
['']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getModel' ]
|
||||
['getModel']
|
||||
);
|
||||
mockSearchResult.object = mockDomainObject;
|
||||
mockDomainObject.getModel.andReturn({name: 'Mock Object', type: 'mock.type'});
|
||||
|
||||
@@ -31,18 +31,18 @@ define(
|
||||
var mockScope,
|
||||
mockTypes,
|
||||
controller;
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "" ]
|
||||
[""]
|
||||
);
|
||||
|
||||
|
||||
mockTypes = [
|
||||
{key: 'mock.type.1', name: 'Mock Type 1', glyph: 'a'},
|
||||
{key: 'mock.type.2', name: 'Mock Type 2', glyph: 'b'}
|
||||
];
|
||||
|
||||
|
||||
mockScope.ngModel = {};
|
||||
mockScope.ngModel.checked = {};
|
||||
mockScope.ngModel.checked['mock.type.1'] = false;
|
||||
@@ -50,75 +50,75 @@ define(
|
||||
mockScope.ngModel.checkAll = true;
|
||||
mockScope.ngModel.filter = jasmine.createSpy('$scope.ngModel.filter');
|
||||
mockScope.ngModel.filtersString = '';
|
||||
|
||||
|
||||
controller = new SearchMenuController(mockScope, mockTypes);
|
||||
});
|
||||
|
||||
|
||||
it("gets types on initiliztion", function () {
|
||||
expect(mockScope.ngModel.types).toBeDefined();
|
||||
});
|
||||
|
||||
|
||||
it("refilters results when options are updated", function () {
|
||||
controller.updateOptions();
|
||||
expect(mockScope.ngModel.filter).toHaveBeenCalled();
|
||||
|
||||
|
||||
controller.checkAll();
|
||||
expect(mockScope.ngModel.filter).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
it("updates the filters string when options are updated", function () {
|
||||
controller.updateOptions();
|
||||
expect(mockScope.ngModel.filtersString).toEqual('');
|
||||
|
||||
|
||||
mockScope.ngModel.checked['mock.type.1'] = true;
|
||||
|
||||
|
||||
controller.updateOptions();
|
||||
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
||||
});
|
||||
|
||||
|
||||
it("changing checkAll status updates the filter string", function () {
|
||||
controller.checkAll();
|
||||
expect(mockScope.ngModel.filtersString).toEqual('');
|
||||
|
||||
|
||||
mockScope.ngModel.checkAll = false;
|
||||
|
||||
|
||||
controller.checkAll();
|
||||
expect(mockScope.ngModel.filtersString).toEqual('NONE');
|
||||
});
|
||||
|
||||
|
||||
it("checking checkAll option resets other options", function () {
|
||||
mockScope.ngModel.checked['mock.type.1'] = true;
|
||||
mockScope.ngModel.checked['mock.type.2'] = true;
|
||||
|
||||
|
||||
controller.checkAll();
|
||||
|
||||
Object.keys(mockScope.ngModel.checked).forEach(function (type) {
|
||||
expect(mockScope.ngModel.checked[type]).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("tells the user when no options are checked", function () {
|
||||
Object.keys(mockScope.ngModel.checked).forEach(function (type) {
|
||||
mockScope.ngModel.checked[type] = false;
|
||||
});
|
||||
mockScope.ngModel.checkAll = false;
|
||||
|
||||
|
||||
controller.updateOptions();
|
||||
|
||||
|
||||
expect(mockScope.ngModel.filtersString).toEqual('NONE');
|
||||
});
|
||||
|
||||
|
||||
it("tells the user when options are checked", function () {
|
||||
mockScope.ngModel.checkAll = false;
|
||||
Object.keys(mockScope.ngModel.checked).forEach(function (type) {
|
||||
mockScope.ngModel.checked[type] = true;
|
||||
});
|
||||
|
||||
|
||||
controller.updateOptions();
|
||||
|
||||
|
||||
expect(mockScope.ngModel.filtersString).not.toEqual('NONE');
|
||||
expect(mockScope.ngModel.filtersString).not.toEqual('');
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user