New eslint rules auto fix (#3058)
* no-implicit-coercion and no-unneeded-ternary * End every line with a semicolon * Spacing and formatting * Enabled semi-spacing * Applies npm run lint:fix to code after master merge * Fix merge issues * Switched operator-linebreak to 'before' Co-authored-by: Joshi <simplyrender@gmail.com>
This commit is contained in:
@@ -102,7 +102,7 @@ define(
|
||||
});
|
||||
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
return Boolean(capabilities[name]);
|
||||
});
|
||||
|
||||
capabilities.editor.finish.and.returnValue(mockPromise(true));
|
||||
@@ -123,8 +123,8 @@ define(
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("invokes the editor capability's cancel functionality when" +
|
||||
" performed", function () {
|
||||
it("invokes the editor capability's cancel functionality when"
|
||||
+ " performed", function () {
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 1});
|
||||
//Return true from navigate action
|
||||
capabilities.action.perform.and.returnValue(mockPromise(true));
|
||||
|
||||
@@ -93,7 +93,6 @@ define(
|
||||
action = new EditAndComposeAction(actionContext);
|
||||
});
|
||||
|
||||
|
||||
it("adds to the parent's composition when performed", function () {
|
||||
action.perform();
|
||||
expect(mockComposition.add)
|
||||
@@ -106,8 +105,8 @@ define(
|
||||
expect(mockEditAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("Does not enable edit mode for objects that do not have an" +
|
||||
" edit action", function () {
|
||||
it("Does not enable edit mode for objects that do not have an"
|
||||
+ " edit action", function () {
|
||||
mockActionCapability.getActions.and.returnValue([]);
|
||||
action.perform();
|
||||
expect(mockEditAction.perform).not.toHaveBeenCalled();
|
||||
|
||||
@@ -64,7 +64,10 @@ define(
|
||||
return true;
|
||||
}
|
||||
};
|
||||
context = { someKey: "some value", domainObject: object };
|
||||
context = {
|
||||
someKey: "some value",
|
||||
domainObject: object
|
||||
};
|
||||
dialogService = {
|
||||
getUserInput: function () {
|
||||
return mockPromise(input);
|
||||
|
||||
@@ -138,6 +138,7 @@ define(
|
||||
it("notifies if saving succeeded", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.and.returnValue(Promise.resolve());
|
||||
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.info).toHaveBeenCalled();
|
||||
expect(mockNotificationService.error).not.toHaveBeenCalled();
|
||||
@@ -147,6 +148,7 @@ define(
|
||||
it("notifies if saving failed", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason"));
|
||||
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.error).toHaveBeenCalled();
|
||||
expect(mockNotificationService.info).not.toHaveBeenCalled();
|
||||
|
||||
@@ -97,7 +97,6 @@ define(
|
||||
action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext);
|
||||
});
|
||||
|
||||
|
||||
it("only applies to domain object with an editor capability", function () {
|
||||
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
@@ -42,15 +42,15 @@ define(
|
||||
function noop() {}
|
||||
|
||||
function mockPromise(value) {
|
||||
return (value || {}).then ? value :
|
||||
{
|
||||
return (value || {}).then ? value
|
||||
: {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
},
|
||||
catch: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
} ;
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
@@ -67,7 +67,10 @@ define(
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined});
|
||||
mockDomainObject.getModel.and.returnValue({
|
||||
location: 'a',
|
||||
persisted: undefined
|
||||
});
|
||||
mockDomainObject.getId.and.returnValue(0);
|
||||
|
||||
mockClonedObject = jasmine.createSpyObj(
|
||||
@@ -168,8 +171,8 @@ define(
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("only applies to domain object that has not already been" +
|
||||
" persisted", function () {
|
||||
it("only applies to domain object that has not already been"
|
||||
+ " persisted", function () {
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
|
||||
@@ -118,8 +118,8 @@ define(
|
||||
expect(capability.isEditContextRoot()).toBe(true);
|
||||
});
|
||||
|
||||
it("inEditingContext returns true if parent object is being" +
|
||||
" edited", function () {
|
||||
it("inEditingContext returns true if parent object is being"
|
||||
+ " edited", function () {
|
||||
mockStatusCapability.get.and.returnValue(false);
|
||||
mockParentStatus.get.and.returnValue(false);
|
||||
expect(capability.inEditContext()).toBe(false);
|
||||
@@ -179,8 +179,8 @@ define(
|
||||
capability.edit();
|
||||
capability.finish();
|
||||
});
|
||||
it("returns true if the object has been modified since it" +
|
||||
" was last persisted", function () {
|
||||
it("returns true if the object has been modified since it"
|
||||
+ " was last persisted", function () {
|
||||
mockTransactionService.size.and.returnValue(0);
|
||||
expect(capability.dirty()).toBe(false);
|
||||
mockTransactionService.size.and.returnValue(1);
|
||||
|
||||
@@ -76,15 +76,15 @@ define(
|
||||
);
|
||||
});
|
||||
|
||||
it("if no transaction is active, passes through to persistence" +
|
||||
" provider", function () {
|
||||
it("if no transaction is active, passes through to persistence"
|
||||
+ " provider", function () {
|
||||
mockTransactionManager.isActive.and.returnValue(false);
|
||||
capability.persist();
|
||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("if transaction is active, persist and cancel calls are" +
|
||||
" queued", function () {
|
||||
it("if transaction is active, persist and cancel calls are"
|
||||
+ " queued", function () {
|
||||
mockTransactionManager.isActive.and.returnValue(true);
|
||||
capability.persist();
|
||||
expect(mockTransactionManager.addToTransaction).toHaveBeenCalled();
|
||||
|
||||
@@ -40,6 +40,7 @@ define(
|
||||
mockedSaveActions.forEach(function (action) {
|
||||
action.getMetadata.and.returnValue(mockSaveActionMetadata);
|
||||
});
|
||||
|
||||
return mockedSaveActions;
|
||||
} else if (actionContext.category === "conclude-editing") {
|
||||
return ["a", "b", "c"];
|
||||
|
||||
@@ -54,7 +54,7 @@ define(
|
||||
);
|
||||
|
||||
mockCapabilities = {
|
||||
"editor" : mockEditorCapability,
|
||||
"editor": mockEditorCapability,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
|
||||
@@ -77,7 +77,10 @@ define(
|
||||
|
||||
testViews = [
|
||||
{ key: 'abc' },
|
||||
{ key: 'def', someKey: 'some value' },
|
||||
{
|
||||
key: 'def',
|
||||
someKey: 'some value'
|
||||
},
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ define(
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.and.returnValue('root-id');
|
||||
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
|
||||
controller = new EditPanesController(mockScope);
|
||||
});
|
||||
|
||||
@@ -97,6 +97,7 @@ define(
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.and.returnValue('other-root-id');
|
||||
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ define(
|
||||
);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
mockType.getName.and.returnValue(name);
|
||||
|
||||
return mockType;
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ define(
|
||||
};
|
||||
|
||||
mockPolicyService.allow.and.callFake(function (category, type) {
|
||||
return category === "creation" && mockCreationPolicy(type) ? true : false;
|
||||
return Boolean(category === "creation" && mockCreationPolicy(type));
|
||||
});
|
||||
|
||||
mockTypeService.listTypes.and.returnValue(mockTypes);
|
||||
|
||||
@@ -77,7 +77,7 @@ define(
|
||||
]
|
||||
);
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
return Boolean(capabilities[name]);
|
||||
});
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
@@ -150,8 +150,8 @@ define(
|
||||
expect(mockEditAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses the save-as action if object does not have an edit action" +
|
||||
" available", function () {
|
||||
it("uses the save-as action if object does not have an edit action"
|
||||
+ " available", function () {
|
||||
capabilities.action.getActions.and.returnValue([]);
|
||||
capabilities.action.perform.and.returnValue(mockPromise(undefined));
|
||||
capabilities.editor.save.and.returnValue(promise);
|
||||
|
||||
@@ -45,6 +45,7 @@ define(
|
||||
control: "textfield"
|
||||
});
|
||||
mockProperty.getValue.and.returnValue(name);
|
||||
|
||||
return mockProperty;
|
||||
}
|
||||
|
||||
@@ -120,7 +121,10 @@ define(
|
||||
// Should have gotten a setValue call
|
||||
mockProperties.forEach(function (mockProperty, i) {
|
||||
expect(mockProperty.setValue).toHaveBeenCalledWith(
|
||||
{ someKey: "some value", type: 'test' },
|
||||
{
|
||||
someKey: "some value",
|
||||
type: 'test'
|
||||
},
|
||||
"field " + i
|
||||
);
|
||||
});
|
||||
@@ -188,7 +192,6 @@ define(
|
||||
})).toEqual(false);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -58,7 +58,10 @@ define(
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
mockQ = { when: mockPromise, reject: mockReject };
|
||||
mockQ = {
|
||||
when: mockPromise,
|
||||
reject: mockReject
|
||||
};
|
||||
mockLog = jasmine.createSpyObj(
|
||||
"$log",
|
||||
["error", "warn", "info", "debug"]
|
||||
@@ -113,8 +116,8 @@ define(
|
||||
|
||||
mockNewObject.getId.and.returnValue('newId');
|
||||
mockNewObject.getCapability.and.callFake(function (c) {
|
||||
return c === 'persistence' ?
|
||||
mockNewPersistenceCapability : undefined;
|
||||
return c === 'persistence'
|
||||
? mockNewPersistenceCapability : undefined;
|
||||
});
|
||||
|
||||
mockPersistenceCapability.persist
|
||||
@@ -167,6 +170,7 @@ define(
|
||||
mockDomainObject.getId.and.returnValue(id);
|
||||
mockCompositionCapability.invoke
|
||||
.and.returnValue(mockPromise([mockDomainObject]));
|
||||
|
||||
return mockPromise(mockDomainObject);
|
||||
});
|
||||
|
||||
@@ -207,7 +211,6 @@ define(
|
||||
expect(mockLog.error).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -30,7 +30,6 @@ define([
|
||||
$scope,
|
||||
representer;
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
$log = jasmine.createSpyObj('$log', ['debug']);
|
||||
$scope = {};
|
||||
@@ -84,6 +83,5 @@ define([
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -74,4 +74,3 @@ define(["../../src/services/NestedTransaction"], function (NestedTransaction) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ define(
|
||||
var mockRemove =
|
||||
jasmine.createSpy('remove-' + mockRemoves.length);
|
||||
mockRemoves.push(mockRemove);
|
||||
|
||||
return mockRemove;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user