[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -24,7 +24,7 @@ define(
|
||||
['./FixedProxy', './elements/ElementProxies', './FixedDragHandle'],
|
||||
function (FixedProxy, ElementProxies, FixedDragHandle) {
|
||||
|
||||
var DEFAULT_DIMENSIONS = [ 2, 1 ],
|
||||
var DEFAULT_DIMENSIONS = [2, 1],
|
||||
DEFAULT_GRID_SIZE = [64, 16];
|
||||
|
||||
/**
|
||||
@@ -277,7 +277,7 @@ define(
|
||||
if (e.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
if (editableDomainObject){
|
||||
if (editableDomainObject) {
|
||||
$scope.setEditable(editableDomainObject);
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
@@ -26,7 +26,7 @@ define(
|
||||
|
||||
|
||||
// Drag handle dimensions
|
||||
var DRAG_HANDLE_SIZE = [ 6, 6 ];
|
||||
var DRAG_HANDLE_SIZE = [6, 6];
|
||||
|
||||
/**
|
||||
* Template-displayable drag handle for an element in fixed
|
||||
|
||||
@@ -29,9 +29,9 @@ define(
|
||||
['./LayoutDrag'],
|
||||
function (LayoutDrag) {
|
||||
|
||||
var DEFAULT_DIMENSIONS = [ 12, 8 ],
|
||||
DEFAULT_GRID_SIZE = [ 32, 32 ],
|
||||
MINIMUM_FRAME_SIZE = [ 320, 180 ];
|
||||
var DEFAULT_DIMENSIONS = [12, 8],
|
||||
DEFAULT_GRID_SIZE = [32, 32],
|
||||
MINIMUM_FRAME_SIZE = [320, 180];
|
||||
|
||||
/**
|
||||
* The LayoutController is responsible for supporting the
|
||||
@@ -66,7 +66,7 @@ define(
|
||||
if (e.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
if (editableDomainObject){
|
||||
if (editableDomainObject) {
|
||||
$scope.setEditable(editableDomainObject);
|
||||
}
|
||||
// Ensure that configuration field is populated
|
||||
@@ -103,12 +103,12 @@ define(
|
||||
//Keep a track of how many composition callbacks have been made
|
||||
var thisCount = ++callbackCount;
|
||||
|
||||
$scope.domainObject.useCapability('composition').then(function(composition){
|
||||
$scope.domainObject.useCapability('composition').then(function (composition) {
|
||||
var ids;
|
||||
|
||||
//Is this callback for the most recent composition
|
||||
// request? If not, discard it. Prevents race condition
|
||||
if (thisCount === callbackCount){
|
||||
if (thisCount === callbackCount) {
|
||||
ids = composition.map(function (object) {
|
||||
return object.getId();
|
||||
}) || [];
|
||||
|
||||
@@ -54,7 +54,7 @@ define(
|
||||
* @param {Array} elements the full array of elements
|
||||
*/
|
||||
function ElementProxy(element, index, elements) {
|
||||
this.resizeHandles = [ new ResizeHandle(element, 1, 1) ];
|
||||
this.resizeHandles = [new ResizeHandle(element, 1, 1)];
|
||||
|
||||
/**
|
||||
* The element as stored in the view configuration.
|
||||
|
||||
@@ -64,7 +64,7 @@ define(
|
||||
function makeMockDomainObject(id) {
|
||||
var mockObject = jasmine.createSpyObj(
|
||||
'domainObject-' + id,
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
mockObject.getId.andReturn(id);
|
||||
mockObject.getModel.andReturn({ name: "Point " + id});
|
||||
@@ -74,11 +74,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
'$scope',
|
||||
[ "$on", "$watch", "commit" ]
|
||||
["$on", "$watch", "commit"]
|
||||
);
|
||||
mockHandler = jasmine.createSpyObj(
|
||||
'telemetryHandler',
|
||||
[ 'handle' ]
|
||||
['handle']
|
||||
);
|
||||
mockQ = jasmine.createSpyObj('$q', ['when']);
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
@@ -87,11 +87,11 @@ define(
|
||||
);
|
||||
mockFormatter = jasmine.createSpyObj(
|
||||
'telemetryFormatter',
|
||||
[ 'formatDomainValue', 'formatRangeValue' ]
|
||||
['formatDomainValue', 'formatRangeValue']
|
||||
);
|
||||
mockDomainObject = jasmine.createSpyObj(
|
||||
'domainObject',
|
||||
[ 'getId', 'getModel', 'getCapability' ]
|
||||
['getId', 'getModel', 'getCapability']
|
||||
);
|
||||
mockHandle = jasmine.createSpyObj(
|
||||
'subscription',
|
||||
@@ -106,10 +106,10 @@ define(
|
||||
);
|
||||
mockEvent = jasmine.createSpyObj(
|
||||
'event',
|
||||
[ 'preventDefault' ]
|
||||
['preventDefault']
|
||||
);
|
||||
|
||||
testGrid = [ 123, 456 ];
|
||||
testGrid = [123, 456];
|
||||
testModel = {
|
||||
composition: ['a', 'b', 'c'],
|
||||
layoutGrid: testGrid
|
||||
@@ -136,7 +136,7 @@ define(
|
||||
mockScope.configuration = testConfiguration;
|
||||
mockScope.selection = jasmine.createSpyObj(
|
||||
'selection',
|
||||
[ 'select', 'get', 'selected', 'deselect', 'proxy' ]
|
||||
['select', 'get', 'selected', 'deselect', 'proxy']
|
||||
);
|
||||
|
||||
controller = new FixedController(
|
||||
@@ -418,7 +418,7 @@ define(
|
||||
expect(controller.selected().style).toEqual(oldStyle);
|
||||
|
||||
// Drag a little
|
||||
controller.moveHandle().continueDrag([ 1000, 100 ]);
|
||||
controller.moveHandle().continueDrag([1000, 100]);
|
||||
|
||||
// Style should have been updated
|
||||
expect(controller.selected().style).not.toEqual(oldStyle);
|
||||
|
||||
@@ -24,7 +24,7 @@ define(
|
||||
['../src/FixedDragHandle'],
|
||||
function (FixedDragHandle) {
|
||||
|
||||
var TEST_GRID_SIZE = [ 13, 33 ];
|
||||
var TEST_GRID_SIZE = [13, 33];
|
||||
|
||||
describe("A fixed position drag handle", function () {
|
||||
var mockElementHandle,
|
||||
@@ -35,7 +35,7 @@ define(
|
||||
beforeEach(function () {
|
||||
mockElementHandle = jasmine.createSpyObj(
|
||||
'elementHandle',
|
||||
[ 'x', 'y' ]
|
||||
['x', 'y']
|
||||
);
|
||||
mockUpdate = jasmine.createSpy('update');
|
||||
mockCommit = jasmine.createSpy('commit');
|
||||
@@ -61,13 +61,13 @@ define(
|
||||
|
||||
it("allows handles to be dragged", function () {
|
||||
handle.startDrag();
|
||||
handle.continueDrag([ 16, 8 ]);
|
||||
handle.continueDrag([16, 8]);
|
||||
|
||||
// Should update x/y, snapped to grid
|
||||
expect(mockElementHandle.x).toHaveBeenCalledWith(7);
|
||||
expect(mockElementHandle.y).toHaveBeenCalledWith(8);
|
||||
|
||||
handle.continueDrag([ -16, -35 ]);
|
||||
handle.continueDrag([-16, -35]);
|
||||
|
||||
// Should have interpreted relative to initial state
|
||||
expect(mockElementHandle.x).toHaveBeenCalledWith(5);
|
||||
@@ -84,4 +84,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ define(
|
||||
mockComposition,
|
||||
mockCompositionObjects;
|
||||
|
||||
function mockPromise(value){
|
||||
function mockPromise(value) {
|
||||
return {
|
||||
then: function (thenFunc) {
|
||||
return mockPromise(thenFunc(value));
|
||||
@@ -42,12 +42,12 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
function mockDomainObject(id){
|
||||
function mockDomainObject(id) {
|
||||
return {
|
||||
getId: function() {
|
||||
getId: function () {
|
||||
return id;
|
||||
},
|
||||
useCapability: function() {
|
||||
useCapability: function () {
|
||||
return mockCompositionCapability;
|
||||
}
|
||||
};
|
||||
@@ -56,11 +56,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockScope = jasmine.createSpyObj(
|
||||
"$scope",
|
||||
[ "$watch", "$watchCollection", "$on", "commit" ]
|
||||
["$watch", "$watchCollection", "$on", "commit"]
|
||||
);
|
||||
mockEvent = jasmine.createSpyObj(
|
||||
'event',
|
||||
[ 'preventDefault' ]
|
||||
['preventDefault']
|
||||
);
|
||||
|
||||
testModel = {};
|
||||
@@ -238,7 +238,7 @@ define(
|
||||
var styleB;
|
||||
|
||||
// Start with a very small frame size
|
||||
testModel.layoutGrid = [ 1, 1 ];
|
||||
testModel.layoutGrid = [1, 1];
|
||||
|
||||
// White-boxy; we know which watch is which
|
||||
mockScope.$watch.calls[0].args[1](testModel.layoutGrid);
|
||||
@@ -255,7 +255,7 @@ define(
|
||||
var style;
|
||||
|
||||
// Start with a very small frame size
|
||||
testModel.layoutGrid = [ 1, 1 ];
|
||||
testModel.layoutGrid = [1, 1];
|
||||
mockScope.$watch.calls[0].args[1](testModel.layoutGrid);
|
||||
|
||||
// Notify that a drop occurred
|
||||
|
||||
@@ -26,56 +26,56 @@ define(
|
||||
|
||||
describe("A Layout drag handler", function () {
|
||||
var testPosition = {
|
||||
position: [ 8, 11 ],
|
||||
dimensions: [ 3, 2 ]
|
||||
position: [8, 11],
|
||||
dimensions: [3, 2]
|
||||
};
|
||||
|
||||
it("changes position by a supplied factor, rounding by grid size", function () {
|
||||
var handler = new LayoutDrag(
|
||||
testPosition,
|
||||
[ 1, 1 ],
|
||||
[ 0, 0 ],
|
||||
[ 10, 20 ]
|
||||
[1, 1],
|
||||
[0, 0],
|
||||
[10, 20]
|
||||
);
|
||||
|
||||
expect(handler.getAdjustedPosition([ 37, 84 ])).toEqual({
|
||||
position: [ 12, 15 ],
|
||||
dimensions: [ 3, 2 ]
|
||||
expect(handler.getAdjustedPosition([37, 84])).toEqual({
|
||||
position: [12, 15],
|
||||
dimensions: [3, 2]
|
||||
});
|
||||
expect(handler.getAdjustedPosition([ -37, 84 ])).toEqual({
|
||||
position: [ 4, 15 ],
|
||||
dimensions: [ 3, 2 ]
|
||||
expect(handler.getAdjustedPosition([-37, 84])).toEqual({
|
||||
position: [4, 15],
|
||||
dimensions: [3, 2]
|
||||
});
|
||||
});
|
||||
|
||||
it("changes dimensions by a supplied factor, rounding by grid size", function () {
|
||||
var handler = new LayoutDrag(
|
||||
testPosition,
|
||||
[ 0, 0 ],
|
||||
[ 1, 1 ],
|
||||
[ 10, 20 ]
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[10, 20]
|
||||
);
|
||||
|
||||
expect(handler.getAdjustedPosition([ 37, 84 ])).toEqual({
|
||||
position: [ 8, 11 ],
|
||||
dimensions: [ 7, 6 ]
|
||||
expect(handler.getAdjustedPosition([37, 84])).toEqual({
|
||||
position: [8, 11],
|
||||
dimensions: [7, 6]
|
||||
});
|
||||
});
|
||||
|
||||
it("allows mixing dimension and position factors", function () {
|
||||
var handler = new LayoutDrag(
|
||||
testPosition,
|
||||
[ 0, 1 ],
|
||||
[ -1, 0 ],
|
||||
[ 10, 20 ]
|
||||
[0, 1],
|
||||
[-1, 0],
|
||||
[10, 20]
|
||||
);
|
||||
|
||||
expect(handler.getAdjustedPosition([ 11, 84 ])).toEqual({
|
||||
position: [ 8, 15 ],
|
||||
dimensions: [ 2, 2 ]
|
||||
expect(handler.getAdjustedPosition([11, 84])).toEqual({
|
||||
position: [8, 15],
|
||||
dimensions: [2, 2]
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
height: 24,
|
||||
fill: "transparent"
|
||||
};
|
||||
testElements = [ {}, {}, testElement, {} ];
|
||||
testElements = [{}, {}, testElement, {}];
|
||||
proxy = new BoxProxy(
|
||||
testElement,
|
||||
testElements.indexOf(testElement),
|
||||
|
||||
@@ -24,8 +24,8 @@ define(
|
||||
['../../src/elements/ElementFactory'],
|
||||
function (ElementFactory) {
|
||||
|
||||
var DIALOG_ELEMENTS = [ 'image', 'text' ],
|
||||
NON_DIALOG_ELEMENTS = [ 'box', 'line' ];
|
||||
var DIALOG_ELEMENTS = ['image', 'text'],
|
||||
NON_DIALOG_ELEMENTS = ['box', 'line'];
|
||||
|
||||
describe("The fixed position element factory", function () {
|
||||
var mockDialogService,
|
||||
@@ -35,11 +35,11 @@ define(
|
||||
beforeEach(function () {
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
'dialogService',
|
||||
[ 'getUserInput' ]
|
||||
['getUserInput']
|
||||
);
|
||||
mockPromise = jasmine.createSpyObj(
|
||||
'promise',
|
||||
[ 'then' ]
|
||||
['then']
|
||||
);
|
||||
|
||||
mockDialogService.getUserInput.andReturn(mockPromise);
|
||||
@@ -66,4 +66,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
width: 42,
|
||||
height: 24
|
||||
};
|
||||
testElements = [ {}, {}, testElement, {} ];
|
||||
testElements = [{}, {}, testElement, {}];
|
||||
proxy = new ElementProxy(
|
||||
testElement,
|
||||
testElements.indexOf(testElement),
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
height: 24,
|
||||
url: "http://www.nasa.gov"
|
||||
};
|
||||
testElements = [ {}, {}, testElement, {} ];
|
||||
testElements = [{}, {}, testElement, {}];
|
||||
proxy = new ImageProxy(
|
||||
testElement,
|
||||
testElements.indexOf(testElement),
|
||||
|
||||
@@ -70,4 +70,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -92,4 +92,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -75,4 +75,4 @@ define(
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -38,7 +38,7 @@ define(
|
||||
height: 24,
|
||||
id: "test-id"
|
||||
};
|
||||
testElements = [ {}, {}, testElement, {} ];
|
||||
testElements = [{}, {}, testElement, {}];
|
||||
proxy = new TelemetryProxy(
|
||||
testElement,
|
||||
testElements.indexOf(testElement),
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
height: 24,
|
||||
fill: "transparent"
|
||||
};
|
||||
testElements = [ {}, {}, testElement, {} ];
|
||||
testElements = [{}, {}, testElement, {}];
|
||||
proxy = new TextProxy(
|
||||
testElement,
|
||||
testElements.indexOf(testElement),
|
||||
|
||||
Reference in New Issue
Block a user