[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -27,9 +27,9 @@ define(
|
||||
["../src/MCTRepresentation"],
|
||||
function (MCTRepresentation) {
|
||||
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ],
|
||||
LOG_FUNCTIONS = [ "error", "warn", "info", "debug"],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"],
|
||||
LOG_FUNCTIONS = ["error", "warn", "info", "debug"],
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
|
||||
describe("The mct-representation directive", function () {
|
||||
var testRepresentations,
|
||||
@@ -76,7 +76,7 @@ define(
|
||||
key: "def",
|
||||
bundle: { path: "d", resources: "e" },
|
||||
templateUrl: "f/template.html",
|
||||
uses: [ "testCapability", "otherTestCapability" ]
|
||||
uses: ["testCapability", "otherTestCapability"]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -85,7 +85,7 @@ define(
|
||||
key: "uvw",
|
||||
bundle: { path: "u", resources: "v" },
|
||||
templateUrl: "w/template.html",
|
||||
gestures: [ "testGesture", "otherTestGesture" ]
|
||||
gestures: ["testGesture", "otherTestGesture"]
|
||||
},
|
||||
{
|
||||
key: "xyz",
|
||||
@@ -105,7 +105,7 @@ define(
|
||||
var constructor = jasmine.createSpy("Representer" + name),
|
||||
representer = jasmine.createSpyObj(
|
||||
"representer" + name,
|
||||
[ "represent", "destroy" ]
|
||||
["represent", "destroy"]
|
||||
);
|
||||
constructor.andReturn(representer);
|
||||
return constructor;
|
||||
@@ -121,7 +121,7 @@ define(
|
||||
|
||||
mockStatusCapability = jasmine.createSpyObj("statusCapability", ["listen"]);
|
||||
|
||||
mockScope = jasmine.createSpyObj("scope", [ "$watch", "$on" ]);
|
||||
mockScope = jasmine.createSpyObj("scope", ["$watch", "$on"]);
|
||||
mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS);
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ define(
|
||||
["../src/TemplateLinker"],
|
||||
function (TemplateLinker) {
|
||||
|
||||
var JQLITE_METHODS = [ 'replaceWith', 'empty', 'html', 'contents' ],
|
||||
SCOPE_METHODS = [ '$on', '$new', '$destroy' ];
|
||||
var JQLITE_METHODS = ['replaceWith', 'empty', 'html', 'contents'],
|
||||
SCOPE_METHODS = ['$on', '$new', '$destroy'];
|
||||
|
||||
describe("TemplateLinker", function () {
|
||||
var mockTemplateRequest,
|
||||
|
||||
@@ -36,7 +36,7 @@ define(
|
||||
|
||||
mockTemplateLinker = jasmine.createSpyObj(
|
||||
'templateLinker',
|
||||
[ 'getPath', 'load' ]
|
||||
['getPath', 'load']
|
||||
);
|
||||
|
||||
mockTemplateLinker.getPath.andCallFake(function (ext) {
|
||||
|
||||
@@ -28,8 +28,8 @@ define(
|
||||
["../../src/actions/ContextMenuAction"],
|
||||
function (ContextMenuAction) {
|
||||
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ];
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "find", "append", "remove"],
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
|
||||
|
||||
describe("The 'context menu' action", function () {
|
||||
@@ -93,7 +93,7 @@ define(
|
||||
action.perform();
|
||||
expect(mockPopupService.display).toHaveBeenCalledWith(
|
||||
mockMenu,
|
||||
[ mockEvent.pageX, mockEvent.pageY ],
|
||||
[mockEvent.pageX, mockEvent.pageY],
|
||||
jasmine.any(Object)
|
||||
);
|
||||
});
|
||||
@@ -104,7 +104,7 @@ define(
|
||||
});
|
||||
|
||||
it("adds classes to menus based on position", function () {
|
||||
var booleans = [ false, true ];
|
||||
var booleans = [false, true];
|
||||
|
||||
booleans.forEach(function (goLeft) {
|
||||
booleans.forEach(function (goUp) {
|
||||
|
||||
@@ -28,8 +28,8 @@ define(
|
||||
["../../src/gestures/ContextMenuGesture"],
|
||||
function (ContextMenuGesture) {
|
||||
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "find", "append", "remove"],
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
|
||||
|
||||
describe("The 'context menu' gesture", function () {
|
||||
@@ -55,15 +55,15 @@ define(
|
||||
mockEvent = jasmine.createSpyObj("event", ["preventDefault"]);
|
||||
mockContextMenuAction = jasmine.createSpyObj(
|
||||
"action",
|
||||
[ "perform", "getActions" ]
|
||||
["perform", "getActions"]
|
||||
);
|
||||
|
||||
|
||||
mockActionContext = {domainObject: mockDomainObject, event: mockEvent};
|
||||
mockDomainObject.getCapability.andReturn(mockContextMenuAction);
|
||||
mockContextMenuAction.perform.andReturn(jasmine.any(Function));
|
||||
mockAgentService.isMobile.andReturn(false);
|
||||
|
||||
|
||||
|
||||
|
||||
gesture = new ContextMenuGesture(mockTimeout, mockAgentService, mockElement, mockDomainObject);
|
||||
|
||||
// Capture the contextmenu callback
|
||||
@@ -90,7 +90,7 @@ define(
|
||||
mockDomainObject.calls
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it("attaches a callback for context menu events on mobile", function () {
|
||||
// Mock touch event and set to mobile device
|
||||
mockTouchEvent = jasmine.createSpyObj("event", ["preventDefault", "touches"]);
|
||||
@@ -98,21 +98,21 @@ define(
|
||||
mockTouch.length = 1;
|
||||
mockTouchEvent.touches.andReturn(mockTouch);
|
||||
mockAgentService.isMobile.andReturn(true);
|
||||
|
||||
|
||||
// Then create new (mobile) gesture
|
||||
gesture = new ContextMenuGesture(mockTimeout, mockAgentService, mockElement, mockDomainObject);
|
||||
|
||||
|
||||
// Set calls for the touchstart and touchend gestures
|
||||
fireTouchStartGesture = mockElement.on.calls[1].args[1];
|
||||
fireTouchEndGesture = mockElement.on.mostRecentCall.args[1];
|
||||
|
||||
|
||||
// Fire touchstart and expect touch start to begin
|
||||
fireTouchStartGesture(mockTouchEvent);
|
||||
expect(mockElement.on).toHaveBeenCalledWith(
|
||||
"touchstart",
|
||||
jasmine.any(Function)
|
||||
);
|
||||
|
||||
|
||||
// Expect timeout to begin and then fireTouchEnd
|
||||
expect(mockTimeout).toHaveBeenCalled();
|
||||
mockTimeout.mostRecentCall.args[0]();
|
||||
@@ -120,4 +120,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -27,10 +27,10 @@ define(
|
||||
["../../src/gestures/DragGesture", "../../src/gestures/GestureConstants"],
|
||||
function (DragGesture, GestureConstants) {
|
||||
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ],
|
||||
LOG_FUNCTIONS = [ "error", "warn", "info", "debug"],
|
||||
DND_FUNCTIONS = [ "setData", "getData", "removeData" ],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"],
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"],
|
||||
LOG_FUNCTIONS = ["error", "warn", "info", "debug"],
|
||||
DND_FUNCTIONS = ["setData", "getData", "removeData"],
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"],
|
||||
TEST_ID = "test-id";
|
||||
|
||||
|
||||
@@ -135,4 +135,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -29,8 +29,8 @@ define(
|
||||
|
||||
|
||||
// Methods to mock
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr", "scope" ],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"],
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr", "scope"],
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"],
|
||||
TEST_ID = "test-id",
|
||||
DROP_ID = "drop-id";
|
||||
|
||||
@@ -69,9 +69,9 @@ define(
|
||||
mockElement = jasmine.createSpyObj("element", JQLITE_FUNCTIONS);
|
||||
mockDomainObject = jasmine.createSpyObj("domainObject", DOMAIN_OBJECT_METHODS);
|
||||
mockDraggedObject = jasmine.createSpyObj("draggedObject", DOMAIN_OBJECT_METHODS);
|
||||
mockPersistence = jasmine.createSpyObj("persistence", [ "persist" ]);
|
||||
mockPersistence = jasmine.createSpyObj("persistence", ["persist"]);
|
||||
mockEvent = jasmine.createSpyObj("event", ["preventDefault"]);
|
||||
mockEvent.dataTransfer = jasmine.createSpyObj("dataTransfer", [ "getData" ]);
|
||||
mockEvent.dataTransfer = jasmine.createSpyObj("dataTransfer", ["getData"]);
|
||||
mockScope = jasmine.createSpyObj("$scope", ["$broadcast"]);
|
||||
mockUnwrappedElement = jasmine.createSpyObj("unwrapped", ["getBoundingClientRect"]);
|
||||
mockAction = jasmine.createSpyObj('action', ['getActions']);
|
||||
@@ -130,11 +130,11 @@ define(
|
||||
expect(mockEvent.preventDefault).toHaveBeenCalled();
|
||||
expect(mockEvent.dataTransfer.dropEffect).toBeDefined();
|
||||
});
|
||||
|
||||
|
||||
it("invokes compose on drop in edit mode", function () {
|
||||
// Set the mockDomainObject to have the editor capability
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
|
||||
|
||||
callbacks.dragover(mockEvent);
|
||||
expect(mockAction.getActions).toHaveBeenCalledWith({
|
||||
key: 'compose',
|
||||
@@ -143,14 +143,14 @@ define(
|
||||
callbacks.drop(mockEvent);
|
||||
expect(mockCompose.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
it("does not invoke compose on drop in browse mode for non-folders", function () {
|
||||
// Set the mockDomainObject to not have the editor capability
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
// Set the mockDomainObject to not have a type of folder
|
||||
mockDomainObject.getModel.andReturn({type: 'notAFolder'});
|
||||
|
||||
|
||||
callbacks.dragover(mockEvent);
|
||||
expect(mockAction.getActions).toHaveBeenCalledWith({
|
||||
key: 'compose',
|
||||
@@ -159,8 +159,8 @@ define(
|
||||
callbacks.drop(mockEvent);
|
||||
expect(mockCompose.perform).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
it("invokes compose on drop in browse mode for folders", function () {
|
||||
// Set the mockDomainObject to not have the editor capability
|
||||
mockDomainObject.hasCapability.andReturn(false);
|
||||
@@ -175,11 +175,11 @@ define(
|
||||
callbacks.drop(mockEvent);
|
||||
expect(mockCompose.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
it("broadcasts drop position (in edit mode)", function () {
|
||||
// Set the mockDomainObject to have the editor capability
|
||||
mockDomainObject.hasCapability.andReturn(true);
|
||||
|
||||
|
||||
testRect.left = 42;
|
||||
testRect.top = 36;
|
||||
mockEvent.pageX = 52;
|
||||
|
||||
@@ -27,9 +27,9 @@ define(
|
||||
["../../src/gestures/GestureProvider"],
|
||||
function (GestureProvider) {
|
||||
|
||||
var JQLITE_FUNCTIONS = [ "on", "off", "attr", "removeAttr" ],
|
||||
var JQLITE_FUNCTIONS = ["on", "off", "attr", "removeAttr"],
|
||||
GESTURE_KEYS = ["a", "b", "c", "d", "e"],
|
||||
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
DOMAIN_OBJECT_METHODS = ["getId", "getModel", "getCapability", "hasCapability", "useCapability"];
|
||||
|
||||
describe("The gesture provider", function () {
|
||||
var mockGestures,
|
||||
@@ -86,4 +86,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -33,11 +33,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockGestureService = jasmine.createSpyObj(
|
||||
"gestureService",
|
||||
[ "attachGestures" ]
|
||||
["attachGestures"]
|
||||
);
|
||||
mockGestureHandle = jasmine.createSpyObj(
|
||||
"gestureHandle",
|
||||
[ "destroy" ]
|
||||
["destroy"]
|
||||
);
|
||||
|
||||
mockElement = { someKey: "some value" };
|
||||
@@ -62,7 +62,7 @@ define(
|
||||
expect(mockGestureService.attachGestures).toHaveBeenCalledWith(
|
||||
mockElement,
|
||||
domainObject,
|
||||
[ "a", "b", "c" ]
|
||||
["a", "b", "c"]
|
||||
);
|
||||
|
||||
// Should not have been destroyed yet...
|
||||
@@ -77,4 +77,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -35,7 +35,9 @@ define(
|
||||
|
||||
it("allows setting of arbitrary objects", function () {
|
||||
var foo = {
|
||||
bar: function () { return 42; }
|
||||
bar: function () {
|
||||
return 42;
|
||||
}
|
||||
};
|
||||
|
||||
service.setData('xyz', foo);
|
||||
@@ -61,4 +63,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user