Skip to content

Commit

Permalink
FLUID-5293: Enhanced the unit test for FLUID-5293 to show another iss…
Browse files Browse the repository at this point in the history
…ue that, if the relay target is an array and the transformation is to remove element(s) from this array, the removal doesn't happen.
  • Loading branch information
cindyli committed Apr 4, 2014
1 parent 767bac8 commit b519913
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/tests/framework-tests/core/js/DataBindingTests.js
Expand Up @@ -1312,7 +1312,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
}]
});

jqUnit.test("FLUID-5270: Transforming relay from child to parent", function () {
jqUnit.test("FLUID-5293: Transforming relay from child to parent", function () {
var that = fluid.tests.fluid5293();
var expectedModel = {
accessibilityHazard: [],
Expand All @@ -1322,7 +1322,23 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
}
};

jqUnit.assertDeepEq("The top component model is transformed properly", expectedModel, that.model);
jqUnit.assertDeepEq("The initial forward transformation is performed properly", expectedModel, that.model);

var expectedModelAfterChangeRequest = {
accessibilityHazard: ["flashing", "noflashing"],
modelInTransit: {
flashing: true,
noflashing: true
}
};

that.applier.requestChange("modelInTransit.flashing", true);
that.applier.requestChange("modelInTransit.noflashing", true);
jqUnit.assertDeepEq("The backward transformation to add array values is performed properly", expectedModelAfterChangeRequest, that.model);

that.applier.requestChange("modelInTransit.flashing", false);
that.applier.requestChange("modelInTransit.noflashing", false);
jqUnit.assertDeepEq("The inverted transformation to remove array values is performed properly", expectedModel, that.model);
});

})(jQuery);

0 comments on commit b519913

Please sign in to comment.