Skip to content

Commit

Permalink
FLUID-4919: All Uploader test cases passing again! Real function test…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
amb26 committed Apr 12, 2013
1 parent 5a9bc91 commit 0610f1b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/webapp/components/uploader/js/Flash9UploaderSupport.js
Expand Up @@ -22,7 +22,7 @@ var fluid_1_5 = fluid_1_5 || {};
(function ($, fluid) {

// TODO: This context name is required, but has no visible detection support
fluid.staticEnvironment.supportsFlash9 = fluid.typeTag("fluid.uploader.flash.9");
fluid.enhance.check({"fluid.uploader.flash.9": true});

fluid.registerNamespace("fluid.uploader.swfUploadStrategy");

Expand Down
2 changes: 1 addition & 1 deletion src/webapp/components/uploader/js/FlashUploaderSupport.js
Expand Up @@ -22,7 +22,7 @@ var fluid_1_5 = fluid_1_5 || {};

(function ($, fluid) {
// TODO: This context name is required, but has no visible detection support
fluid.staticEnvironment.supportsFlash10 = fluid.typeTag("fluid.uploader.flash.10");
fluid.enhance.check({"fluid.uploader.flash.10": true});

/**********************
* uploader.swfUpload *
Expand Down
12 changes: 6 additions & 6 deletions src/webapp/framework/core/js/Fluid.js
Expand Up @@ -224,7 +224,7 @@ var fluid = fluid || fluid_1_5;

/** Returns whether logging is enabled **/
fluid.isLogging = function () {
return logLevelStack[0].priority > fluid.logLevel.IMPORTANT;
return logLevelStack[0].priority > fluid.logLevel.IMPORTANT.priority;
};

/** Determines whether the supplied argument is a valid logLevel marker **/
Expand Down Expand Up @@ -1682,17 +1682,17 @@ var fluid = fluid || fluid_1_5;
};

// unsupported, NON-API function
fluid.findMergeBlock = function (mergeBlocks, recordType) {
return fluid.find_if(mergeBlocks, function (block) { return block.recordType === recordType; });
fluid.findMergeBlocks = function (mergeBlocks, recordType) {
return fluid.remove_if(fluid.makeArray(mergeBlocks), function (block) { return block.recordType !== recordType; });
};

// unsupported, NON-API function
fluid.transformOptionsBlocks = function (mergeBlocks, transformOptions, recordTypes) {
fluid.each(recordTypes, function (recordType) {
var block = fluid.findMergeBlock(mergeBlocks, recordType);
if (block) {
var blocks = fluid.findMergeBlocks(mergeBlocks, recordType);
fluid.each(blocks, function (block) {
block[block.simple? "target": "source"] = fluid.transformOptions(block.source, transformOptions);
}
});
});
};

Expand Down
3 changes: 2 additions & 1 deletion src/webapp/framework/core/js/FluidIoC.js
Expand Up @@ -403,7 +403,8 @@ var fluid_1_5 = fluid_1_5 || {};
fluid.cacheShadowGrades(that, shadow);
var baseDefaults = fluid.rawDefaults(that.typeName);
var newDefaults = fluid.getGradedDefaults(baseDefaults, that.typeName, gradeNames);
var defaultsBlock = fluid.findMergeBlock(shadow.mergeOptions.mergeBlocks, "defaults");
// TODO: In complex distribution cases, a component might end up with multiple default blocks
var defaultsBlock = fluid.findMergeBlocks(shadow.mergeOptions.mergeBlocks, "defaults")[0];
defaultsBlock.source = newDefaults;
shadow.mergeOptions.updateBlocks();
}
Expand Down
Expand Up @@ -21,6 +21,20 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt

fluid.registerNamespace("fluid.tests.uploader");

fluid.enhance.forgetAll();

// TODO: Do this manually so that progressiveEnhancer does not forget it each time - need enhancer groupings

// Choose html5 configuration for all tests since it will cause resolution of multiFileUpload
// and not complain about absence of SWF
fluid.tests.uploader.commonTags = {
"fluid.browser.supportsBinaryXHR": true,
"fluid.browser.supportsFormData": true
};

fluid.setLogging(true);
fluid.setDemandLogging(true);

jqUnit.module("Uploader Compatibility Tests");

/****************************************
Expand Down Expand Up @@ -70,12 +84,6 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
}
};

fluid.enhance.forgetAll();

// Choose html5 configuration for all tests since it will cause resolution of multiFileUpload
// and not complain about absence of SWF
// TODO: Do this manually so that progressiveEnhancer does not forget it each time - need enhancer groupings
fluid.staticEnvironment.uploaderConfig = fluid.typeTag("fluid.browser.supportsBinaryXHR");

fluid.defaults("fluid.tests.uploader.parent", {
gradeNames: ["fluid.littleComponent", "autoInit"],
Expand Down Expand Up @@ -137,6 +145,7 @@ https://github.com/fluid-project/infusion/raw/master/Infusion-LICENSE.txt
fluid.each(optionsTypes, function (optionsType) {
jqUnit.test(msg + " " + uploaderConfig.label + " - " + optionsType.label, function () {
fluid.enhance.check(tags);
fluid.enhance.check(fluid.tests.uploader.commonTags);
var uploader = uploaderConfig.uploader.apply(null, [fluid.copy(optionsType.options), rules]);
checkFn(uploader);
fluid.enhance.forgetAll();
Expand Down

0 comments on commit 0610f1b

Please sign in to comment.