[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -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(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -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(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -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(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -62,4 +62,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -48,4 +48,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user