Skip to content

Commit

Permalink
Merge remote-tracking branch 'antranig/FLUID-6741' into main
Browse files Browse the repository at this point in the history
* antranig/FLUID-6741:
  FLUID-6742: Reenabling IoC testing framework tests commented out for testing
  FLUID-6742: Deracing FLUID-5633 strikes back for Chrome 103
  FLUID-6741: Commenting out IoC testing tests to test CI
  NOJIRA: Comment change to run through CI a second time
  FLUID-6741: Test case and fix for construction of lensed component triggered by resource via model listeners
  • Loading branch information
cindyli committed Jul 4, 2022
2 parents 52732d2 + 8792f63 commit 680b31f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/framework/core/js/FluidIoC.js
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,10 @@ fluid.waitPendingIOTask = function (transRec) {

fluid.enqueueWorkflowBlock = function (transRec, shadows, workflowStart, workflowEnd, blockStart, blockEnd, sequencer) {
var workQueued = false;
var instantiator = fluid.globalInstantiator;
var resumeCurrentTransaction = function () {
instantiator.currentTreeTransactionId = transRec.transactionId;
};
transRec.lastWorkflowShadow = Math.max(transRec.lastWorkflowShadow, blockEnd);
fluid.forEachInRange(fluid.workflowCacheSorted, workflowStart, workflowEnd, function (workflowRecord, workflowIndex) {
if (workflowIndex === 0) {
Expand All @@ -2195,6 +2199,10 @@ fluid.enqueueWorkflowBlock = function (transRec, shadows, workflowStart, workflo
}
if (workflowRecord.workflowType === "global") {
var globalWorkflowTask = function () {
// Quick fix for FLUID-6741 - a workflow function may end up being triggered by I/O without having waited for it
// In practice transaction marking is pretty opportunistic and will probably leak in cases of
// concurrent construction
resumeCurrentTransaction();
workflowFunc(workflowShadows, transRec);
};
globalWorkflowTask.taskName = workflowRecord.namespace;
Expand Down
38 changes: 38 additions & 0 deletions tests/framework-tests/core/js/DataBindingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,44 @@ jqUnit.test("FLUID-6390 V: Updating lensed components as an array", function ()
fluid.tests.fluid6390assertModelValues("Updated model values are correct", that, []);
});

fluid.defaults("fluid.tests.fluid6741connector", {
gradeNames: ["fluid.modelComponent", "fluid.resourceLoader"],
model: {
connectionPort: null,
ports: "{that}.resources.resourceSource.parsed"
},
resources: {
resourceSource: {
promiseFunc: "fluid.tests.resolveLater",
promiseArgs: [[1, 2, 3]]
}
},
dynamicComponents: {
connection: {
type: "fluid.modelComponent",
source: "{that}.model.connectionPort"
}
},
modelListeners: {
ports: {
funcName: "fluid.tests.fluid6741findPort",
args: "{that}"
}
}
});

fluid.tests.fluid6741findPort = function (that) {
that.applier.change("connectionPort", that.model.ports[0]);
};

jqUnit.asyncTest("FLUID-6741: Lensed components via resource and model listener", function () {
var that = fluid.tests.fluid6741connector();
that.events.onCreate.then(function () {
jqUnit.assertValue("Lensed component should have been constructed", that.connection);
jqUnit.start();
});
});

/** FLUID-6570: Short-form free transforms **/

fluid.defaults("fluid.tests.fluid6570root", {
Expand Down
15 changes: 8 additions & 7 deletions tests/test-core/testTests/js/IoCTestingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ fluid.tests.fluid5633Tree.assertValue2 = function (that) {
fluid.defaults("fluid.tests.fluid5633Tree_2", {
gradeNames: ["fluid.test.testEnvironment", "fluid.test.testCaseHolder"],
events: {
createIt: null
createAndBind: null
},
components: {
fluid5633top: {
Expand Down Expand Up @@ -440,14 +440,17 @@ fluid.defaults("fluid.tests.fluid5633Tree_2", {
}
},
listeners: {
onCreate: "fluid.tests.fluid5633Tree_2.bindLater"
createAndBind: "fluid.tests.fluid5633Tree_2.createAndBind"
},
modules: [{
name: "FLUID-5633 strikes back: Deregistration of IoCSS listeners",
tests: [{
name: "FLUID-5633 strikes back sequence",
expect: 2,
sequence: [{
func: "{fluid5633Tree_2}.events.createAndBind.fire",
args: "{fluid5633Tree_2}"
}, {
event: "{fluid5633Tree_2 fluid5633middle fluid5633bottom}.events.bindIt",
listener: "jqUnit.assertEquals",
args: 42
Expand All @@ -463,11 +466,9 @@ fluid.defaults("fluid.tests.fluid5633Tree_2", {
}]
});

fluid.tests.fluid5633Tree_2.bindLater = function (that) {
fluid.invokeLater(function () {
that.fluid5633top.events.createIt.fire();
that.fluid5633top.events.bindIt.fire(42);
});
fluid.tests.fluid5633Tree_2.createAndBind = function (that) {
that.fluid5633top.events.createIt.fire();
that.fluid5633top.events.bindIt.fire(42);
};

// FLUID-5575 late firing of onTestCaseStart
Expand Down
9 changes: 9 additions & 0 deletions tests/test-core/utils/js/IoCTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,15 @@ fluid.defaults("fluid.test.sequence", {
gradeNames: "fluid.component"
});

// So: Note that it is the "finisher", kicked off by the sequence end, which fires off noteTest(-1) and
// invokes QUnit, starting the next sequence running, whereas it is the afterDestroy listener which kicks
// off the testRunner's "next" which constructs the fresh environment.
// The fresh environment's "onCreate" starts queueing QUnit tests.
// Both of these are delayed and may race. We would really want the sequence to start running, at least for an initial
// passive fixture, *before* onCreate of the environment starts.
// What we're observing in FLUID-6742, in fluid.tests.fluid5633Tree_2, is that onCreate has long finished before the
// sequence actually starts - which is invoked later by the finisher.

fluid.test.noteTest = function (root, count) {
if (root.activeTests === "destroyed") {
return;
Expand Down

0 comments on commit 680b31f

Please sign in to comment.