[Build] Remove unused variables from specs

...to satisfy JSHint.
This commit is contained in:
Victor Woeltjen 2016-03-04 12:56:14 -08:00
parent e470451718
commit d6ec7e9ab8
48 changed files with 50 additions and 142 deletions

View File

@ -147,8 +147,7 @@ define(
}); });
it("adds new objects to the parent's composition", function () { it("adds new objects to the parent's composition", function () {
var model = { someKey: "some value" }, var model = { someKey: "some value" };
parentModel = { composition: ["notAnyUUID"] };
creationService.createObject(model, mockParentObject); creationService.createObject(model, mockParentObject);
// Verify that a new ID was added // Verify that a new ID was added
@ -199,8 +198,7 @@ define(
it("logs an error when mutaton fails", function () { it("logs an error when mutaton fails", function () {
// If mutation of the parent fails, we've lost the // If mutation of the parent fails, we've lost the
// created object - this is an error. // created object - this is an error.
var model = { someKey: "some value" }, var model = { someKey: "some value" };
parentModel = { composition: ["notAnyUUID"] };
mockCompositionCapability.add.andReturn(mockPromise(false)); mockCompositionCapability.add.andReturn(mockPromise(false));

View File

@ -30,7 +30,6 @@ define(
describe("The navigate action", function () { describe("The navigate action", function () {
var mockNavigationService, var mockNavigationService,
mockQ, mockQ,
actionContext,
mockDomainObject, mockDomainObject,
action; action;

View File

@ -28,7 +28,6 @@ define(
var actionSelected, var actionSelected,
actionCurrent, actionCurrent,
mockWindow, mockWindow,
mockDomainObject,
mockContextCurrent, mockContextCurrent,
mockContextSelected, mockContextSelected,
mockUrlService; mockUrlService;

View File

@ -26,7 +26,7 @@ define(
describe("Properties dialog", function () { describe("Properties dialog", function () {
var type, properties, domainObject, model, dialog; var type, properties, model, dialog;
beforeEach(function () { beforeEach(function () {
type = { type = {

View File

@ -93,8 +93,7 @@ define(
}); });
it("exposes a warning message for unload", function () { it("exposes a warning message for unload", function () {
var obj = mockObject, var errorMessage = "Unsaved changes";
errorMessage = "Unsaved changes";
// Normally, should be undefined // Normally, should be undefined
expect(controller.getUnloadWarning()).toBeUndefined(); expect(controller.getUnloadWarning()).toBeUndefined();

View File

@ -28,7 +28,6 @@ define(
var captured, var captured,
completionCapability, completionCapability,
object,
mockQ, mockQ,
mockType, mockType,
cache; cache;
@ -45,7 +44,7 @@ define(
type: mockType type: mockType
}[key]; }[key];
}, },
hasCapability: function (key) { hasCapability: function () {
return false; return false;
} }
}; };

View File

@ -25,7 +25,11 @@ define(
function (EditableDomainObject) { function (EditableDomainObject) {
describe("Editable domain object", function () { describe("Editable domain object", function () {
var object;
beforeEach(function () {
object = new EditableDomainObject();
});
}); });
} }
); );

View File

@ -25,8 +25,7 @@ define(
function (EditableViewPolicy) { function (EditableViewPolicy) {
describe("The editable view policy", function () { describe("The editable view policy", function () {
var testView, var mockDomainObject,
mockDomainObject,
testMode, testMode,
policy; policy;

View File

@ -147,7 +147,7 @@ define(
}); });
it("invokes setters on update", function () { it("invokes setters on update", function () {
var structure, state; var structure;
testABC.a = jasmine.createSpy('a'); testABC.a = jasmine.createSpy('a');

View File

@ -28,7 +28,6 @@ define(
describe("The FormatProvider", function () { describe("The FormatProvider", function () {
var mockFormats, var mockFormats,
mockLog,
mockFormatInstances, mockFormatInstances,
provider; provider;

View File

@ -40,14 +40,6 @@ define(
testRect, testRect,
mctPopup; mctPopup;
function testEvent(x, y) {
return {
pageX: x,
pageY: y,
preventDefault: jasmine.createSpy("preventDefault")
};
}
beforeEach(function () { beforeEach(function () {
mockCompile = mockCompile =
jasmine.createSpy("$compile"); jasmine.createSpy("$compile");

View File

@ -21,8 +21,8 @@
*****************************************************************************/ *****************************************************************************/
define( define(
['../../src/services/InfoService', '../../src/InfoConstants'], ['../../src/services/InfoService'],
function (InfoService, InfoConstants) { function (InfoService) {
describe("The info service", function () { describe("The info service", function () {
var mockCompile, var mockCompile,

View File

@ -27,7 +27,8 @@ define(
describe("The notification indicator controller ", function () { describe("The notification indicator controller ", function () {
var mockNotificationService, var mockNotificationService,
mockScope, mockScope,
mockDialogService; mockDialogService,
controller;
beforeEach(function(){ beforeEach(function(){
mockNotificationService = jasmine.createSpy("notificationService"); mockNotificationService = jasmine.createSpy("notificationService");
@ -36,19 +37,18 @@ define(
"dialogService", "dialogService",
["getDialogResponse","dismiss"] ["getDialogResponse","dismiss"]
); );
});
it("exposes the highest notification severity to the template", function() {
mockNotificationService.highest = { mockNotificationService.highest = {
severity: "error" severity: "error"
}; };
var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService); controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService);
});
it("exposes the highest notification severity to the template", function() {
expect(mockScope.highest).toBeTruthy(); expect(mockScope.highest).toBeTruthy();
expect(mockScope.highest.severity).toBe("error"); expect(mockScope.highest.severity).toBe("error");
}); });
it("invokes the dialog service to show list of messages", function() { it("invokes the dialog service to show list of messages", function() {
var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService);
expect(mockScope.showNotificationsList).toBeDefined(); expect(mockScope.showNotificationsList).toBeDefined();
mockScope.showNotificationsList(); mockScope.showNotificationsList();
expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled();
@ -61,7 +61,6 @@ define(
}); });
it("provides a means of dismissing the message list", function() { it("provides a means of dismissing the message list", function() {
var controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService);
expect(mockScope.showNotificationsList).toBeDefined(); expect(mockScope.showNotificationsList).toBeDefined();
mockScope.showNotificationsList(); mockScope.showNotificationsList();
expect(mockDialogService.getDialogResponse).toHaveBeenCalled(); expect(mockDialogService.getDialogResponse).toHaveBeenCalled();

View File

@ -39,7 +39,7 @@ define(
[ 'getCapabilities' ] [ 'getCapabilities' ]
); );
// Both types can only contain b, let's say // Both types can only contain b, let's say
mockTypes = ['a', 'b'].map(function (type, index) { mockTypes = ['a', 'b'].map(function (type) {
var mockType = jasmine.createSpyObj( var mockType = jasmine.createSpyObj(
'type-' + type, 'type-' + type,
['getKey', 'getDefinition', 'getInitialModel'] ['getKey', 'getDefinition', 'getInitialModel']

View File

@ -60,7 +60,7 @@ define(
}); });
it("allows setting a model", function () { it("allows setting a model", function () {
mutation.invoke(function (m) { mutation.invoke(function () {
return { someKey: "some value" }; return { someKey: "some value" };
}); });
expect(testModel.number).toBeUndefined(); expect(testModel.number).toBeUndefined();

View File

@ -106,8 +106,6 @@ define(
it("avoids redundant requests", function () { it("avoids redundant requests", function () {
// Lookups can be expensive, so this capability // Lookups can be expensive, so this capability
// should have some self-caching // should have some self-caching
var response;
mockDomainObject.getModel mockDomainObject.getModel
.andReturn({ relationships: { xyz: ['a'] } }); .andReturn({ relationships: { xyz: ['a'] } });
@ -123,7 +121,7 @@ define(
it("makes new requests on modification", function () { it("makes new requests on modification", function () {
// Lookups can be expensive, so this capability // Lookups can be expensive, so this capability
// should have some self-caching // should have some self-caching
var response, testModel; var testModel;
testModel = { relationships: { xyz: ['a'] } }; testModel = { relationships: { xyz: ['a'] } };

View File

@ -34,7 +34,7 @@ define(
}); });
describe("when space is encoded", function () { describe("when space is encoded", function () {
var idSpace, idKey, spacedId; var idSpace, idKey;
beforeEach(function () { beforeEach(function () {
idSpace = "a-specific-space"; idSpace = "a-specific-space";

View File

@ -46,12 +46,6 @@ define(
}; };
} }
function mockAll(mockPromises) {
return mockPromise(mockPromises.map(function (p) {
return mockPromise(p).testValue;
}));
}
beforeEach(function () { beforeEach(function () {
mockModelService = jasmine.createSpyObj( mockModelService = jasmine.createSpyObj(
"modelService", "modelService",

View File

@ -30,8 +30,6 @@ define(
mockIdentifierService, mockIdentifierService,
mockCapabilityConstructor, mockCapabilityConstructor,
mockCapabilityInstance, mockCapabilityInstance,
mockCapabilities,
mockIdentifier,
idCounter, idCounter,
testModel, testModel,
instantiate, instantiate,

View File

@ -26,13 +26,7 @@ define(
describe("Type provider", function () { describe("Type provider", function () {
var captured = {}, var testTypeDefinitions = [
capture = function (name) {
return function (value) {
captured[name] = value;
};
},
testTypeDefinitions = [
{ {
key: 'basic', key: 'basic',
glyph: "X", glyph: "X",

View File

@ -133,8 +133,7 @@ define(
}); });
it("enforces view restrictions from types", function () { it("enforces view restrictions from types", function () {
var testType = "testType", var testView = { key: "x" },
testView = { key: "x" },
provider = new ViewProvider([testView], mockLog); provider = new ViewProvider([testView], mockLog);
// Include a "type" capability // Include a "type" capability

View File

@ -32,8 +32,7 @@ define(
var testContext, var testContext,
testModel, testModel,
testId, testId,
mockLocationCapability, mockLocationCapability;
mockContextCapability;
beforeEach(function () { beforeEach(function () {
testId = "some-id"; testId = "some-id";

View File

@ -124,10 +124,8 @@ define(
var mockQ, var mockQ,
mockDeferred, mockDeferred,
creationService,
createObjectPromise, createObjectPromise,
copyService, copyService,
mockNow,
object, object,
newParent, newParent,
copyResult, copyResult,
@ -172,7 +170,7 @@ define(
'mockDeferred', 'mockDeferred',
['notify', 'resolve', 'reject'] ['notify', 'resolve', 'reject']
); );
mockDeferred.notify.andCallFake(function(notification){}); mockDeferred.notify.andCallFake(function(){});
mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;}); mockDeferred.resolve.andCallFake(function(value){resolvedValue = value;});
mockDeferred.promise = { mockDeferred.promise = {
then: function(callback){ then: function(callback){
@ -271,8 +269,7 @@ define(
}); });
describe("on domainObject with composition", function () { describe("on domainObject with composition", function () {
var newObject, var childObject,
childObject,
objectClone, objectClone,
childObjectClone, childObjectClone,
compositionPromise; compositionPromise;

View File

@ -187,8 +187,7 @@ define(
describe("copies object trees with multiple references to the" + describe("copies object trees with multiple references to the" +
" same object", function () { " same object", function () {
var model, var mockDomainObjectB,
mockDomainObjectB,
mockComposingObject, mockComposingObject,
composingObjectModel, composingObjectModel,
domainObjectClone, domainObjectClone,
@ -252,9 +251,7 @@ define(
it(" and correctly updates child identifiers in object" + it(" and correctly updates child identifiers in object" +
" arrays within models ", function () { " arrays within models ", function () {
var childA_ID = task.clones[0].getId(), var childA_ID = task.clones[0].getId(),
childB_ID = task.clones[1].getId(), childB_ID = task.clones[1].getId();
childC_ID = task.clones[3].getId(),
childD_ID = task.clones[4].getId();
expect(domainObjectClone.model.objArr[0].id).not.toBe(ID_A); expect(domainObjectClone.model.objArr[0].id).not.toBe(ID_A);
expect(domainObjectClone.model.objArr[0].id).toBe(childA_ID); expect(domainObjectClone.model.objArr[0].id).toBe(childA_ID);

View File

@ -31,7 +31,6 @@ define(
var mockScope, var mockScope,
mockTicker, mockTicker,
mockUnticker, mockUnticker,
mockDomainObject,
controller; controller;
beforeEach(function () { beforeEach(function () {

View File

@ -45,10 +45,6 @@ define(
].reduce(sum, 0); ].reduce(sum, 0);
} }
function twoDigits(n) {
return n < 10 ? ('0' + n) : n;
}
it("formats short-form values (no days)", function () { it("formats short-form values (no days)", function () {
expect(formatter.short(toDuration(0, 123, 2, 3) + 123)) expect(formatter.short(toDuration(0, 123, 2, 3) + 123))
.toEqual("123:02:03"); .toEqual("123:02:03");

View File

@ -33,16 +33,6 @@ define(
mockSeries, mockSeries,
decorator; decorator;
function seriesIsInWindow(series) {
var i, v, inWindow = true;
for (i = 0; i < series.getPointCount(); i += 1) {
v = series.getDomainValue(i);
inWindow = inWindow && (v >= mockConductor.displayStart());
inWindow = inWindow && (v <= mockConductor.displayEnd());
}
return inWindow;
}
beforeEach(function () { beforeEach(function () {
mockTelemetryService = jasmine.createSpyObj( mockTelemetryService = jasmine.createSpyObj(
'telemetryService', 'telemetryService',

View File

@ -30,7 +30,6 @@ define(
describe("The messages view policy", function () { describe("The messages view policy", function () {
var mockDomainObject, var mockDomainObject,
mockTelemetry, mockTelemetry,
telemetryType,
testType, testType,
testView, testView,
testMetadata, testMetadata,
@ -50,7 +49,7 @@ define(
['getMetadata'] ['getMetadata']
); );
mockDomainObject.getModel.andCallFake(function (c) { mockDomainObject.getModel.andCallFake(function () {
return {type: testType}; return {type: testType};
}); });
mockDomainObject.getCapability.andCallFake(function (c) { mockDomainObject.getCapability.andCallFake(function (c) {

View File

@ -235,7 +235,7 @@ define(
}); });
it("ensures a minimum frame size", function () { it("ensures a minimum frame size", function () {
var styleB, styleC; var styleB;
// Start with a very small frame size // Start with a very small frame size
testModel.layoutGrid = [ 1, 1 ]; testModel.layoutGrid = [ 1, 1 ];

View File

@ -32,7 +32,6 @@ define(
mockCompositionCapability, mockCompositionCapability,
mockComposition, mockComposition,
mockUnlisten, mockUnlisten,
mockFormUnlisten,
mockChildOne, mockChildOne,
mockChildTwo, mockChildTwo,
model, model,

View File

@ -25,8 +25,7 @@ define(
function (PlotOptionsForm) { function (PlotOptionsForm) {
describe("The Plot Options form", function () { describe("The Plot Options form", function () {
var plotOptionsForm, var plotOptionsForm;
listener;
beforeEach(function () { beforeEach(function () {

View File

@ -29,7 +29,6 @@ define(
testRange, testRange,
mockTelemetryObjects, mockTelemetryObjects,
testData, testData,
mockLimitCapabilities,
tracker; tracker;
beforeEach(function () { beforeEach(function () {

View File

@ -61,6 +61,8 @@ define(
var datas = [makeMockData(1)], var datas = [makeMockData(1)],
preparer = new PlotPreparer(datas, "testDomain", "testRange"); preparer = new PlotPreparer(datas, "testDomain", "testRange");
expect(preparer).toBeDefined();
expect(datas[0].getDomainValue).toHaveBeenCalledWith( expect(datas[0].getDomainValue).toHaveBeenCalledWith(
jasmine.any(Number), jasmine.any(Number),
"testDomain" "testDomain"

View File

@ -30,20 +30,11 @@ define(
describe("Overlaid plot mode", function () { describe("Overlaid plot mode", function () {
var mockDomainObject, var mockDomainObject,
mockSubPlotFactory, mockSubPlotFactory,
mockSubPlot,
mockPrepared, mockPrepared,
testBuffers, testBuffers,
testDrawingObjects, testDrawingObjects,
mode; mode;
function mockElement(x, y, w, h) {
return {
getBoundingClientRect: function () {
return { left: x, top: y, width: w, height: h };
}
};
}
function createMockSubPlot() { function createMockSubPlot() {
var mockSubPlot = jasmine.createSpyObj( var mockSubPlot = jasmine.createSpyObj(
"subPlot", "subPlot",
@ -127,7 +118,7 @@ define(
mode.plotTelemetry(mockPrepared); mode.plotTelemetry(mockPrepared);
// Should have one sub-plot with three lines // Should have one sub-plot with three lines
testDrawingObjects.forEach(function (testDrawingObject, i) { testDrawingObjects.forEach(function (testDrawingObject) {
// Either empty list or undefined is fine; // Either empty list or undefined is fine;
// just want to make sure there are no lines. // just want to make sure there are no lines.
expect(testDrawingObject.lines.length) expect(testDrawingObject.lines.length)
@ -178,7 +169,7 @@ define(
}); });
// Step back the same number of zoom changes // Step back the same number of zoom changes
mockSubPlotFactory.createSubPlot.calls.forEach(function (c) { mockSubPlotFactory.createSubPlot.calls.forEach(function () {
// Should still be zoomed at start of each iteration // Should still be zoomed at start of each iteration
expect(mode.isZoomed()).toBeTruthy(); expect(mode.isZoomed()).toBeTruthy();
// Step back one of the zoom changes. // Step back one of the zoom changes.

View File

@ -30,20 +30,11 @@ define(
describe("Stacked plot mode", function () { describe("Stacked plot mode", function () {
var mockDomainObject, var mockDomainObject,
mockSubPlotFactory, mockSubPlotFactory,
mockSubPlot,
mockPrepared, mockPrepared,
testBuffers, testBuffers,
testDrawingObjects, testDrawingObjects,
mode; mode;
function mockElement(x, y, w, h) {
return {
getBoundingClientRect: function () {
return { left: x, top: y, width: w, height: h };
}
};
}
function createMockSubPlot() { function createMockSubPlot() {
var mockSubPlot = jasmine.createSpyObj( var mockSubPlot = jasmine.createSpyObj(
"subPlot", "subPlot",
@ -172,7 +163,7 @@ define(
}); });
// Step back the same number of zoom changes // Step back the same number of zoom changes
mockSubPlotFactory.createSubPlot.calls.forEach(function (c) { mockSubPlotFactory.createSubPlot.calls.forEach(function () {
// Should still be zoomed at start of each iteration // Should still be zoomed at start of each iteration
expect(mode.isZoomed()).toBeTruthy(); expect(mode.isZoomed()).toBeTruthy();
// Step back // Step back

View File

@ -34,14 +34,6 @@ define(
mockTimeout, mockTimeout,
mockElement; mockElement;
function promise(value) {
return {
then: function (callback){
return promise(callback(value));
}
};
}
beforeEach(function() { beforeEach(function() {
watches = {}; watches = {};

View File

@ -32,14 +32,6 @@ define(
controller, controller,
mockScope; mockScope;
function promise(value) {
return {
then: function (callback){
return promise(callback(value));
}
};
}
beforeEach(function() { beforeEach(function() {
mockCapability = jasmine.createSpyObj('mutationCapability', [ mockCapability = jasmine.createSpyObj('mutationCapability', [
'listen' 'listen'

View File

@ -130,8 +130,6 @@ define(
it('to create column configuration, which is written to the' + it('to create column configuration, which is written to the' +
' object model', function() { ' object model', function() {
var mockModel = {};
controller.setup(); controller.setup();
expect(mockTable.getColumnConfiguration).toHaveBeenCalled(); expect(mockTable.getColumnConfiguration).toHaveBeenCalled();
expect(mockTable.saveColumnConfiguration).toHaveBeenCalled(); expect(mockTable.saveColumnConfiguration).toHaveBeenCalled();

View File

@ -33,7 +33,6 @@ define(
mockElement, mockElement,
testAttrs, testAttrs,
mockSwimlane, mockSwimlane,
mockRealElement,
testEvent, testEvent,
handlers, handlers,
directive; directive;

View File

@ -29,8 +29,7 @@ define(
mctForm; mctForm;
function installController() { function installController() {
var controllerProperty = mctForm.controller, var Controller = mctForm.controller[1];
Controller = mctForm.controller[1];
return new Controller(mockScope); return new Controller(mockScope);
} }

View File

@ -28,7 +28,6 @@ define(
var mockProviders, var mockProviders,
mockQ, mockQ,
resolves, resolves,
mockPromise,
mockCallback, mockCallback,
testUsers, testUsers,
aggregator; aggregator;

View File

@ -104,7 +104,7 @@ define(
// User chooses overwrite // User chooses overwrite
mockPromise.then.mostRecentCall.args[0](false); mockPromise.then.mostRecentCall.args[0](false);
// Should refresh, but not remutate, and requeue all objects // Should refresh, but not remutate, and requeue all objects
mockFailures.forEach(function (mockFailure, i) { mockFailures.forEach(function (mockFailure) {
expect(mockFailure.persistence.refresh).toHaveBeenCalled(); expect(mockFailure.persistence.refresh).toHaveBeenCalled();
expect(mockFailure.requeue).not.toHaveBeenCalled(); expect(mockFailure.requeue).not.toHaveBeenCalled();
expect(mockFailure.domainObject.useCapability).not.toHaveBeenCalled(); expect(mockFailure.domainObject.useCapability).not.toHaveBeenCalled();

View File

@ -86,7 +86,7 @@ define(
it("filters out policy-disallowed actions", function () { it("filters out policy-disallowed actions", function () {
// Disallow the second action // Disallow the second action
mockPolicyService.allow.andCallFake(function (cat, candidate, ctxt) { mockPolicyService.allow.andCallFake(function (cat, candidate) {
return candidate.someKey !== 'b'; return candidate.someKey !== 'b';
}); });
expect(decorator.getActions(testContext)) expect(decorator.getActions(testContext))

View File

@ -90,7 +90,7 @@ define(
it("filters out policy-disallowed views", function () { it("filters out policy-disallowed views", function () {
// Disallow the second action // Disallow the second action
mockPolicyService.allow.andCallFake(function (cat, candidate, ctxt) { mockPolicyService.allow.andCallFake(function (cat, candidate) {
return candidate.someKey !== 'b'; return candidate.someKey !== 'b';
}); });
expect(decorator.getViews(mockDomainObject)) expect(decorator.getViews(mockDomainObject))

View File

@ -25,12 +25,11 @@
* Module defining ContextMenuActionSpec. Created by shale on 07/02/2015. * Module defining ContextMenuActionSpec. Created by shale on 07/02/2015.
*/ */
define( define(
["../../src/actions/ContextMenuAction", "../../src/gestures/GestureConstants"], ["../../src/actions/ContextMenuAction"],
function (ContextMenuAction, GestureConstants) { function (ContextMenuAction) {
var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ], var JQLITE_FUNCTIONS = [ "on", "off", "find", "append", "remove" ],
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ], DOMAIN_OBJECT_METHODS = [ "getId", "getModel", "getCapability", "hasCapability", "useCapability" ];
MENU_DIMENSIONS = GestureConstants.MCT_MENU_DIMENSIONS;
describe("The 'context menu' action", function () { describe("The 'context menu' action", function () {

View File

@ -27,7 +27,6 @@ define(
describe("A gesture representer", function () { describe("A gesture representer", function () {
var mockGestureService, var mockGestureService,
mockGestureHandle, mockGestureHandle,
mockScope,
mockElement, mockElement,
representer; representer;

View File

@ -29,7 +29,6 @@ define(
describe("The search menu controller", function () { describe("The search menu controller", function () {
var mockScope, var mockScope,
mockPromise,
mockTypes, mockTypes,
controller; controller;

View File

@ -25,7 +25,11 @@ define(
function (TelemetryDelegator) { function (TelemetryDelegator) {
describe("The telemetry delegator", function () { describe("The telemetry delegator", function () {
var delegator;
beforeEach(function () {
delegator = new TelemetryDelegator();
});
}); });
} }
); );