Skip to content

Commit

Permalink
Merge branch 'FLUID-4537' into shadow
Browse files Browse the repository at this point in the history
Conflicts:
	src/webapp/tests/framework-tests/renderer/js/RendererUtilitiesTests.js
  • Loading branch information
amb26 committed Nov 28, 2011
2 parents d08399c + d002d1c commit fc8ae96
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/webapp/framework/core/js/FluidIoC.js
Expand Up @@ -1163,7 +1163,7 @@ outer: for (var i = 0; i < exist.length; ++i) {
if (!base) {
return base;
}
return fluid.get(base, parsed.path);
return parsed.noDereference? parsed.path: fluid.get(base, parsed.path);
};

// unsupported, non-API function
Expand Down
11 changes: 9 additions & 2 deletions src/webapp/framework/renderer/js/RendererUtilities.js
Expand Up @@ -307,7 +307,7 @@ fluid_1_5 = fluid_1_5 || {};
var EL = fluid.model.composePath(path, i);
var envAdd = {};
if (options.pathAs) {
envAdd[options.pathAs] = EL;
envAdd[options.pathAs] = "${" + EL + "}";
}
if (options.valueAs) {
envAdd[options.valueAs] = fluid.get(config.model, EL, config.resolverGetConfig);
Expand Down Expand Up @@ -373,8 +373,15 @@ fluid_1_5 = fluid_1_5 || {};
fluid.transformContextPath = function (parsed, env) {
if (parsed.context) {
var fetched = env[parsed.context];
var EL;
if (typeof(fetched) === "string") {
return { path: fluid.model.composePath(fetched, parsed.path) };
EL = fluid.extractEL(fetched, {ELstyle: "${}"});
}
if (EL) {
return {
noDereference: parsed.path === "",
path: fluid.model.composePath(EL, parsed.path)
};
}
}
return parsed;
Expand Down
Expand Up @@ -136,7 +136,13 @@ <h2 id="qunit-userAgent"></h2>
<h1><a class="link" href="" title=""><span class="title">Title</span></a></h1>
<p class="description">Description</p>
</div>
</div>
</div>

<div class="pathAsProp">
<div class="pathexp-row">
<div class="pathexp-row-decorated"></div>
</div>
</div>

</div>

Expand Down
Expand Up @@ -950,7 +950,7 @@ fluid.registerNamespace("fluid.tests");
type: "fluid.renderer.repeat",
controlledBy: "vector",
pathAs: "elementPath",
valueAs: "element",
valueAs: "element",
repeatID: "link",
tree: {
linktext: "${{elementPath}}",
Expand Down Expand Up @@ -1458,7 +1458,6 @@ fluid.registerNamespace("fluid.tests");
jqUnit.assertEquals("Description title rendered", that.model.feeds[0].description, attr);
});


fluid.defaults("fluid.tests.FLUID4536", {
gradeNames: ["fluid.viewComponent", "autoInit"],
components: {
Expand Down Expand Up @@ -1542,5 +1541,48 @@ fluid.registerNamespace("fluid.tests");
}}}});
});

fluid.defaults("fluid.tests.pathExpander", {
gradeNames: ["autoInit", "fluid.viewComponent"]
});
fluid.defaults("fluid.tests.pathExpanderParent", {
gradeNames: ["autoInit", "fluid.rendererComponent"],
model: {
rows: ["0", "1", "2"]
},
selectors: {
row: ".pathexp-row",
decorated: ".pathexp-row-decorated"
},
repeatingSelectors: ["row"],
protoTree: {
expander: {
repeatID: "row",
type: "fluid.renderer.repeat",
pathAs: "path",
valueAs: "value",
controlledBy: "rows",
tree: {
decorated: {
decorators: {
type: "fluid",
func: "fluid.tests.pathExpander",
options: {
path: "{path}",
val: "{value}"
}
}
}
}
}
},
renderOnInit: true
});
protoTests.test("FLUID-4537 further: pathAs propagation", function () {
var that = fluid.tests.pathExpanderParent(".pathAsProp");
var decorators = fluid.renderer.getDecoratorComponents(that);
fluid.each(decorators, function (comp, name) {
jqUnit.assertEquals("Path should not be expanded into value", "rows." + comp.options.val, comp.options.path);
});
});
};
})(jQuery);

0 comments on commit fc8ae96

Please sign in to comment.