Permalink
Browse files

cleanup some automatic test failures, fix lint issues

  • Loading branch information...
1 parent 55bab76 commit 02891a29242fabc8f1a00b799f274b264a020377 @akre54 akre54 committed Jun 20, 2016
Showing with 17 additions and 15 deletions.
  1. +1 −0 package.json
  2. +5 −5 test/collection.js
  3. +2 −2 test/events.js
  4. +4 −4 test/model.js
  5. +4 −3 test/router.js
  6. +1 −1 test/view.js
View
@@ -22,6 +22,7 @@
"karma": "^0.13.13",
"karma-phantomjs-launcher": "^1.0.0",
"karma-qunit": "^1.0.0",
+ "phantomjs-prebuilt": "^2.1.7",
"qunitjs": "^2.0.0",
"uglify-js": "^2.4.17"
},
View
@@ -593,7 +593,7 @@
assert.equal(error, 'fail');
assert.equal(options.validationError, 'fail');
});
- assert.equal(collection.create({'foo': 'bar'}, {validate: true}), false);
+ assert.equal(collection.create({foo: 'bar'}, {validate: true}), false);
});
QUnit.test('create will pass extra options to success callback', function(assert) {
@@ -1399,7 +1399,7 @@
});
QUnit.test('#1939 - `parse` is passed `options`', function(assert) {
- var QUnit.done = assert.async();
+ var done = assert.async();
assert.expect(1);
var collection = new (Backbone.Collection.extend({
url: '/',
@@ -1414,7 +1414,7 @@
return {someHeader: 'headerValue'};
};
collection.fetch({
- success: function() { QUnit.done(); }
+ success: function() { done(); }
});
Backbone.ajax = ajax;
});
@@ -1749,10 +1749,10 @@
return new M(attrs);
}
});
- var c2 = new C2({'_id': 1});
+ var c2 = new C2({_id: 1});
assert.equal(c2.get(1), void 0);
assert.equal(c2.modelId(c2.at(0).attributes), void 0);
- var m = new M({'_id': 2});
+ var m = new M({_id: 2});
c2.add(m);
assert.equal(c2.get(2), void 0);
assert.equal(c2.modelId(m.attributes), void 0);
View
@@ -626,9 +626,9 @@
});
QUnit.test('once with asynchronous events', function(assert) {
- var QUnit.done = assert.async();
+ var done = assert.async();
assert.expect(1);
- var func = _.debounce(function() { assert.ok(true); QUnit.done(); }, 50);
+ var func = _.debounce(function() { assert.ok(true); done(); }, 50);
var obj = _.extend({}, Backbone.Events).once('async', func);
obj.trigger('async');
View
@@ -1260,14 +1260,14 @@
});
QUnit.test('#1365 - Destroy: New models execute success callback.', function(assert) {
- var QUnit.done = assert.async();
+ var done = assert.async();
assert.expect(2);
new Backbone.Model()
.on('sync', function() { assert.ok(false); })
.on('destroy', function(){ assert.ok(true); })
.destroy({success: function(){
assert.ok(true);
- QUnit.done();
+ done();
}});
});
@@ -1303,13 +1303,13 @@
});
QUnit.test('#1478 - Model `save` does not trigger change on unchanged attributes', function(assert) {
- var QUnit.done = assert.async();
+ var done = assert.async();
assert.expect(0);
var Model = Backbone.Model.extend({
sync: function(method, m, options) {
setTimeout(function(){
options.success();
- QUnit.done();
+ done();
}, 0);
}
});
View
@@ -666,7 +666,8 @@
assert.strictEqual(history.getFragment('fragment '), 'fragment');
});
- QUnit.test('#1820 - Leading slash and trailing space.', 1, function(assert) {
+ QUnit.test('#1820 - Leading slash and trailing space.', function(assert) {
+ assert.expect(1);
var history = new Backbone.History;
assert.strictEqual(history.getFragment('/fragment '), 'fragment');
});
@@ -681,7 +682,7 @@
assert.strictEqual(router.z, '123');
});
- QUnit.test('#2062 - Trigger 'route' event on router instance.', function(assert) {
+ QUnit.test('#2062 - Trigger "route" event on router instance.', function(assert) {
assert.expect(2);
router.on('route', function(name, args) {
assert.strictEqual(name, 'routeEvent');
@@ -1064,7 +1065,7 @@
Backbone.history.stop();
Backbone.history = _.extend(new Backbone.History, {location: location});
var MyRouter = Backbone.Router.extend({
- routes: {'': function() { assert.ok(true); } }
+ routes: {'': function() { assert.ok(true); }}
});
var myRouter = new MyRouter;
Backbone.history.start({root: '®ooτ', pushState: true});
View
@@ -154,7 +154,7 @@
QUnit.test('delegateEvents ignore undefined methods', function(assert) {
assert.expect(0);
var myView = new Backbone.View({el: '<p></p>'});
- myView.delegateEvents({'click': 'undefinedMethod'});
+ myView.delegateEvents({click: 'undefinedMethod'});
myView.$el.trigger('click');
});

0 comments on commit 02891a2

Please sign in to comment.