Permalink
Browse files

Backbone 1.3.1 - 1.3.3 support (#571)

  • Loading branch information...
1 parent 9d02d20 commit c96ec7986aa21302e594c2e2810d2a5de43ebbbb @jeremymlane jeremymlane committed with bpatram Apr 3, 2017
Showing with 13 additions and 5 deletions.
  1. +1 −1 bower.json
  2. +3 −2 package.json
  3. +9 −2 test/collection.js
View
@@ -4,7 +4,7 @@
"main": "backbone-relational.js",
"dependencies": {
"underscore": ">=1.7.0",
- "backbone": ">=1.2.1"
+ "backbone": ">=1.3.3"
},
"ignore": ["static", "test", ".html"]
}
View
@@ -19,12 +19,12 @@
"author": "Paul Uithol <https://github.com/PaulUithol>",
"contributors": "Listed at <https://github.com/PaulUithol/Backbone-relational/contributors>",
"peerDependencies": {
- "backbone": "1.2.3"
+ "backbone": "^1.2.3"
},
"license": "MIT",
"version": "0.10.0",
"devDependencies": {
- "backbone": "1.2.3",
+ "backbone": "^1.3.3",
"browserify": "^13.0.0",
"jquery": "^2.2.1",
"karma": "^0.13.22",
@@ -34,6 +34,7 @@
"karma-qunit": "^0.1.9",
"phantomjs-prebuilt": "^2.1.5",
"qunitjs": "^1.22.0",
+ "semver": "^5.1.0",
"underscore": ">=1.7.0",
"watchify": "^3.7.0"
}
View
@@ -1,3 +1,5 @@
+var semver = require('semver');
+
QUnit.module( "Backbone.Relational.Collection", { setup: require('./setup/setup').reset } );
QUnit.test( "Loading (fetching) multiple times updates the model, and relations's `keyContents`", function() {
@@ -110,8 +112,13 @@ QUnit.module( "Backbone.Relational.Collection", { setup: require('./setup/setup'
ok( _.isArray( cars.set( [ e, f ] ) ), "Set (an array of) two models" );
// Check removing `[]`
var result = cars.remove( [] );
- ok( result === false, "Removing `[]` is a noop (results in 'false', no models removed)" );
- // ok( result.length === 0, "Removing `[]` is a noop (results in an empty array, no models removed)" );
+
+ //have to also check if the result is an array since in backbone 1.3.1 Backbone.VERSION is incorrectly set to 1.2.3
+ if (semver.satisfies(Backbone.VERSION, '^1.3.1') || Array.isArray(result)){
+ ok( result.length === 0, "Removing `[]` is a noop (results in an empty array, no models removed)" );
+ } else {
+ ok( result === false, "Removing `[]` is a noop (results in 'false', no models removed)" );
+ }
ok( cars.length === 2, "Still 2 cars" );
// Check removing `null`

0 comments on commit c96ec79

Please sign in to comment.