[Code Style] Run gulp fixstyle

...to apply code style settings from #142.
This commit is contained in:
Victor Woeltjen
2016-05-19 11:29:13 -07:00
parent f12b9704d9
commit fa77139077
440 changed files with 1885 additions and 1662 deletions

View File

@@ -41,13 +41,13 @@ define(
* @constructor
*/
function BrowseController(
$scope,
$route,
$location,
$window,
objectService,
navigationService,
urlService,
$scope,
$route,
$location,
$window,
objectService,
navigationService,
urlService,
policyService,
defaultPath
) {
@@ -80,12 +80,12 @@ define(
function setNavigation(domainObject) {
var navigationAllowed = true;
if (domainObject === $scope.navigatedObject){
if (domainObject === $scope.navigatedObject) {
//do nothing;
return;
}
policyService.allow("navigation", $scope.navigatedObject, domainObject, function(message){
policyService.allow("navigation", $scope.navigatedObject, domainObject, function (message) {
navigationAllowed = $window.confirm(message + "\r\n\r\n" +
" Are you sure you want to continue?");
});

View File

@@ -33,7 +33,7 @@ define(
function BrowseObjectController($scope, $location, $route) {
var navigatedObject;
function setViewForDomainObject(domainObject) {
var locationViewKey = $location.search().view;
function selectViewIfMatching(view) {
@@ -70,7 +70,7 @@ define(
$scope.$watch('domainObject', setViewForDomainObject);
$scope.$watch('representation.selected.key', updateQueryParam);
$scope.doAction = function (action){
$scope.doAction = function (action) {
return $scope[action] && $scope[action]();
};

View File

@@ -45,7 +45,7 @@ define(
/**
* @private
*/
InspectorRegion.prototype.buildRegion = function() {
InspectorRegion.prototype.buildRegion = function () {
var metadataRegion = {
name: 'metadata',
title: 'Metadata Region',

View File

@@ -26,11 +26,11 @@
define(
[],
function () {
/**
* A left-click on the menu arrow should display a
* context menu. This controller launches the context
* menu.
* A left-click on the menu arrow should display a
* context menu. This controller launches the context
* menu.
* @memberof platform/commonUI/browse
* @constructor
*/

View File

@@ -81,13 +81,13 @@ define(
newModel.type = this.type.getKey();
newObject = parentObject.getCapability('instantiation').instantiate(newModel);
newObject.useCapability('mutation', function(model){
newObject.useCapability('mutation', function (model) {
model.location = parentObject.getId();
});
wizard = new CreateWizard(newObject, this.parent, this.policyService);
function populateObjectFromInput (formValue) {
function populateObjectFromInput(formValue) {
return wizard.populateObjectFromInput(formValue, newObject);
}
@@ -99,7 +99,7 @@ define(
});
}
function addToParent (populatedObject) {
function addToParent(populatedObject) {
parentObject.getCapability('composition').add(populatedObject);
return persistAndReturn(parentObject);
}
@@ -125,7 +125,7 @@ define(
* @returns {AddActionMetadata} metadata about this action
*/
AddAction.prototype.getMetadata = function () {
return this.metadata;
return this.metadata;
};
return AddAction;

View File

@@ -101,7 +101,7 @@ define(
return editorCapability.save();
}, function () {
return editorCapability.cancel();
});
});
}
};
@@ -118,7 +118,7 @@ define(
* @returns {CreateActionMetadata} metadata about this action
*/
CreateAction.prototype.getMetadata = function () {
return this.metadata;
return this.metadata;
};
return CreateAction;

View File

@@ -111,12 +111,12 @@ define(
* @param formValue
* @returns {DomainObject}
*/
CreateWizard.prototype.populateObjectFromInput = function(formValue) {
CreateWizard.prototype.populateObjectFromInput = function (formValue) {
var parent = this.getLocation(formValue),
formModel = this.createModel(formValue);
formModel.location = parent.getId();
this.domainObject.useCapability("mutation", function(){
this.domainObject.useCapability("mutation", function () {
return formModel;
});
return this.domainObject;

View File

@@ -40,4 +40,4 @@ define(
return CreationPolicy;
}
);
);

View File

@@ -50,14 +50,14 @@ define(
$scope.rootObject =
(context && context.getRoot()) || $scope.rootObject;
}, 0);
} else if (!contextRoot){
} else if (!contextRoot) {
//If no context root is available, default to the root
// object
$scope.rootObject = undefined;
// Update the displayed tree on a timeout to avoid
// an infinite digest exception.
objectService.getObjects(['ROOT'])
.then(function(objects){
.then(function (objects) {
$timeout(function () {
$scope.rootObject = objects.ROOT;
}, 0);

View File

@@ -78,12 +78,12 @@ define(
mockScope = jasmine.createSpyObj(
"$scope",
[ "$on", "$watch" ]
["$on", "$watch"]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
[ "path" ]
["path"]
);
mockUrlService = jasmine.createSpyObj(
"urlService",
@@ -91,7 +91,7 @@ define(
);
mockObjectService = jasmine.createSpyObj(
"objectService",
[ "getObjects" ]
["getObjects"]
);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
@@ -104,15 +104,15 @@ define(
);
mockRootObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
["getId", "getCapability", "getModel", "useCapability"]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
["getId", "getCapability", "getModel", "useCapability"]
);
mockNextObject = jasmine.createSpyObj(
"nextObject",
[ "getId", "getCapability", "getModel", "useCapability" ]
["getId", "getCapability", "getModel", "useCapability"]
);
mockObjectService.getObjects.andReturn(mockPromise({
@@ -255,7 +255,7 @@ define(
" object", function () {
mockScope.navigatedObject = mockDomainObject;
mockWindow.confirm.andReturn(false);
mockPolicyService.allow.andCallFake(function(category, object, context, callback){
mockPolicyService.allow.andCallFake(function (category, object, context, callback) {
callback("unsaved changes");
return false;
});

View File

@@ -44,12 +44,12 @@ define(
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[ "$on", "$watch" ]
["$on", "$watch"]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
[ "path", "search" ]
["path", "search"]
);
mockUnlisten = jasmine.createSpy("unlisten");
@@ -69,7 +69,7 @@ define(
// Allows the path index to be checked
// prior to setting $route.current
mockLocation.path.andReturn("/browse/");
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();

View File

@@ -40,4 +40,4 @@ define(
});
}
);
);

View File

@@ -26,7 +26,7 @@
define(
["../src/MenuArrowController"],
function (MenuArrowController) {
describe("The menu arrow controller ", function () {
var mockScope,
mockDomainObject,
@@ -34,43 +34,43 @@ define(
mockContextMenuAction,
mockActionContext,
controller;
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[ "" ]
[""]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getCapability" ]
["getCapability"]
);
mockEvent = jasmine.createSpyObj(
"event",
[ "preventDefault" ]
["preventDefault"]
);
mockContextMenuAction = jasmine.createSpyObj(
"action",
[ "perform", "getActions" ]
["perform", "getActions"]
);
mockActionContext = jasmine.createSpyObj(
"actionContext",
[ "" ]
[""]
);
mockActionContext.domainObject = mockDomainObject;
mockActionContext.event = mockEvent;
mockScope.domainObject = mockDomainObject;
mockDomainObject.getCapability.andReturn(mockContextMenuAction);
mockContextMenuAction.perform.andReturn(jasmine.any(Function));
controller = new MenuArrowController(mockScope);
});
it("calls the context menu action when clicked", function () {
// Simulate a click on the menu arrow
controller.showMenu(mockEvent);
// Expect the menu action to be performed
// Expect the menu action to be performed
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('action');
expect(mockContextMenuAction.perform).toHaveBeenCalled();
});

View File

@@ -42,11 +42,11 @@ define(
}
beforeEach(function () {
mockScope = jasmine.createSpyObj("$scope", [ "$on" ]);
mockScope = jasmine.createSpyObj("$scope", ["$on"]);
mockDomainObjects = ['a', 'b'].map(function (id) {
var mockDomainObject = jasmine.createSpyObj(
'domainObject-' + id,
[ 'getId', 'getModel', 'getCapability' ]
['getId', 'getModel', 'getCapability']
);
mockDomainObject.getId.andReturn(id);
@@ -56,7 +56,7 @@ define(
});
mockAgentService = jasmine.createSpyObj(
"agentService",
[ "isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape" ]
["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"]
);
mockWindow = jasmine.createSpyObj("$window", ["open"]);
});

View File

@@ -60,37 +60,37 @@ define(
beforeEach(function () {
mockTypeService = jasmine.createSpyObj(
"typeService",
[ "listTypes" ]
["listTypes"]
);
mockDialogService = jasmine.createSpyObj(
"dialogService",
[ "getUserInput" ]
["getUserInput"]
);
mockPolicyService = jasmine.createSpyObj(
"policyService",
[ "allow" ]
["allow"]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getCapability" ]
["getCapability"]
);
//Mocking getCapability because AddActionProvider uses the
// type capability of the destination object.
mockDomainObject.getCapability.andReturn({});
mockTypes = [ "A", "B", "C" ].map(createMockType);
mockTypes = ["A", "B", "C"].map(createMockType);
mockTypes.forEach(function(type){
mockTypes.forEach(function (type) {
mockPolicyMap[type.getName()] = true;
});
mockCreationPolicy = function(type){
mockCreationPolicy = function (type) {
return mockPolicyMap[type.getName()];
};
mockCompositionPolicy = function(){
mockCompositionPolicy = function () {
return true;
};
@@ -132,4 +132,4 @@ define(
});
});
}
);
);

View File

@@ -59,32 +59,32 @@ define(
beforeEach(function () {
mockTypeService = jasmine.createSpyObj(
"typeService",
[ "listTypes" ]
["listTypes"]
);
mockDialogService = jasmine.createSpyObj(
"dialogService",
[ "getUserInput" ]
["getUserInput"]
);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
[ "setNavigation" ]
["setNavigation"]
);
mockPolicyService = jasmine.createSpyObj(
"policyService",
[ "allow" ]
["allow"]
);
mockTypes = [ "A", "B", "C" ].map(createMockType);
mockTypes = ["A", "B", "C"].map(createMockType);
mockTypes.forEach(function(type){
mockTypes.forEach(function (type) {
mockPolicyMap[type.getName()] = true;
});
mockCreationPolicy = function(type){
mockCreationPolicy = function (type) {
return mockPolicyMap[type.getName()];
};
mockPolicyService.allow.andCallFake(function(category, type){
mockPolicyService.allow.andCallFake(function (category, type) {
return category === "creation" && mockCreationPolicy(type) ? true : false;
});
@@ -126,4 +126,4 @@ define(
});
});
}
);
);

View File

@@ -68,11 +68,11 @@ define(
};
mockDialogService = jasmine.createSpyObj(
"dialogService",
[ "getUserInput" ]
["getUserInput"]
);
mockCreationService = jasmine.createSpyObj(
"creationService",
[ "createObject" ]
["createObject"]
);
mockType.getKey.andReturn("test");
@@ -127,4 +127,4 @@ define(
});
}
);
);

View File

@@ -62,4 +62,4 @@ define(
});
});
}
);
);

View File

@@ -39,7 +39,7 @@ define(
function createMockProperty(name) {
var mockProperty = jasmine.createSpyObj(
"property" + name,
[ "getDefinition", "getValue", "setValue" ]
["getDefinition", "getValue", "setValue"]
);
mockProperty.getDefinition.andReturn({
control: "textfield"
@@ -68,7 +68,7 @@ define(
"getCapability"
]
);
mockProperties = [ "A", "B", "C" ].map(createMockProperty);
mockProperties = ["A", "B", "C"].map(createMockProperty);
mockPolicyService = jasmine.createSpyObj('policyService', ['allow']);
testModel = { someKey: "some value" };
@@ -144,8 +144,8 @@ define(
"A": "ValueA",
"B": "ValueB",
"C": "ValueC"
},
compareModel = wizard.createModel(formValue);
},
compareModel = wizard.createModel(formValue);
wizard.populateObjectFromInput(formValue);
expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function));
expect(mockDomainObject.useCapability.mostRecentCall.args[1]()).toEqual(compareModel);
@@ -179,7 +179,7 @@ define(
});
it("creates a form model without a location if not requested", function () {
expect(wizard.getFormStructure(false).sections.some(function(section){
expect(wizard.getFormStructure(false).sections.some(function (section) {
return section.name === 'Location';
})).toEqual(false);
});

View File

@@ -48,4 +48,4 @@ define(
});
});
}
);
);

View File

@@ -61,23 +61,23 @@ define(
mockQ = { when: mockPromise, reject: mockReject };
mockLog = jasmine.createSpyObj(
"$log",
[ "error", "warn", "info", "debug" ]
["error", "warn", "info", "debug"]
);
mockParentObject = jasmine.createSpyObj(
"parentObject",
[ "getId", "getCapability", "useCapability" ]
["getId", "getCapability", "useCapability"]
);
mockNewObject = jasmine.createSpyObj(
"newObject",
[ "getId", "getCapability", "useCapability" ]
["getId", "getCapability", "useCapability"]
);
mockMutationCapability = jasmine.createSpyObj(
"mutation",
[ "invoke" ]
["invoke"]
);
mockPersistenceCapability = jasmine.createSpyObj(
"persistence",
[ "persist", "getSpace" ]
["persist", "getSpace"]
);
mockCompositionCapability = jasmine.createSpyObj(
"composition",
@@ -100,7 +100,7 @@ define(
};
mockNewPersistenceCapability = jasmine.createSpyObj(
"new-persistence",
[ "persist", "getSpace" ]
["persist", "getSpace"]
);
mockParentObject.getCapability.andCallFake(function (key) {

View File

@@ -40,20 +40,20 @@ define(
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[ "$watch" ]
["$watch"]
);
mockTimeout = jasmine.createSpy("$timeout");
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getCapability" ]
["getCapability"]
);
mockRootObject = jasmine.createSpyObj(
"rootObject",
[ "getCapability" ]
["getCapability"]
);
mockContext = jasmine.createSpyObj(
"context",
[ "getRoot" ]
["getRoot"]
);
mockObjectService = jasmine.createSpyObj(
"objectService",
@@ -73,18 +73,18 @@ define(
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});
describe("when context is available", function () {
describe("when context is available", function () {
beforeEach(function () {
beforeEach(function () {
mockContext.getRoot.andReturn(mockRootObject);
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});
it("adds a treeModel to scope", function () {
it("adds a treeModel to scope", function () {
expect(mockScope.treeModel).toBeDefined();
});
it("watches for changes to treeModel", function () {
it("watches for changes to treeModel", function () {
// This is what the embedded tree representation
// will be modifying.
expect(mockScope.$watch).toHaveBeenCalledWith(
@@ -93,7 +93,7 @@ define(
);
});
it("changes its own model on embedded model updates", function () {
it("changes its own model on embedded model updates", function () {
// Need to pass on selection changes as updates to
// the control's value
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
@@ -107,7 +107,7 @@ define(
.toHaveBeenCalledWith("context");
});
it("rejects changes which fail validation", function () {
it("rejects changes which fail validation", function () {
mockScope.structure = { validate: jasmine.createSpy('validate') };
mockScope.structure.validate.andReturn(false);
@@ -120,10 +120,10 @@ define(
expect(mockScope.ngModel.someField).not.toEqual(mockDomainObject);
});
it("treats a lack of a selection as invalid", function () {
it("treats a lack of a selection as invalid", function () {
mockScope.ngModelController = jasmine.createSpyObj(
'ngModelController',
[ '$setValidity' ]
['$setValidity']
);
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
@@ -136,14 +136,14 @@ define(
expect(mockScope.ngModelController.$setValidity)
.toHaveBeenCalledWith(jasmine.any(String), false);
});
});
describe("when no context is available", function () {
});
describe("when no context is available", function () {
var defaultRoot = "DEFAULT_ROOT";
beforeEach(function () {
mockContext.getRoot.andReturn(undefined);
getObjectsPromise.then.andCallFake(function(callback){
callback({'ROOT':defaultRoot});
getObjectsPromise.then.andCallFake(function (callback) {
callback({'ROOT': defaultRoot});
});
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});

View File

@@ -44,12 +44,12 @@ define(
beforeEach(function () {
mockNavigationService = jasmine.createSpyObj(
"navigationService",
[ "setNavigation" ]
["setNavigation"]
);
mockQ = { when: mockPromise };
mockDomainObject = jasmine.createSpyObj(
"domainObject",
[ "getId", "getModel", "getCapability" ]
["getId", "getModel", "getCapability"]
);
action = new NavigateAction(
@@ -74,4 +74,4 @@ define(
});
}
);
);

View File

@@ -56,4 +56,4 @@ define(
});
}
);
);

View File

@@ -23,7 +23,7 @@
define(
["../../src/windowing/NewTabAction"],
function (NewTabAction) {
describe("The new tab action", function () {
var actionSelected,
actionCurrent,
@@ -37,39 +37,39 @@ define(
// Context if the current object is selected
// For example, when the top right new tab
// button is clicked, the user is using the
// button is clicked, the user is using the
// current domainObject
mockContextCurrent = jasmine.createSpyObj("context", ["domainObject"]);
// Context if the selected object is selected
// For example, when an object in the left
// tree is opened in a new tab using the
// context menu
mockContextSelected = jasmine.createSpyObj("context", ["selectedObject",
"domainObject"]);
// Mocks the urlService used to make the new tab's url from a
// domainObject and mode
mockUrlService = jasmine.createSpyObj("urlService", ["urlForNewTab"]);
// Action done using the current context or mockContextCurrent
actionCurrent = new NewTabAction(mockUrlService, mockWindow,
mockContextCurrent);
// Action done using the selected context or mockContextSelected
actionSelected = new NewTabAction(mockUrlService, mockWindow,
mockContextSelected);
});
it("new tab with current url is opened", function () {
actionCurrent.perform();
});
it("new tab with a selected url is opened", function () {
actionSelected.perform();
});
});
}
);
);

View File

@@ -37,11 +37,11 @@ define(
beforeEach(function () {
mockNavigationService = jasmine.createSpyObj(
'navigationService',
[ 'getNavigation' ]
['getNavigation']
);
mockRootScope = jasmine.createSpyObj(
'$rootScope',
[ '$watch' ]
['$watch']
);
mockDomainObject = jasmine.createSpyObj(
'domainObject',
@@ -75,4 +75,4 @@ define(
});
}
);
);