Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
danvk committed Dec 3, 2014
1 parent 81e6325 commit 4faef45
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cycledash/static/js/examine/RecordStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function createRecordStore(run, dispatcher, opt_testDataSource) {
}
}

// no need to debounce this update -- make it so now!
// There's no need to debounce this update -- make it so now!
_updateGenotypes({append: false});

function notifyChange() {
Expand Down
6 changes: 4 additions & 2 deletions cycledash/static/js/examine/components/QueryBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ var QueryBox = React.createClass({
}
},

// Set the visible query in the typeahead box to `str`.
// This is factored out for easy intercepting while testing.
/**
* Set the visible query in the typeahead box to `str`.
* This is factored out for easy intercepting while testing.
*/
setDisplayedQuery: function(str) {
var $input = $(this.refs.input.getDOMNode());
$input.typeahead('val', str);
Expand Down
14 changes: 8 additions & 6 deletions tests/js/Utils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,32 @@ describe('Utils', function() {
describe('stubReactMethod', function() {
it('should stub a React class method, then restore it', function() {
var TestUtils = React.addons.TestUtils;
var captured;
var captured = [];
var RC = React.createClass({
render: function() {
this.method();
return null;
},
method: function() {
captured = 'original';
captured.push('original');
}
});

var stubFn = function() { captured = 'stubbed'; };
var stubFn = function() { captured.push('stubbed'); };

var el = React.createElement(RC, null);
TestUtils.renderIntoDocument(el);
assert.equal('original', captured);
assert.deepEqual(['original'], captured);

var stub = Utils.stubReactMethod(RC, 'method', stubFn);
captured = [];
TestUtils.renderIntoDocument(el);
assert.equal('stubbed', captured);
assert.deepEqual(['stubbed'], captured);

stub.restore();
captured = [];
TestUtils.renderIntoDocument(el);
assert.equal('original', captured);
assert.deepEqual(['original'], captured);
});
});
});

0 comments on commit 4faef45

Please sign in to comment.