Permalink
Browse files

Merge remote-tracking branch 'amb26/FLUID-4919'

* amb26/FLUID-4919:
  FLUID-4919: Converted tooltip component to modern framework standards, and removed almost all remaining material from Reorderer's "postInit" function
  FLUID-4919: Updated Progress component to modern framework standards, fixed bug with non event firing when animation is turned off.
  FLUID-4986: Support for IoC-contextualised references from renderer component's "protoTree"
  FLUID-4919: Completed modernisation of Uploader and Reorderer - no manual init components remain. Loosened restriction on naming of "listener" field in listeners to conform with other locations (invokers, expanders). Fixed a broken non-testing IoC Test, improved some more diagnostics on bad listener records
  FLUID-4987 Resolved double registration of listeners from demands block issue, tidied fluid.embodyDemands a little further
  FLUID-4919: Tests and live implementations working for the Uploader again. Core files upgraded to reasonably modern standards. Also, new framework support for FLUID-4878 "this"-ist binding as well as new jqUnit method "jqUnit.assertDomEquals" for comparing arrays of DOM nodes
  FLUID-4949: Correctly map SWFUpload error code values - next step to merge up with master to get fluid.bind
  FLUID-4919: Better support for dumping gradeNames to aid in resolution debugging, improved messages during fluid.resolveContextValue - HTML5 version of live uploader demonstrated working at this revision
  FLUID-4978: Implemented circularity detection for all options material as well as "records". Improved ability to distinguish framework errors in tests with new "fluid.FluidError" exception type. Simplified and rewritten some old circularity tests, supplied new ones. Improved debuggability of DOM binders by supplying an id. Corrected some errors in logging activities. Defeated QUnit's "reordering" which just makes time-dependent testing issues harder to debug. Added jqUnit.fail()
  FLUID-4919: Improvements to logging in core framework to dump activity records, as well as fix to resolveContextValue logging
  FLUID-4919: All Uploader test cases passing again! Real function tests now required. Corrected issue in transformer which failed to transform ALL merge records of a particular type - once a component receives multiple distributions we may have duplicates. Eliminated more manual uses of the staticEnvironment.
  FLUID-4919: Corrected and factored HTML5Uploader tests - only compatibility unit tests now remain
  FLUID-4919: Revived "current" Uploader refactoring from old FLUID-4916 branch to pursue dedicated refactoring work.
  • Loading branch information...
2 parents 1e64327 + 187df86 commit d0f009b391d89a37fd2b4698a4bc7389b5473e6f @michelled michelled committed May 2, 2013
Showing with 2,135 additions and 2,102 deletions.
  1. +114 −141 src/webapp/components/progress/js/Progress.js
  2. +300 −230 src/webapp/components/reorderer/js/Reorderer.js
  3. +81 −73 src/webapp/components/tooltip/js/Tooltip.js
  4. +41 −74 src/webapp/components/uploader/js/DemoUploadManager.js
  5. +189 −176 src/webapp/components/uploader/js/FileQueueView.js
  6. +5 −5 src/webapp/components/uploader/js/Flash9UploaderSupport.js
  7. +170 −164 src/webapp/components/uploader/js/FlashUploaderSupport.js
  8. +150 −262 src/webapp/components/uploader/js/HTML5UploaderSupport.js
  9. +329 −244 src/webapp/components/uploader/js/Uploader.js
  10. +41 −16 src/webapp/framework/core/js/Fluid.js
  11. +155 −94 src/webapp/framework/core/js/FluidIoC.js
  12. +3 −2 src/webapp/framework/core/js/FluidView.js
  13. +19 −7 src/webapp/framework/renderer/js/RendererUtilities.js
  14. +1 −3 src/webapp/tests/component-tests/progress/html/Progress-test.html
  15. +30 −159 src/webapp/tests/component-tests/progress/js/ProgressTests.js
  16. +12 −12 src/webapp/tests/component-tests/reorderer/js/ImageReordererTests.js
  17. +1 −0 src/webapp/tests/component-tests/tooltip/html/Tooltip-test.html
  18. +1 −2 src/webapp/tests/component-tests/tooltip/js/TooltipTests.js
  19. +3 −1 src/webapp/tests/component-tests/uploader/html/SWFUploadManager-test.html
  20. +39 −39 src/webapp/tests/component-tests/uploader/js/DemoUploadManagerTests.js
  21. +1 −1 src/webapp/tests/component-tests/uploader/js/FileQueueViewTests.js
  22. +89 −203 src/webapp/tests/component-tests/uploader/js/HTML5UploaderSupportTests.js
  23. +1 −3 src/webapp/tests/component-tests/uploader/js/SWFUploadManagerTests.js
  24. +15 −6 src/webapp/tests/component-tests/uploader/js/UploaderCompatibilityTests.js
  25. +32 −0 src/webapp/tests/component-tests/uploader/js/UploaderTestUtilities.js
  26. +5 −12 src/webapp/tests/component-tests/uploader/js/UploaderTests.js
  27. +128 −32 src/webapp/tests/framework-tests/core/js/FluidIoCTests.js
  28. +159 −138 src/webapp/tests/framework-tests/renderer/js/RendererUtilitiesTests.js
  29. +13 −0 src/webapp/tests/test-core/jqUnit/js/jqUnit-browser.js
  30. +8 −3 src/webapp/tests/test-core/jqUnit/js/jqUnit.js

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -13,113 +13,121 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
/*global fluid_1_5:true, jQuery*/
// JSLint options
-/*jslint white: true, funcinvoke: true, undef: true, newcap: true, nomen: true, regexp: true, bitwise: true, browser: true, forin: true, maxerr: 100, indent: 4 */
+/*jslint white: true, funcinvoke: true, undef: true, newcap: true, nomen: true, regexp: true, bitwise: true, browser: true, forin: true, indent: 4 */
var fluid_1_5 = fluid_1_5 || {};
(function ($, fluid) {
+ fluid.registerNamespace("fluid.tooltip");
- var createContentFunc = function (content) {
+ fluid.tooltip.createContentFunc = function (content) {
return typeof content === "function" ? content : function () {
return content;
};
};
+
+ fluid.tooltip.makeOpenHandler = function (that) {
+ return function (event) {
+ var tt = $(event.target).tooltip("widget");
+ tt.stop(false, true);
+ tt.hide();
+ if (that.options.delay) {
+ tt.delay(that.options.delay).fadeIn("default", that.events.afterOpen.fire());
+ } else {
+ tt.show();
+ that.events.afterOpen.fire();
+ }
+ };
+ };
+
+ fluid.tooltip.makeCloseHandler = function (that) {
+ return function (event) {
+ var tt = $(event.target).tooltip("widget");
+ tt.stop(false, true);
+ tt.hide();
+ tt.clearQueue();
+ that.events.afterClose.fire();
+ };
+ };
- var setup = function (that) {
+ fluid.tooltip.setup = function (that) {
that.container.tooltip({
- content: createContentFunc(that.options.content),
+ content: fluid.tooltip.createContentFunc(that.options.content),
position: that.options.position,
items: that.options.items,
- open: function (event) {
- var tt = $(event.target).tooltip("widget");
- tt.stop(false, true);
- tt.hide();
- if (that.options.delay) {
- tt.delay(that.options.delay).fadeIn("default", that.events.afterOpen.fire());
- } else {
- tt.show();
- that.events.afterOpen.fire();
- }
- },
- close: function (event) {
- var tt = $(event.target).tooltip("widget");
- tt.stop(false, true);
- tt.hide();
- tt.clearQueue();
- that.events.afterClose.fire();
- }
+ open: fluid.tooltip.makeOpenHandler(that),
+ close: fluid.tooltip.makeCloseHandler(that)
});
-
that.elm = that.container.tooltip("widget");
-
that.elm.addClass(that.options.styles.tooltip);
};
-
- fluid.tooltip = function (container, options) {
- var that = fluid.initView("fluid.tooltip", container, options);
-
- /**
- * Updates the contents displayed in the tooltip
- *
- * @param {Object} content, the content to be displayed in the tooltip
- */
- that.updateContent = function (content) {
- that.container.tooltip("option", "content", createContentFunc(content));
-
- // FLUID-4780:
- // The following line is a workaround for an issue we found in the VideoPlayer (FLUID-4743).
- // jQuery UI has a fix for it: http://bugs.jqueryui.com/ticket/8544
- // When we upgrade jQuery UI, we should clean out this workaround
- that.container.data("tooltip").tooltip.html(content);
- };
-
- /**
- * Destroys the underlying jquery ui tooltip
- */
- that.destroy = function () {
- that.container.tooltip("destroy");
- };
-
- /**
- * Manually displays the tooltip
- */
- that.open = function () {
- that.container.tooltip("open");
- };
-
- /**
- * Manually hides the tooltip
- */
- that.close = function () {
- that.container.tooltip("close");
- };
-
- setup(that);
-
- return that;
+
+ fluid.tooltip.updateContent = function (that, content) {
+ that.container.tooltip("option", "content", fluid.tooltip.createContentFunc(content));
+ // FLUID-4780:
+ // The following line is a workaround for an issue we found in the VideoPlayer (FLUID-4743).
+ // jQuery UI has a fix for it: http://bugs.jqueryui.com/ticket/8544
+ // When we upgrade jQuery UI, we should clean out this workaround
+ that.container.data("tooltip").tooltip.html(content);
};
fluid.defaults("fluid.tooltip", {
- gradeNames: ["fluid.viewComponent"],
+ gradeNames: ["fluid.viewComponent", "autoInit"],
+ invokers: {
+ /**
+ * Destroys the underlying jquery ui tooltip
+ */
+ // NB - can't name this "destroy" due to collision with new fabricated "destroy" method - however API is
+ // preserved since that method forwards to this one via listener
+ doDestroy: {
+ "this": "{that}.container",
+ method: "tooltip",
+ args: "destroy"
+ },
+ /**
+ * Manually displays the tooltip
+ */
+ open: {
+ "this": "{that}.container",
+ method: "tooltip",
+ args: "open"
+ },
+ /**
+ * Manually hides the tooltip
+ */
+ close: {
+ "this": "{that}.container",
+ method: "tooltip",
+ args: "close"
+ },
+ /**
+ * Updates the contents displayed in the tooltip
+ *
+ * @param {Object} content, the content to be displayed in the tooltip
+ */
+ updateContent: {
+ funcName: "fluid.tooltip.updateContent",
+ args: ["{that}", "{arguments}.0"]
+ }
+ },
styles: {
tooltip: ""
},
-
events: {
afterOpen: null,
afterClose: null
},
-
+ listeners: {
+ onCreate: "fluid.tooltip.setup",
+ onDestroy: "{that}.doDestroy"
+ },
content: "",
-
position: {
my: "left top",
at: "left bottom",
offset: "0 5"
},
-
items: "*",
-
delay: 300
});
@@ -22,20 +22,20 @@ var fluid_1_5 = fluid_1_5 || {};
(function ($, fluid) {
- fluid.registerNamespace("fluid.uploader");
+ fluid.registerNamespace("fluid.uploader.demo");
- var startUploading = function (that) {
+ fluid.uploader.demo.uploadNextFile = function (that) {
// Reset our upload stats for each new file.
that.demoState.currentFile = that.queue.files[that.demoState.fileIdx];
that.demoState.chunksForCurrentFile = Math.ceil(that.demoState.currentFile / that.demoState.chunkSize);
that.demoState.bytesUploaded = 0;
that.queue.isUploading = true;
that.events.onFileStart.fire(that.demoState.currentFile);
- simulateUpload(that);
+ fluid.uploader.demo.simulateUpload(that);
};
- var updateProgress = function (file, events, demoState, isUploading) {
+ fluid.uploader.demo.updateProgress = function (file, events, demoState, isUploading) {
if (!isUploading) {
return;
}
@@ -45,12 +45,14 @@ var fluid_1_5 = fluid_1_5 || {};
events.onFileProgress.fire(file, demoState.bytesUploaded, file.size);
};
- var finishAndContinueOrCleanup = function (that, file) {
+ fluid.uploader.demo.finishAndContinueOrCleanup = function (that, file) {
+ // TODO: it appears that this duplicates handlers in Uploader.js onFileComplete -
+ // which this component does not fire
that.queue.finishFile(file);
that.events.afterFileComplete.fire(file);
if (that.queue.shouldUploadNextFile()) {
- startUploading(that);
+ fluid.uploader.demo.uploadNextFile(that);
} else {
that.events.afterUploadComplete.fire(that.queue.currentBatch.files);
if (file.status !== fluid.uploader.fileStatusConstants.CANCELLED) {
@@ -59,119 +61,84 @@ var fluid_1_5 = fluid_1_5 || {};
}
};
- var finishUploading = function (that) {
+ fluid.uploader.demo.finishUploading = function (that) {
if (!that.queue.isUploading) {
return;
}
var file = that.demoState.currentFile;
that.events.onFileSuccess.fire(file);
that.demoState.fileIdx++;
- finishAndContinueOrCleanup(that, file);
+ fluid.uploader.demo.finishAndContinueOrCleanup(that, file);
};
- var simulateUpload = function (that) {
+ fluid.uploader.demo.simulateUpload = function (that) {
if (!that.queue.isUploading) {
return;
}
var file = that.demoState.currentFile;
if (that.demoState.bytesUploaded < file.size) {
fluid.invokeAfterRandomDelay(function () {
- updateProgress(file, that.events, that.demoState, that.queue.isUploading);
- simulateUpload(that);
+ fluid.uploader.demo.updateProgress(file, that.events, that.demoState, that.queue.isUploading);
+ fluid.uploader.demo.simulateUpload(that);
});
} else {
- finishUploading(that);
+ fluid.uploader.demo.finishUploading(that);
}
};
- var stopDemo = function (that) {
+ fluid.uploader.demo.stop = function (that) {
var file = that.demoState.currentFile;
file.filestatus = fluid.uploader.fileStatusConstants.CANCELLED;
that.queue.shouldStop = true;
- // In SWFUpload's world, pausing is a combinination of an UPLOAD_STOPPED error and a complete.
+ // In SWFUpload's world, pausing is a combination of an UPLOAD_STOPPED error and a complete.
that.events.onFileError.fire(file,
fluid.uploader.errorConstants.UPLOAD_STOPPED,
"The demo upload was paused by the user.");
- finishAndContinueOrCleanup(that, file);
+ fluid.uploader.demo.finishAndContinueOrCleanup(that, file);
that.events.onUploadStop.fire();
};
+
+ fluid.demands("fluid.uploader.uploadNextFile", "fluid.uploader.demo.remote", {
+ funcName: "fluid.uploader.demo.uploadNextFile",
+ args: "{that}"
+ });
- var setupDemo = function (that) {
- if (that.simulateDelay === undefined || that.simulateDelay === null) {
- that.simulateDelay = true;
- }
-
- // Initialize state for our upload simulation.
- that.demoState = {
- fileIdx: 0,
- chunkSize: 200000
- };
-
- return that;
- };
-
- /**
- * The demo remote pretends to upload files to the server, firing all the appropriate events
- * but without sending anything over the network or requiring a server to be running.
- *
- * @param {FileQueue} queue the Uploader's file queue instance
- * @param {Object} the Uploader's bundle of event firers
- * @param {Object} configuration options
- */
- fluid.uploader.demoRemote = function (queue, options) {
- var that = fluid.initLittleComponent("fluid.uploader.demoRemote", options);
- that.queue = queue;
-
- that.uploadNextFile = function () {
- startUploading(that);
- };
-
- that.stop = function () {
- stopDemo(that);
- };
-
- setupDemo(that);
- return that;
- };
+ fluid.demands("fluid.uploader.stop", "fluid.uploader.demo.remote", {
+ funcName: "fluid.uploader.demo.stop",
+ args: "{that}"
+ });
/**
* Invokes a function after a random delay by using setTimeout.
- * If the simulateDelay option is false, the function is invoked immediately.
- * This is an odd function, but a potential candidate for central inclusion.
- *
* @param {Function} fn the function to invoke
*/
fluid.invokeAfterRandomDelay = function (fn) {
var delay = Math.floor(Math.random() * 200 + 100);
setTimeout(fn, delay);
};
+
+ /**
+ * The demo remote pretends to upload files to the server, firing all the appropriate events
+ * but without sending anything over the network or requiring a server to be running.
+ *
+ * @param {Object} configuration options
+ */
- fluid.defaults("fluid.uploader.demoRemote", {
- gradeNames: ["fluid.eventedComponent"],
- argumentMap: {
- options: 1
- },
- events: {
- onFileProgress: "{multiFileUploader}.events.onFileProgress",
- afterFileComplete: "{multiFileUploader}.events.afterFileComplete",
- afterUploadComplete: "{multiFileUploader}.events.afterUploadComplete",
- onFileSuccess: "{multiFileUploader}.events.onFileSuccess",
- onFileStart: "{multiFileUploader}.events.onFileStart",
- onFileError: "{multiFileUploader}.events.onFileError",
- onUploadStop: "{multiFileUploader}.events.onUploadStop"
+ fluid.defaults("fluid.uploader.demo.remote", {
+ gradeNames: ["fluid.uploader.remote", "autoInit"],
+ members: {
+ demoState: {
+ fileIdx: 0,
+ chunkSize: 200000
+ }
}
});
fluid.demands("fluid.uploader.remote", ["fluid.uploader.multiFileUploader", "fluid.uploader.demo"], {
- funcName: "fluid.uploader.demoRemote",
- args: [
- "{multiFileUploader}.queue",
- "{multiFileUploader}.events",
- fluid.COMPONENT_OPTIONS
- ]
+ funcName: "fluid.uploader.demo.remote"
});
})(jQuery, fluid_1_5);
Oops, something went wrong.

0 comments on commit d0f009b

Please sign in to comment.