Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

FLUID-5277: Corrected missing container diagnostic logic to recognise the new viewComponent hierarchy #472

Merged
merged 2 commits into from

2 participants

@amb26
Owner

No description provided.

Cindy Qi Li and others added some commits
Cindy Qi Li FLUID-5277: Created a unit test to demonstrate FLUID-5277 issue (http… 1c5f622
@amb26 amb26 FLUID-5277: Corrected missing container diagnostic logic to recognise…
… the new viewComponent hierarchy - improved focus triggering in FluidView test - reduced log level of IoC testing message which is extremely annoying in node.js
81aec00
@colinbdclark colinbdclark merged commit 81aec00 into fluid-project:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 14, 2014
Commits on Feb 19, 2014
  1. @amb26

    FLUID-5277: Corrected missing container diagnostic logic to recognise…

    amb26 authored
    … the new viewComponent hierarchy - improved focus triggering in FluidView test - reduced log level of IoC testing message which is extremely annoying in node.js
This page is out of date. Refresh to see the latest.
View
2  src/framework/core/js/FluidView.js
@@ -58,7 +58,7 @@ var fluid_1_5 = fluid_1_5 || {};
// diagnostic - in fact, it is perfectly acceptable for a component's creator to return no value and
// the failure is really in assumptions in fluid.initComponent. Revisit this issue for 1.5
fluid.diagnoseFailedView = function (componentName, that, options, args) {
- if (!that && fluid.hasGrade(options, "fluid.viewComponent")) {
+ if (!that && (fluid.hasGrade(options, "fluid.viewComponent") || fluid.hasGrade(options, "fluid.viewRelayComponent"))) {
var container = fluid.wrap(args[1]);
var message1 = "Instantiation of autoInit component with type " + componentName + " failed, since ";
if (!container) {
View
44 src/tests/framework-tests/core/js/FluidViewTests.js
@@ -151,8 +151,30 @@ fluid.registerNamespace("fluid.tests");
jqUnit.assertEquals("Calling on allocateSimpleId with parameter returns an ID starts with 'fluid-id-'", 0, fluidId.indexOf("fluid-id-"));
jqUnit.assertEquals("The element ID should be set after allocateSimpleId is called with element.", fluidId, element.id);
});
-
-
+
+
+ // FLUID-5277: Improve the error message when an nonexistent container is provided for fluid.viewRelayComponent and fluid.rendererRelayComponent
+ fluid.defaults("fluid.tests.fluid5277", {
+ gradeNames: ["fluid.viewRelayComponent", "autoInit"]
+ });
+
+ jqUnit.test("FLUID-5277: Improve the error message when an nonexistent container is provided for fluid.viewRelayComponent and fluid.rendererRelayComponent", function () {
+ var ourError;
+ fluid.pushSoftFailure(function () {
+ ourError = fluid.makeArray(arguments).join("");
+ throw new Error();
+ });
+ jqUnit.expect(2);
+ try {
+ var that = fluid.tests.fluid5277("#nonexistent-container");
+ } catch (e) {
+ jqUnit.assertValue("Triggered framework diagnostic", ourError);
+ jqUnit.assertTrue("Diagnostic message is correct", ourError.indexOf("did not match any markup") !== -1);
+ } finally {
+ fluid.pushSoftFailure(-1);
+ }
+ });
+
fluid.tests.testComponent = function (container, options) {
var that = fluid.initView("fluid.tests.testComponent", container, options);
@@ -238,13 +260,6 @@ fluid.registerNamespace("fluid.tests");
jqUnit.assertTrue("Time : " + fluid.renderTimestamp(new Date()), true);
}
- // This function is necessary since simulation of focus events by jQuery under IE
- // is not sufficiently good to intercept the "focusin" binding.
- function applyOp(node, func) {
- var raw = fluid.unwrap(node);
- raw[func] ? raw[func]() : node[func]();
- }
-
function blurTest(message, provokeTarget, provokeOp, shouldBlur, excludeMaker) {
jqUnit.test("Dead man's blur test - " + message, function () {
@@ -271,7 +286,7 @@ fluid.registerNamespace("fluid.tests");
excluded.append($("<input></input>").addClass("excluded"));
- applyOp(input, "focus");
+ fluid.focus(input);
var blurOutwaiter = function () {
jqUnit.assertTrue(message + " - Blur handler has not executed", shouldBlur ^ !blurReceived);
@@ -279,10 +294,15 @@ fluid.registerNamespace("fluid.tests");
jqUnit.start();
};
- applyOp(input, "blur");
+ fluid.blur(input);
window.setTimeout(function () {
fluid.log("Apply " + provokeOp + " to " + provokeTarget);
- applyOp(blurTester.locate(provokeTarget), provokeOp);
+ var element = blurTester.locate(provokeTarget);
+ if (provokeOp === "click") {
+ element.click();
+ } else{
+ fluid[provokeOp](element);
+ }
}, blurrer.options.delay - 100);
window.setTimeout(blurOutwaiter, blurrer.options.delay + 300);
View
1  src/tests/framework-tests/renderer/js/RendererUtilitiesTests.js
@@ -1831,4 +1831,5 @@ fluid.registerNamespace("fluid.tests");
"${{test}.string}", that.locate("simpleBound6").text());
});
};
+
})(jQuery);
View
2  src/tests/test-core/utils/js/IoCTestUtils.js
@@ -173,7 +173,7 @@ var fluid_1_5 = fluid_1_5 || {};
}
root.activeTests += count;
if (count === -1) {
- fluid.log(fluid.logLevel.IMPORTANT, "Starting QUnit due to destruction of tree ", root);
+ fluid.log(fluid.logLevel.INFO, "Starting QUnit due to destruction of tree ", root);
QUnit.start();
}
if (root.activeTests === 0) {
Something went wrong with that request. Please try again.