Skip to content

Commit

Permalink
Merge remote-tracking branch 'antranig/FLUID-6111'
Browse files Browse the repository at this point in the history
* antranig/FLUID-6111:
  FLUID-6111: Test case and fix for faulty consideration that model with numeric property "length" is an array
  • Loading branch information
cindyli committed Feb 9, 2017
2 parents 5764b3e + 18b747a commit b9e1012
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/framework/core/js/Fluid.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ var fluid = fluid || fluid_3_0_0;
fluid.makeArray = function (arg) {
var togo = [];
if (arg !== null && arg !== undefined) {
if (fluid.isPrimitive(arg) || typeof(arg.length) !== "number") {
if (fluid.isPrimitive(arg) || fluid.isPlainObject(arg, true) || typeof(arg.length) !== "number") {
togo.push(arg);
}
else {
Expand Down
23 changes: 23 additions & 0 deletions tests/framework-tests/core/js/DataBindingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,29 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
jqUnit.assertEquals("Just one listener registered", 1, that.listenerCount);
});

/** FLUID-6111: Model merging with numeric property named "length" **/

fluid.defaults("fluid.tests.fluid6111head", {
gradeNames: "fluid.modelComponent",
model: {
name: "ABCD",
length: 14
}
});

jqUnit.test("FLUID-6111: Model merging with numeric property named \"length\"", function () {
var that = fluid.tests.fluid6111head({
model: {
duration: 34
}
});
var baseModel = {
name: "ABCD",
length: 14
};
jqUnit.assertLeftHand("Expected original model contents", baseModel, that.model);
});

/** FLUID-5695: New-style multiple paths and namespaces for model listeners **/

fluid.defaults("fluid.tests.fluid5695root", {
Expand Down

0 comments on commit b9e1012

Please sign in to comment.