Sha256: 35541c20ef8cd55780b383d6af0257ab258fdabd2dc2ceaca681b66dd4744656

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

dojo.provide("dojox.rpc.tests.Wikipedia");
dojo.require("dojo.io.script");
dojo.require("dojox.rpc.Service");

dojox.rpc.tests.wikipediaService = new dojox.rpc.Service(dojo.moduleUrl("dojox.rpc.SMDLibrary", "wikipedia.smd"));

dojox.rpc.tests.wikipediaService.TEST_METHOD_TIMEOUT = 8000;

dojox.rpc.tests.wikipediaService._query = function(q){
	return function(m){
		var d = new doh.Deferred();

		if (q.parameters && q.parameters.action && q.expectedResult) {
			var wp = dojox.rpc.tests.wikipediaService.query(q.parameters);
			wp.addCallback(this, function(result){
				console.log(result);
				if (result[q.expectedResult]){
					d.callback(true);
				}else{
					d.errback(new Error("Unexpected Return Value: ", result));
				}
			});
		}

		return d;
	}
};

doh.register("dojox.rpc.tests.wikipedia", 
	[
		{
			name: "#1, Wikipedia::parse",
			timeout: dojox.rpc.tests.wikipediaService.TEST_METHOD_TIMEOUT,
			runTest: dojox.rpc.tests.wikipediaService._query({
				parameters: {
					action: "parse",
					page: "Dojo Toolkit"
				},
				expectedResult: "parse"
			})
		},
		{
			name: "#2, Wikipedia::search",
			timeout: dojox.rpc.tests.wikipediaService.TEST_METHOD_TIMEOUT,
			runTest: dojox.rpc.tests.wikipediaService._query({
				parameters: {
					action: "query",
					list: "search",
					srwhat: "text",
					srsearch: "Dojo Toolkit"
				},
				expectedResult: "query"
			})
		}
]);

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
dojo_src-1.5.0 dojo/dojox/rpc/tests/Wikipedia.js
dojo_src-1.4.3 dojo/dojox/rpc/tests/Wikipedia.js
dojo_src-1.4.102 dojo/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.132.0 data/dojo-release-1.3.2-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.120.0 data/dojo-release-1.2.0-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.121.0 data/dojo-release-1.2.1-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.122.0 data/dojo-release-1.2.2-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.123.0 data/dojo-release-1.2.3-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.130.0 data/dojo-release-1.3.0-src/dojox/rpc/tests/Wikipedia.js
dojo-pkg-1.131.0 data/dojo-release-1.3.1-src/dojox/rpc/tests/Wikipedia.js