temporary UNSTABLE since codemod went nuts

This commit is contained in:
Peter Cottle 2015-04-20 17:05:21 +10:00
parent 2257668f9d
commit f048f99e7f
14 changed files with 32 additions and 39 deletions

View file

@ -1,5 +1,4 @@
var TreeCompare = require('../graph/treeCompare'); var TreeCompare = require('../graph/treeCompare');
var _ = require('underscore');
var loadTree = function(treeString) { var loadTree = function(treeString) {
return TreeCompare.convertTreeSafe(treeString); return TreeCompare.convertTreeSafe(treeString);
@ -13,7 +12,8 @@ var testMethod = function(compareMethod, goalTreeString, cases, options) {
cases[goalTreeString] = true; cases[goalTreeString] = true;
} }
_.each(cases, function(value, actualTree) { Object.keys(cases).forEach(function(actualTree) {
var value = cases[actualTree];
var isEqual = TreeCompare.dispatch(compareMethod, goalTreeString, actualTree); var isEqual = TreeCompare.dispatch(compareMethod, goalTreeString, actualTree);
if (isEqual !== value) { if (isEqual !== value) {
console.log('this goal tree', loadTree(goalTreeString)); console.log('this goal tree', loadTree(goalTreeString));
@ -21,7 +21,7 @@ var testMethod = function(compareMethod, goalTreeString, cases, options) {
console.log('for this value', value); console.log('for this value', value);
} }
expect(isEqual).toBe(value); expect(isEqual).toBe(value);
}); }.bind(this));
}; };
describe('Tree Compare', function() { describe('Tree Compare', function() {

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var Q = require('q'); var Q = require('q');
var Main = require('../app'); var Main = require('../app');

View file

@ -316,7 +316,7 @@ var LevelBuilder = Level.extend({
] ]
}); });
askForHintView.getPromise() askForHintView.getPromise()
.then(this.defineHint, this)) .then(this.defineHint.bind(this))
.fail(function() { .fail(function() {
this.level.hint = {'en_US': ''}; this.level.hint = {'en_US': ''};
}.bind(this)) }.bind(this))

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var intl = require('../intl'); var intl = require('../intl');
var Commands = require('../commands'); var Commands = require('../commands');
@ -25,7 +24,7 @@ DisabledMap.prototype.getInstantCommands = function() {
}); });
}; };
_.each(this.disabledMap, function(val, disabledCommand) { Object.keys(this.disabledMap).forEach(function(disabledCommand) {
// XXX get hold of vcs from disabledMap // XXX get hold of vcs from disabledMap
var vcs = 'git'; var vcs = 'git';
disabledCommand = disabledCommand.slice(vcs.length + 1); disabledCommand = disabledCommand.slice(vcs.length + 1);
@ -35,7 +34,7 @@ DisabledMap.prototype.getInstantCommands = function() {
' has no regex matching'); ' has no regex matching');
} }
instants.push([gitRegex, onMatch]); instants.push([gitRegex, onMatch]);
}); }.bind(this));
return instants; return instants;
}; };

View file

@ -368,16 +368,16 @@ var Level = Sandbox.extend({
initGitShim: function(options) { initGitShim: function(options) {
// ok we definitely want a shim here // ok we definitely want a shim here
this.gitShim = new GitShim({ this.gitShim = new GitShim({
beforeCB: this.beforeCommandCB, this), beforeCB: this.beforeCommandCB.bind(this),
afterCB: this.afterCommandCB, this), afterCB: this.afterCommandCB.bind(this),
afterDeferHandler: this.afterCommandDefer, this) afterDeferHandler: this.afterCommandDefer.bind(this)
}); });
}, },
undo: function() { undo: function() {
this.gitCommandsIssued.pop(); this.gitCommandsIssued.pop();
Level.__super__.undo.apply(this, arguments); Level.__super__.undo.apply(this, arguments);
}.bind(this) }.bind(this),
afterCommandCB: function(command) { afterCommandCB: function(command) {
if (command.get('error')) { if (command.get('error')) {

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var intl = require('../intl'); var intl = require('../intl');
var GitCommands = require('../git/commands'); var GitCommands = require('../git/commands');

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var Q = require('q'); var Q = require('q');
var Backbone = require('backbone'); var Backbone = require('backbone');

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var Q = require('q'); var Q = require('q');
var Backbone = require('backbone'); var Backbone = require('backbone');
@ -68,7 +67,7 @@ var Sandbox = Backbone.View.extend({
initGitShim: function(options) { initGitShim: function(options) {
this.gitShim = new GitShim({ this.gitShim = new GitShim({
beforeCB: this.beforeCommandCB, this) beforeCB: this.beforeCommandCB.bind(this)
}); });
}, },
@ -83,7 +82,7 @@ var Sandbox = Backbone.View.extend({
Main.getEventBaton().stealBaton('levelExited', this.levelExited, this); Main.getEventBaton().stealBaton('levelExited', this.levelExited, this);
this.insertGitShim(); this.insertGitShim();
}.bind(this) }.bind(this),
releaseControl: function() { releaseControl: function() {
// we will be handling commands that are submitted, mainly to add the sanadbox // we will be handling commands that are submitted, mainly to add the sanadbox

View file

@ -68,14 +68,14 @@ var MarkdownGrabber = ContainedBase.extend({
// do button stuff // do button stuff
var buttonDefer = Q.defer(); var buttonDefer = Q.defer();
buttonDefer.promise buttonDefer.promise
.then(this.confirmed, this)) .then(this.confirmed.bind(this))
.fail(this.cancelled, this)) .fail(this.cancelled.bind(this))
.done(); .done();
var confirmCancel = new Views.ConfirmCancelView({ var confirmCancel = new Views.ConfirmCancelView({
deferred: buttonDefer, deferred: buttonDefer,
destination: this.getDestination() destination: this.getDestination()
}.bind(this) }.bind(this));
} }
this.updatePreview(); this.updatePreview();
@ -98,7 +98,7 @@ var MarkdownGrabber = ContainedBase.extend({
keyup: function() { keyup: function() {
if (!this.throttledPreview) { if (!this.throttledPreview) {
this.throttledPreview = _.throttle( this.throttledPreview = _.throttle(
this.updatePreview, this), this.updatePreview.bind(this),
500 500
); );
} }
@ -107,7 +107,7 @@ var MarkdownGrabber = ContainedBase.extend({
getRawText: function() { getRawText: function() {
return this.$('textarea').val(); return this.$('textarea').val();
}.bind(this) }.bind(this),
exportToArray: function() { exportToArray: function() {
return this.getRawText().split('\n'); return this.getRawText().split('\n');
@ -155,7 +155,7 @@ var MarkdownPresenter = ContainedBase.extend({
.fail(function() { .fail(function() {
this.deferred.reject(); this.deferred.reject();
}.bind(this)) }.bind(this))
.done(this.die, this)); .done(this.die.bind(this));
} }
this.show(); this.show();
@ -230,8 +230,8 @@ var DemonstrationBuilder = ContainedBase.extend({
}); });
buttonDeferred.promise buttonDeferred.promise
.then(this.confirmed, this)) .then(this.confirmed.bind(this))
.fail(this.cancelled, this)) .fail(this.cancelled.bind(this))
.done(); .done();
}, },
@ -243,7 +243,7 @@ var DemonstrationBuilder = ContainedBase.extend({
options: this.getExportObj() options: this.getExportObj()
}] }]
}); });
}.bind(this) }.bind(this),
getExportObj: function() { getExportObj: function() {
return { return {

View file

@ -107,7 +107,7 @@ var GeneralButton = ContainedBase.extend({
click: function() { click: function() {
if (!this.clickFunc) { if (!this.clickFunc) {
this.clickFunc = _.throttle( this.clickFunc = _.throttle(
this.sendClick, this), this.sendClick.bind(this),
500 500
); );
} }
@ -578,11 +578,11 @@ var CanvasTerminalHolder = BaseView.extend({
// If the entire window gets resized such that the terminal is outside the view, then // If the entire window gets resized such that the terminal is outside the view, then
// move it back into the view, and expand/shrink it vertically as necessary. // move it back into the view, and expand/shrink it vertically as necessary.
$(window).on('resize', _.debounce(this.recalcLayout, this), 300)); $(window).on('resize', _.debounce(this.recalcLayout.bind(this), 300));
if (options.additionalClass) { if (options.additionalClass) {
this.$el.addClass(options.additionalClass); this.$el.addClass(options.additionalClass);
}.bind(this) }
}, },
getAnimationTime: function() { return 700; }, getAnimationTime: function() { return 700; },

View file

@ -42,7 +42,7 @@ var LevelDropdownView = ContainedBase.extend({
this.navEvents = _.clone(Backbone.Events); this.navEvents = _.clone(Backbone.Events);
this.navEvents.on('clickedID', _.debounce( this.navEvents.on('clickedID', _.debounce(
this.loadLevelID, this), this.loadLevelID.bind(this),
300, 300,
true true
)); ));
@ -60,7 +60,7 @@ var LevelDropdownView = ContainedBase.extend({
enter: 'positive' enter: 'positive'
}, },
wait: true wait: true
}.bind(this) });
this.sequences = LevelStore.getSequences(); this.sequences = LevelStore.getSequences();
this.sequenceToLevels = LevelStore.getSequenceToLevels(); this.sequenceToLevels = LevelStore.getSequenceToLevels();

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var Backbone = require('backbone'); var Backbone = require('backbone');
var Q = require('q'); var Q = require('q');
@ -76,14 +75,14 @@ AnimationFactory.highlightEachWithPromise = function(
toHighlight, toHighlight,
destObj destObj
) { ) {
_.each(toHighlight, function(commit) { toHighlight.forEach(function(commit) {
chain = chain.then(function() { chain = chain.then(function() {
return this.playHighlightPromiseAnimation( return this.playHighlightPromiseAnimation(
commit, commit,
destObj destObj
); );
}.bind(this)); }.bind(this));
}, this); }.bind(this));
return chain; return chain;
}; };

View file

@ -1,4 +1,3 @@
var _ = require('underscore');
var Q = require('q'); var Q = require('q');
var Backbone = require('backbone'); var Backbone = require('backbone');
var GlobalStateActions = require('../../actions/GlobalStateActions'); var GlobalStateActions = require('../../actions/GlobalStateActions');

View file

@ -91,7 +91,7 @@ var Visualization = Backbone.View.extend({
this.shown = false; this.shown = false;
this.setTreeOpacity(0); this.setTreeOpacity(0);
// reflow needed // reflow needed
process.nextTick(this.fadeTreeIn, this)); process.nextTick(this.fadeTreeIn.bind(this));
this.customEvents.trigger('gitEngineReady'); this.customEvents.trigger('gitEngineReady');
this.customEvents.trigger('paperReady'); this.customEvents.trigger('paperReady');
@ -99,7 +99,7 @@ var Visualization = Backbone.View.extend({
clearOrigin: function() { clearOrigin: function() {
delete this.originVis; delete this.originVis;
}.bind(this) }.bind(this),
makeOrigin: function(options) { makeOrigin: function(options) {
// oh god, here we go. We basically do a bizarre form of composition here, // oh god, here we go. We basically do a bizarre form of composition here,
@ -186,7 +186,7 @@ var Visualization = Backbone.View.extend({
show: function() { show: function() {
$(this.paper.canvas).css('visibility', 'visible'); $(this.paper.canvas).css('visibility', 'visible');
setTimeout(this.fadeTreeIn, this), 10); setTimeout(this.fadeTreeIn.bind(this), 10);
this.originToo('show', arguments); this.originToo('show', arguments);
this.myResize(); this.myResize();
}, },
@ -196,7 +196,7 @@ var Visualization = Backbone.View.extend({
this.setTreeOpacity(1); this.setTreeOpacity(1);
this.originToo('showHarsh', arguments); this.originToo('showHarsh', arguments);
this.myResize(); this.myResize();
}.bind(this) }.bind(this),
resetFromThisTreeNow: function(treeString) { resetFromThisTreeNow: function(treeString) {
this.treeString = treeString; this.treeString = treeString;