You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by jo...@apache.org on 2011/01/31 23:32:40 UTC
svn commit: r1065837 - in /shindig/trunk/features: ./
src/main/javascript/features/core.config/
src/test/javascript/features/core.io/ src/test/javascript/features/core/
src/test/javascript/features/osapi/ src/test/javascript/features/views/
src/test/ja...
Author: johnh
Date: Mon Jan 31 22:32:39 2011
New Revision: 1065837
URL: http://svn.apache.org/viewvc?rev=1065837&view=rev
Log:
Allows configuration of JS features included in <script> tag like so:
<script src="http://www.example.com/gadgets/js/feature.js">
{ "feature": { "key": "value" } }
</script>
Loaded JS detects its root config block by scanning the DOM and searching for a <script> node with "src" attribute matching its URL (if injected as a ___jsl hint), or uses the last script.src node otherwise.
Inline config is eval()'d text, with or without enclosing braces, that evaluates to an Object. Data that are found are merged into existing config for feature(s).
Added:
shindig/trunk/features/src/main/javascript/features/core.config/validators.js
Modified:
shindig/trunk/features/pom.xml
shindig/trunk/features/src/main/javascript/features/core.config/config.js
shindig/trunk/features/src/main/javascript/features/core.config/feature.xml
shindig/trunk/features/src/test/javascript/features/core.io/iotest.js
shindig/trunk/features/src/test/javascript/features/core/authtest.js
shindig/trunk/features/src/test/javascript/features/core/config-test.js
shindig/trunk/features/src/test/javascript/features/osapi/batchtest.js
shindig/trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js
shindig/trunk/features/src/test/javascript/features/views/views-init-test.js
shindig/trunk/features/src/test/javascript/features/xhrwrapper/xhrwrappertest.js
Modified: shindig/trunk/features/pom.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/features/pom.xml?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/pom.xml (original)
+++ shindig/trunk/features/pom.xml Mon Jan 31 22:32:39 2011
@@ -107,6 +107,7 @@
<source>../../../../src/test/javascript/features/mocks/xhr.js</source>
<source>globals/globals.js</source>
<source>core.config/config.js</source>
+ <source>core.config/validators.js</source>
<source>core.config/configcontainer.js</source>
<source>core.config/configgadget.js</source>
<source>core.json/json-native.js</source>
Modified: shindig/trunk/features/src/main/javascript/features/core.config/config.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.config/config.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.config/config.js (original)
+++ shindig/trunk/features/src/main/javascript/features/core.config/config.js Mon Jan 31 22:32:39 2011
@@ -56,12 +56,103 @@
*/
gadgets.config = function() {
+ var ___jsl;
var components = {};
var configuration;
+ function foldConfig(origConfig, updConfig) {
+ for (var key in updConfig) {
+ if (!updConfig.hasOwnProperty(key)) {
+ continue;
+ }
+ if (typeof origConfig[key] === "object" &&
+ typeof updConfig[key] === "object") {
+ // Both have the same key with an object value. Recurse.
+ foldConfig(origConfig[key], updConfig[key]);
+ } else {
+ // If updConfig has a new key, or a value of different type
+ // than the original config for the same key, or isn't an object
+ // type, then simply replace the value for the key.
+ origConfig[key] = updConfig[key];
+ }
+ }
+ }
+
+ function getLoadingScript() {
+ // Attempt to retrieve config augmentation from latest script node.
+ var scripts = document.scripts || document.getElementsByTagName("script");
+ if (!scripts || scripts.length == 0) return null;
+ var scriptTag;
+ if (___jsl.u) {
+ for (var i = 0; !scriptTag && i < scripts.length; ++i) {
+ var candidate = scripts[i];
+ if (candidate.src &&
+ candidate.src.indexOf(___jsl.u) == 0) {
+ // Do indexOf test to allow for fragment info
+ scriptTag = candidate;
+ }
+ }
+ }
+ if (!scriptTag) {
+ scriptTag = scripts[scripts.length - 1];
+ }
+ if (!scriptTag.src) return null;
+ return scriptTag;
+ }
+
+ function getInnerText(scriptNode) {
+ var scriptText = "";
+ if (scriptNode.nodeType == 3 || scriptNode.nodeType == 4) {
+ scriptText = scriptNode.nodeValue;
+ } else if (scriptNode.innerText) {
+ scriptText = scriptNode.innerText;
+ } else if (scriptNode.firstChild) {
+ var content = [];
+ for (var child = scriptNode.firstChild; child; child = child.nextSibling) {
+ content.push(getInnerText(child));
+ }
+ scriptText = content.join('');
+ }
+ return scriptText;
+ }
+
+ function parseConfig(configText) {
+ var config;
+ try {
+ eval("config=(" + configText + "\n)");
+ } catch (e) { }
+ if (typeof config === "object") {
+ return config;
+ }
+ try {
+ eval("config=({" + configText + "\n})");
+ } catch (e) { }
+ return typeof config === "object" ? config : {};
+ }
+
+ function augmentConfig(baseConfig) {
+ var loadScript = getLoadingScript();
+ if (!loadScript) {
+ return;
+ }
+ var scriptText = getInnerText(loadScript);
+ var configAugment = parseConfig(scriptText);
+ if (___jsl.f && ___jsl.f.length == 1) {
+ // Single-feature load on current request.
+ // Augmentation adds to just this feature's config if
+ // "short-form" syntax is used ie. skipping top-level feature key.
+ var feature = ___jsl.f[0];
+ if (!configAugment[feature]) {
+ var newConfig = {};
+ newConfig[___jsl.f[0]] = configAugment;
+ configAugment = newConfig;
+ }
+ }
+ foldConfig(baseConfig, configAugment);
+ }
+
return {
- 'register':
- /**
+ /**
* Registers a configurable component and its configuration parameters.
* Multiple callbacks may be registered for a single component if needed.
*
@@ -84,21 +175,20 @@ gadgets.config = function() {
* @name register
* @function
*/
- function(component, opt_validators, opt_callback) {
- var registered = components[component];
- if (!registered) {
- registered = [];
- components[component] = registered;
- }
+ 'register': function(component, opt_validators, opt_callback) {
+ var registered = components[component];
+ if (!registered) {
+ registered = [];
+ components[component] = registered;
+ }
- registered.push({
- validators: opt_validators || {},
- callback: opt_callback
- });
- },
+ registered.push({
+ validators: opt_validators || {},
+ callback: opt_callback
+ });
+ },
- 'get':
- /**
+ /**
* Retrieves configuration data on demand.
*
* @param {string=} opt_component The component to fetch. If not provided
@@ -109,12 +199,12 @@ gadgets.config = function() {
* @name get
* @function
*/
- function(opt_component) {
- if (opt_component) {
- return configuration[opt_component] || {};
- }
- return configuration;
- },
+ 'get': function(opt_component) {
+ if (opt_component) {
+ return configuration[opt_component] || {};
+ }
+ return configuration;
+ },
/**
* Initializes the configuration.
@@ -127,11 +217,17 @@ gadgets.config = function() {
* @function
*/
'init': function(config, opt_noValidation) {
- configuration = config;
+ ___jsl = window["___jsl"] || {};
+ if (configuration) {
+ // init(...) has already been called. Merge rather than override config.
+ foldConfig(configuration, config);
+ } else {
+ configuration = config;
+ }
+ augmentConfig(configuration);
for (var name in components) {
if (components.hasOwnProperty(name)) {
- var componentList = components[name],
- conf = config[name];
+ var componentList = components[name], conf = configuration[name];
for (var i = 0, j = componentList.length; i < j; ++i) {
var component = componentList[i];
@@ -149,122 +245,22 @@ gadgets.config = function() {
}
if (component.callback) {
- component.callback(config);
+ component.callback(configuration);
}
}
}
}
},
- // Standard validators go here.
-
- /**
- * Ensures that data is one of a fixed set of items.
- * Also supports argument sytax: EnumValidator("Dog", "Cat", "Fish");
- *
- * @param {Array.<string>} list The list of valid values.
- *
- * @member gadgets.config
- * @name EnumValidator
- * @function
- */
- 'EnumValidator': function(list) {
- var listItems = [];
- if (arguments.length > 1) {
- for (var i = 0, arg; (arg = arguments[i]); ++i) {
- listItems.push(arg);
- }
- } else {
- listItems = list;
- }
- return function(data) {
- for (var i = 0, test; (test = listItems[i]); ++i) {
- if (data === listItems[i]) {
- return true;
- }
- }
- return false;
- };
- },
-
- /**
- * Tests the value against a regular expression.
- * @member gadgets.config
- * @name RegexValidator
- * @function
- */
- 'RegExValidator': function(re) {
- return function(data) {
- return re.test(data);
- };
- },
-
- /**
- * Validates that a value was provided.
- * @param {*} data
- * @member gadgets.config
- * @name ExistsValidator
- * @function
- */
- 'ExistsValidator': function(data) {
- return typeof data !== 'undefined';
- },
-
- /**
- * Validates that a value is a non-empty string.
- * @param {*} data
- * @member gadgets.config
- * @name NonEmptyStringValidator
- * @function
- */
- 'NonEmptyStringValidator': function(data) {
- return typeof data === 'string' && data.length > 0;
- },
-
- /**
- * Validates that the value is a boolean.
- * @param {*} data
- * @member gadgets.config
- * @name BooleanValidator
- * @function
- */
- 'BooleanValidator': function(data) {
- return typeof data === 'boolean';
- },
-
/**
- * Similar to the ECMAScript 4 virtual typing system, ensures that
- * whatever object was passed in is "like" the existing object.
- * Doesn't actually do type validation though, but instead relies
- * on other validators.
- *
- * This can be used recursively as well to validate sub-objects.
- *
- * @example
- *
- * var validator = new gadgets.config.LikeValidator(
- * "booleanField" : gadgets.config.BooleanValidator,
- * "regexField" : new gadgets.config.RegExValidator(/foo.+/);
- * );
- *
- *
- * @param {Object} test The object to test against.
- * @member gadgets.config
- * @name BooleanValidator
- * @function
- */
- 'LikeValidator' : function(test) {
- return function(data) {
- for (var member in test) {
- if (test.hasOwnProperty(member)) {
- var t = test[member];
- if (!t(data[member])) {
- return false;
- }
- }
- }
- return true;
- };
+ * Method largely for dev and debugging purposes that
+ * replaces or manually updates feature config.
+ * @param updateConfig {Object} Config object, with keys for features.
+ * @param opt_replace {Boolean} true to replace all configuration.
+ */
+ 'update': function(updateConfig, opt_replace) {
+ configuration = opt_replace ? {} : configuration;
+ foldConfig(configuration, updateConfig);
}
- };
+ }
}();
Modified: shindig/trunk/features/src/main/javascript/features/core.config/feature.xml
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.config/feature.xml?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.config/feature.xml (original)
+++ shindig/trunk/features/src/main/javascript/features/core.config/feature.xml Mon Jan 31 22:32:39 2011
@@ -21,6 +21,7 @@
<dependency>globals</dependency>
<gadget>
<script src="config.js"/>
+ <script src="validators.js"/>
<script src="configgadget.js"/>
<api>
<exports type="js">gadgets.config.register</exports>
@@ -36,6 +37,7 @@
</gadget>
<container>
<script src="config.js"/>
+ <script src="validators.js"/>
<script src="configcontainer.js"/>
<api>
<exports type="js">gadgets.config.register</exports>
Added: shindig/trunk/features/src/main/javascript/features/core.config/validators.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.config/validators.js?rev=1065837&view=auto
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/core.config/validators.js (added)
+++ shindig/trunk/features/src/main/javascript/features/core.config/validators.js Mon Jan 31 22:32:39 2011
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Defines default validators in a separate file from the rest of the config
+// system, to enable its separability from these.
+
+(function() {
+ /**
+ * Ensures that data is one of a fixed set of items.
+ * Also supports argument sytax: EnumValidator("Dog", "Cat", "Fish");
+ *
+ * @param {Array.<string>} list The list of valid values.
+ *
+ * @member gadgets.config
+ * @name EnumValidator
+ * @function
+ */
+ gadgets.config.EnumValidator = function(list) {
+ var listItems = [];
+ if (arguments.length > 1) {
+ for (var i = 0, arg; (arg = arguments[i]); ++i) {
+ listItems.push(arg);
+ }
+ } else {
+ listItems = list;
+ }
+ return function(data) {
+ for (var i = 0, test; (test = listItems[i]); ++i) {
+ if (data === listItems[i]) {
+ return true;
+ }
+ }
+ return false;
+ };
+ };
+
+ /**
+ * Tests the value against a regular expression.
+ * @member gadgets.config
+ * @name RegexValidator
+ * @function
+ */
+ gadgets.config.RegExValidator = function(re) {
+ return function(data) {
+ return re.test(data);
+ };
+ };
+
+ /**
+ * Validates that a value was provided.
+ * @param {*} data
+ * @member gadgets.config
+ * @name ExistsValidator
+ * @function
+ */
+ gadgets.config.ExistsValidator = function(data) {
+ return typeof data !== 'undefined';
+ };
+
+ /**
+ * Validates that a value is a non-empty string.
+ * @param {*} data
+ * @member gadgets.config
+ * @name NonEmptyStringValidator
+ * @function
+ */
+ gadgets.config.NonEmptyStringValidator = function(data) {
+ return typeof data === 'string' && data.length > 0;
+ };
+
+ /**
+ * Validates that the value is a boolean.
+ * @param {*} data
+ * @member gadgets.config
+ * @name BooleanValidator
+ * @function
+ */
+ gadgets.config.BooleanValidator = function(data) {
+ return typeof data === 'boolean';
+ };
+
+ /**
+ * Similar to the ECMAScript 4 virtual typing system, ensures that
+ * whatever object was passed in is "like" the existing object.
+ * Doesn't actually do type validation though, but instead relies
+ * on other validators.
+ *
+ * This can be used recursively as well to validate sub-objects.
+ *
+ * @example
+ *
+ * var validator = new gadgets.config.LikeValidator(
+ * "booleanField" : gadgets.config.BooleanValidator,
+ * "regexField" : new gadgets.config.RegExValidator(/foo.+/);
+ * );
+ *
+ *
+ * @param {Object} test The object to test against.
+ * @member gadgets.config
+ * @name BooleanValidator
+ * @function
+ */
+ gadgets.config.LikeValidator = function(test) {
+ return function(data) {
+ for (var member in test) {
+ if (test.hasOwnProperty(member)) {
+ var t = test[member];
+ if (!t(data[member])) {
+ return false;
+ }
+ }
+ }
+ return true;
+ };
+ };
+})();
Modified: shindig/trunk/features/src/test/javascript/features/core.io/iotest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/core.io/iotest.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/core.io/iotest.js (original)
+++ shindig/trunk/features/src/test/javascript/features/core.io/iotest.js Mon Jan 31 22:32:39 2011
@@ -24,7 +24,6 @@ function IoTest(name) {
IoTest.inherits(TestCase);
IoTest.prototype.setUp = function() {
- this.oldGetUrlParameters = gadgets.util.getUrlParameters;
gadgets.util.getUrlParameters = function() {
return { "st" : "authtoken", "url" : "http://www.gadget.com/gadget.xml", "container" : "foo" };
};
@@ -38,6 +37,7 @@ IoTest.prototype.setUp = function() {
window.XMLHttpRequest = this.fakeXhrs.getXhrConstructor();
shindig.xhrwrapper = undefined;
+ document.scripts = [];
gadgets.config.init({ "core.io" : {
"proxyUrl" : "http://example.com/proxy?url=%url%&refresh=%refresh%&g=%gadget%&c=%container%",
"jsonProxyUrl" : "http://example.com/json" }});
@@ -52,7 +52,6 @@ IoTest.prototype.setSchemaless = functio
};
IoTest.prototype.tearDown = function() {
- gadgets.util.getUrlParameters = this.oldGetUrlParameters;
window.XMLHttpRequest = this.oldXMLHTTPRequest;
shindig.xhrwrapper = this.oldXhrWrapper;
};
Modified: shindig/trunk/features/src/test/javascript/features/core/authtest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/core/authtest.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/core/authtest.js (original)
+++ shindig/trunk/features/src/test/javascript/features/core/authtest.js Mon Jan 31 22:32:39 2011
@@ -27,13 +27,11 @@ AuthTest.prototype.setUp = function() {
// Prepare for mocks
gadgets.util = gadgets.util || {};
gadgets.config = gadgets.config || {};
- this.oldGetUrlParameters = gadgets.util.getUrlParameters;
this.oldConfigRegister = gadgets.config.register;
};
AuthTest.prototype.tearDown = function() {
// Remove mocks
- gadgets.util.getUrlParameters = this.oldGetUrlParameters;
gadgets.config.register = this.oldConfigRegister;
};
Modified: shindig/trunk/features/src/test/javascript/features/core/config-test.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/core/config-test.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/core/config-test.js (original)
+++ shindig/trunk/features/src/test/javascript/features/core/config-test.js Mon Jan 31 22:32:39 2011
@@ -23,13 +23,29 @@ function ConfigTest(name) {
ConfigTest.inherits(TestCase);
+ConfigTest.prototype.setUp = function() {
+ this.script1 = { nodeType: 3, src: "http://www.1.com/js/1.js", nodeValue: "{data:'value1'}" };
+ this.script2 = { nodeType: 3, src: "http://www.2.com/js/2.js", nodeValue: "{data:'value2'}" };
+ this.script3 = { nodeType: 3, src: "http://www.3.com/js/3.js", nodeValue: "{data:'value3'}" };
+ document.scripts = [ this.script1, this.script2, this.script3 ];
+ this.defaultConfig = {
+ testBasic: { data: "Hello, World!", untouched: "Goodbye" },
+ testSecond: { foo: "Bar" }
+ };
+};
+
+ConfigTest.prototype.tearDown = function() {
+ gadgets.config.update({}, true); // "reset" gadgets lib
+ window["___jsl"] = undefined;
+};
+
ConfigTest.prototype.testBasic = function() {
var testBasicConfig;
gadgets.config.register("testBasic", null, function(config) {
testBasicConfig = config.testBasic;
});
- gadgets.config.init({testBasic: {data: "Hello, World!"}});
+ gadgets.config.init(this.defaultConfig);
this.assertEquals("Hello, World!", testBasicConfig.data);
};
@@ -51,6 +67,100 @@ ConfigTest.prototype.testMultiple = func
this.assertEquals("Hello, World!", testMultiple1.data);
};
+ConfigTest.prototype.testFindScriptLastNoHint = function() {
+ var testListen;
+ gadgets.config.register("testBasic", null, function(config) {
+ testListen = config;
+ });
+ this.script3.nodeValue = "{ testBasic: { data: 'News' } }";
+
+ gadgets.config.init(this.defaultConfig);
+
+ this.assertEquals("News", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+};
+
+ConfigTest.prototype.testFindScriptLastHintMismatch = function() {
+ var testListen;
+ gadgets.config.register("testBasic", null, function(config) {
+ testListen = config;
+ });
+ this.script3.nodeValue = " testBasic: { data: 'AgainNew' } ";
+
+ window["___jsl"] = { u: "http://nomatch.com/foo.js" };
+ gadgets.config.init(this.defaultConfig);
+
+ this.assertEquals("AgainNew", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+};
+
+ConfigTest.prototype.testFindScriptHintExact = function() {
+ var testListen;
+ gadgets.config.register("testBasic", null, function(config) {
+ testListen = config;
+ });
+ this.script2.nodeValue = "data: 'Override'";
+ window["___jsl"] = { u: "http://www.2.com/js/2.js", f: [ "testBasic" ]};
+ gadgets.config.init(this.defaultConfig);
+ this.assertEquals("Override", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+};
+
+ConfigTest.prototype.testFindScriptHintPrefixMatch = function() {
+ var testListen;
+ gadgets.config.register("testBasic", null, function(config) {
+ testListen = config;
+ });
+ this.script2.src = "http://www.2.com/js/2.js#hash=1";
+ this.script2.nodeValue = "testBasic: { data: 'Override' }, testSecond: [ 'difftype' ]";
+ window["___jsl"] = { u: "http://www.2.com/js/2.js", f: [ "testBasic", "testSecond" ]};
+ gadgets.config.init(this.defaultConfig);
+ this.assertEquals("Override", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+ this.assertEquals("difftype", testListen.testSecond[0]);
+};
+
+ConfigTest.prototype.testInitMergesNotOverwrites = function() {
+ var testListen;
+ gadgets.config.register("testBasic", null, function(config) {
+ testListen = config;
+ });
+ gadgets.config.init(this.defaultConfig);
+ this.assertEquals("Hello, World!", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+ this.assertEquals("Bar", testListen.testSecond.foo);
+
+ gadgets.config.init({ testBasic: { data: "Override" } });
+ this.assertEquals("Override", testListen.testBasic.data);
+ this.assertEquals("Goodbye", testListen.testBasic.untouched);
+ this.assertEquals("Bar", testListen.testSecond.foo);
+};
+
+ConfigTest.prototype.testUpdateMerge = function() {
+ var testListen;
+ gadgets.config.register("one", null, function(config) {
+ testListen = config;
+ });
+ gadgets.config.init({
+ one: { oneKey1: { oneSubkey1: "oneVal1" }, oneKey2: "data" },
+ two: "twoVal1"
+ });
+ this.assertEquals("oneVal1", testListen.one.oneKey1.oneSubkey1);
+ this.assertEquals("data", testListen.one.oneKey2);
+ this.assertEquals("twoVal1", testListen.two);
+ gadgets.config.update({
+ one: { oneKey1: { oneSubkey1: "updated", oneSubkey2: "newpair" } },
+ two: [ "newtype" ],
+ three: { foo: 123 }
+ });
+ testListen = gadgets.config.get();
+ this.assertEquals("updated", testListen.one.oneKey1.oneSubkey1);
+ this.assertEquals("newpair", testListen.one.oneKey1.oneSubkey2);
+ this.assertEquals("data", testListen.one.oneKey2);
+ this.assertEquals("newtype", testListen.two[0]);
+ this.assertEquals(123, testListen.three.foo);
+};
+
ConfigTest.prototype.testValidator = function() {
var validatorValue;
gadgets.config.register("testValidator", {data: function(value) {
Modified: shindig/trunk/features/src/test/javascript/features/osapi/batchtest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/osapi/batchtest.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/osapi/batchtest.js (original)
+++ shindig/trunk/features/src/test/javascript/features/osapi/batchtest.js Mon Jan 31 22:32:39 2011
@@ -32,6 +32,7 @@ BatchTest.prototype.setUp = function() {
window._setTimeout = window.setTimeout;
window.setTimeout = function(fn, time) { fn.call()};
+ document.scripts = [];
gadgets.config.init({ "osapi.services" : {
"http://%host%/social/rpc" : ["system.listMethods", "people.get", "activities.get",
"activities.create", "appdata.get", "appdata.update", "appdata.delete"] }
Modified: shindig/trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js (original)
+++ shindig/trunk/features/src/test/javascript/features/osapi/jsonrpctransporttest.js Mon Jan 31 22:32:39 2011
@@ -43,6 +43,7 @@ JsonRpcTransportTest.prototype.setUp = f
gadgets.io._makeNonProxiedRequest = gadgets.io.makeNonProxiedRequest;
gadgets.io.makeNonProxiedRequest = this.dummyXhr;
lastXhr = {};
+ document.scripts = [];
gadgets.config.init({ "osapi.services" : {
"http://%host%/social/rpc" : ["system.listMethods", "people.get", "activities.get",
"activities.create", "appdata.get", "appdata.update", "appdata.delete"] }
Modified: shindig/trunk/features/src/test/javascript/features/views/views-init-test.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/views/views-init-test.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/views/views-init-test.js (original)
+++ shindig/trunk/features/src/test/javascript/features/views/views-init-test.js Mon Jan 31 22:32:39 2011
@@ -37,6 +37,7 @@ ViewsInitTest.prototype.testObjectParams
return {"view-params": gadgets.json.stringify({foo: "bar"})};
};
+ document.scripts = [];
gadgets.config.init({views:{}});
this.assertEquals("bar", gadgets.views.getParams().foo);
@@ -50,6 +51,7 @@ ViewsInitTest.prototype.testStringParams
return {"view-params": gadgets.json.stringify(path)};
};
+ document.scripts = [];
gadgets.config.init({views:{}});
this.assertEquals(path, gadgets.views.getParams());
@@ -66,6 +68,7 @@ ViewsInitTest.prototype.testRewriteLinks
}
};
+ document.scripts = [];
gadgets.config.init({views:{rewriteLinks: true}});
this.assertEquals("click", name);
@@ -85,6 +88,7 @@ ViewsInitTest.prototype.testRewriteLinks
addEventListener: undefined
};
+ document.scripts = [];
gadgets.config.init({views:{rewriteLinks: true}});
this.assertEquals("onclick", name);
Modified: shindig/trunk/features/src/test/javascript/features/xhrwrapper/xhrwrappertest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/xhrwrapper/xhrwrappertest.js?rev=1065837&r1=1065836&r2=1065837&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/xhrwrapper/xhrwrappertest.js (original)
+++ shindig/trunk/features/src/test/javascript/features/xhrwrapper/xhrwrappertest.js Mon Jan 31 22:32:39 2011
@@ -42,6 +42,7 @@ XhrWrapperTest.prototype.setUp = functio
gadgets.io.makeRequest = this.mockMakeRequest(this.madeRequest);
window.location = { 'href': 'http://shindig/gadgets/ifr?url=blah' };
opensocial.xmlutil.parseXML = XhrWrapperTest.mockParseXML;
+ document.scripts = [];
gadgets.config.init(
{"shindig.xhrwrapper": {"contentUrl": "http://foo.bar/baz/bax.html"}});
};