[Code Style] Rename shadowing variables

This commit is contained in:
Victor Woeltjen
2016-05-20 11:39:49 -07:00
parent e468080373
commit ad5691142e
56 changed files with 256 additions and 262 deletions

View File

@@ -152,7 +152,7 @@ define(
});
it("validates selection types using policy", function () {
var mockDomainObject = jasmine.createSpyObj(
var mockDomainObj = jasmine.createSpyObj(
'domainObject',
['getCapability']
),
@@ -166,8 +166,8 @@ define(
rows = structure.sections[sections.length - 1].rows,
locationRow = rows[rows.length - 1];
mockDomainObject.getCapability.andReturn(mockOtherType);
locationRow.validate(mockDomainObject);
mockDomainObj.getCapability.andReturn(mockOtherType);
locationRow.validate(mockDomainObj);
// Should check policy to see if the user-selected location
// can actually contain objects of this type

View File

@@ -63,10 +63,10 @@ define(
});
}
function showDialog(type) {
function showDialog(objType) {
// Create a dialog object to generate the form structure, etc.
var dialog =
new PropertiesDialog(type, domainObject.getModel());
new PropertiesDialog(objType, domainObject.getModel());
// Show the dialog
return dialogService.getUserInput(

View File

@@ -75,8 +75,8 @@ define(
* Invoke persistence on a domain object. This will be called upon
* the removed object's parent (as its composition will have changed.)
*/
function doPersist(domainObject) {
var persistence = domainObject.getCapability('persistence');
function doPersist(domainObj) {
var persistence = domainObj.getCapability('persistence');
return persistence && persistence.persist();
}

View File

@@ -223,7 +223,7 @@ define(
// Update value for this property in all elements of the
// selection which have this property.
function updateProperties(property, value) {
function updateProperties(property, val) {
var changed = false;
// Update property in a selected element
@@ -233,12 +233,12 @@ define(
// Check if this is a setter, or just assignable
if (typeof selected[property] === 'function') {
changed =
changed || (selected[property]() !== value);
selected[property](value);
changed || (selected[property]() !== val);
selected[property](val);
} else {
changed =
changed || (selected[property] !== value);
selected[property] = value;
changed || (selected[property] !== val);
selected[property] = val;
}
}
}

View File

@@ -133,11 +133,11 @@ define(
self = this;
// Initialize toolbar (expose object to parent scope)
function initialize(definition) {
function initialize(def) {
// If we have been asked to expose toolbar state...
if (self.attrs.toolbar) {
// Initialize toolbar object
self.toolbar = new EditToolbar(definition, self.commit);
self.toolbar = new EditToolbar(def, self.commit);
// Ensure toolbar state is exposed
self.exposeToolbar();
}

View File

@@ -37,11 +37,11 @@ define(
model = { x: "initial value" };
properties = ["x", "y", "z"].map(function (k) {
return {
getValue: function (model) {
return model[k];
getValue: function (m) {
return m[k];
},
setValue: function (model, v) {
model[k] = v;
setValue: function (m, v) {
m[k] = v;
},
getDefinition: function () {
return { control: 'textfield '};

View File

@@ -50,8 +50,8 @@ define(
var context = domainObject &&
domainObject.getCapability('context'),
objectPath = context ? context.getPath() : [],
ids = objectPath.map(function (domainObject) {
return domainObject.getId();
ids = objectPath.map(function (domainObj) {
return domainObj.getId();
});
// Parses the path together. Starts with the

View File

@@ -105,8 +105,8 @@ define([
function getIdPath(domainObject) {
var context = domainObject && domainObject.getCapability('context');
function getId(domainObject) {
return domainObject.getId();
function getId(domainObj) {
return domainObj.getId();
}
return context ? context.getPath().map(getId) : [];

View File

@@ -62,8 +62,8 @@ define([
var self = this,
domainObject = this.activeObject;
function addNode(domainObject, index) {
self.nodeViews[index].model(domainObject);
function addNode(domainObj, index) {
self.nodeViews[index].model(domainObj);
}
function addNodes(domainObjects) {

View File

@@ -36,7 +36,7 @@ define([
treeView;
function makeMockDomainObject(id, model, capabilities) {
var mockDomainObject = jasmine.createSpyObj(
var mockDomainObj = jasmine.createSpyObj(
'domainObject-' + id,
[
'getId',
@@ -46,18 +46,18 @@ define([
'useCapability'
]
);
mockDomainObject.getId.andReturn(id);
mockDomainObject.getModel.andReturn(model);
mockDomainObject.hasCapability.andCallFake(function (c) {
mockDomainObj.getId.andReturn(id);
mockDomainObj.getModel.andReturn(model);
mockDomainObj.hasCapability.andCallFake(function (c) {
return !!(capabilities[c]);
});
mockDomainObject.getCapability.andCallFake(function (c) {
mockDomainObj.getCapability.andCallFake(function (c) {
return capabilities[c];
});
mockDomainObject.useCapability.andCallFake(function (c) {
mockDomainObj.useCapability.andCallFake(function (c) {
return capabilities[c] && capabilities[c].invoke();
});
return mockDomainObject;
return mockDomainObj;
}
beforeEach(function () {
@@ -99,24 +99,16 @@ define([
var mockComposition;
function makeGenericCapabilities() {
var mockContext =
jasmine.createSpyObj('context', ['getPath']),
mockType =
jasmine.createSpyObj('type', ['getGlyph']),
mockLocation =
jasmine.createSpyObj('location', ['isLink']),
mockMutation =
jasmine.createSpyObj('mutation', ['listen']),
mockStatus =
var mockStatus =
jasmine.createSpyObj('status', ['listen', 'list']);
mockStatus.list.andReturn([]);
return {
context: mockContext,
type: mockType,
mutation: mockMutation,
location: mockLocation,
context: jasmine.createSpyObj('context', ['getPath']),
type: jasmine.createSpyObj('type', ['getGlyph']),
location: jasmine.createSpyObj('location', ['isLink']),
mutation: jasmine.createSpyObj('mutation', ['listen']),
status: mockStatus
};
}
@@ -133,11 +125,11 @@ define([
beforeEach(function () {
mockComposition = ['a', 'b', 'c'].map(function (id) {
var testCapabilities = makeGenericCapabilities(),
var testCaps = makeGenericCapabilities(),
mockChild =
makeMockDomainObject(id, {}, testCapabilities);
makeMockDomainObject(id, {}, testCaps);
testCapabilities.context.getPath
testCaps.context.getPath
.andReturn([mockDomainObject, mockChild]);
return mockChild;
@@ -207,11 +199,11 @@ define([
describe("when a context-less object is selected", function () {
beforeEach(function () {
var testCapabilities = makeGenericCapabilities(),
mockDomainObject =
makeMockDomainObject('xyz', {}, testCapabilities);
delete testCapabilities.context;
treeView.value(mockDomainObject);
var testCaps = makeGenericCapabilities(),
mockDomainObj =
makeMockDomainObject('xyz', {}, testCaps);
delete testCaps.context;
treeView.value(mockDomainObj);
});
it("clears all selection state", function () {

View File

@@ -79,8 +79,8 @@ define(
// On any touch on the body, default body touches/events
// are prevented, the bubble is dismissed, and the touchstart
// body event is unbound, reallowing gestures
body.on('touchstart', function (event) {
event.preventDefault();
body.on('touchstart', function (evt) {
evt.preventDefault();
hideBubble();
body.unbind('touchstart');
});

View File

@@ -69,7 +69,7 @@ define(
});
it("detects display orientation", function () {
var agentService = new AgentService(testWindow);
agentService = new AgentService(testWindow);
testWindow.innerWidth = 1024;
testWindow.innerHeight = 400;
expect(agentService.isPortrait()).toBeFalsy();