diff --git a/can/constructor-hydrate/constructor-hydrate-test.js b/can/constructor-hydrate/constructor-hydrate-test.js index e142f6a5..33af3d92 100644 --- a/can/constructor-hydrate/constructor-hydrate-test.js +++ b/can/constructor-hydrate/constructor-hydrate-test.js @@ -54,3 +54,23 @@ QUnit.test("Two objects with no id", function(assert) { new Hub({name: 'One'}); assert.ok(true, 'Should allow to create two instances without an id (no Max Call Stack error)'); }); + +QUnit.test("No Props passed to new DefineMap, doesn't blow up", function(assert) { + var Hub = DefineMap.extend({}); + Hub.List = DefineList.extend({ + '#': { Type: Hub } + }); + var HubConnection = connect([ + constructorBehavior, + constructorStore, + mapBehavior, + hydrateBehavior, + ], { Map: Hub, List: Hub.List }); + + var hub1 = new Hub(); + hub1.name = 'One'; + HubConnection.addInstanceReference(hub1); + assert.ok(!HubConnection.instanceStore.has(undefined), 'The instanceStore should not have an "undefined" key item'); + new Hub({name: 'One'}); + assert.ok(true, 'Should allow to create two instances without an id (no Max Call Stack error)'); +}); diff --git a/can/constructor-hydrate/constructor-hydrate.js b/can/constructor-hydrate/constructor-hydrate.js index d84cbdde..2254943d 100644 --- a/can/constructor-hydrate/constructor-hydrate.js +++ b/can/constructor-hydrate/constructor-hydrate.js @@ -95,6 +95,7 @@ var connect = require("../../can-connect"); var Construct = require("can-construct"); +var canReflect = require("can-reflect"); var constructorHydrateBehavior = connect.behavior("can-connect/can/construct-hydrate", function(baseConnect){ return { @@ -102,8 +103,11 @@ var constructorHydrateBehavior = connect.behavior("can-connect/can/construct-hyd var oldSetup = this.Map.prototype.setup; var connection = this; this.Map.prototype.setup = function(props){ - if (connection.instanceStore.has( connection.id(props) )) { - return new Construct.ReturnValue( connection.hydrateInstance(props) ); + if ( + canReflect.isMapLike(props) && + connection.instanceStore.has(connection.id(props)) + ) { + return new Construct.ReturnValue(connection.hydrateInstance(props)); } return oldSetup.apply(this, arguments); }; diff --git a/package.json b/package.json index 0baa82c9..c8fe22b7 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "steal-qunit": "^2.0.0", "steal-tools": "^1.0.0", "test-saucelabs": "^0.0.6", - "testee": "^0.9.0" + "testee": "^0.10.2" }, "steal": { "plugins": [ diff --git a/test/test-saucelabs.js b/test/test-saucelabs.js index 70161455..701983ed 100644 --- a/test/test-saucelabs.js +++ b/test/test-saucelabs.js @@ -46,6 +46,6 @@ SauceLabs({ url: "http://localhost:3000/test/test.html?hidepassed", platforms: platforms }], - runInSeries: true, + runInParallel: false, zeroAssertionsPass: false });