shindig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lind...@apache.org
Subject svn commit: r1149287 [2/2] - in /shindig/trunk: content/samplecontainer/examples/commoncontainer/ content/samplecontainer/examples/embeddedexperiences/ content/samplecontainer/examples/media-openGadgets/ features/ features/src/main/javascript/features/...
Date Thu, 21 Jul 2011 18:02:27 GMT
Added: shindig/trunk/features/src/test/javascript/features/open-views/viewEnhancements-test.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/open-views/viewEnhancements-test.js?rev=1149287&view=auto
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/open-views/viewEnhancements-test.js
(added)
+++ shindig/trunk/features/src/test/javascript/features/open-views/viewEnhancements-test.js
Thu Jul 21 18:02:23 2011
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+function ViewEnhancementsTest(name) {
+  TestCase.call(this, name);
+}
+
+ViewEnhancementsTest.inherits(TestCase);
+
+(function() {
+
+  var rpcs, oldRpc = gadgets.rpc;
+
+  ViewEnhancementsTest.prototype.setUp = function() {
+    rpcs = [];
+    gadgets.rpc = {
+      call: function() {
+        rpcs = [];
+        rpcs.push(arguments);
+      }
+    };
+  };
+
+  ViewEnhancementsTest.prototype.tearDown = function() {
+    gadgets.rpc.call = oldRpc;
+  };
+
+  ViewEnhancementsTest.prototype.testOpenGadget = function() {
+    var resultCallback = function() {};
+    var navigateCallback = function() {};
+    var params = {};
+
+    gadgets.views.openGadget(resultCallback, navigateCallback);
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.views.openGadget', rpcs[0][1]);
+    this.assertNull('Assert null error', rpcs[0][2]);
+    this.assertEquals(resultCallback, rpcs[0][3]);
+    this.assertEquals(navigateCallback, rpcs[0][4]);
+    this.assertUndefined('Assert undefined error', rpcs[0][5]);
+
+    gadgets.views.openGadget(resultCallback, navigateCallback, params);
+    this.assertEquals(params, rpcs[0][5]);
+  };
+
+  ViewEnhancementsTest.prototype.testOpenEmbeddedExperience = function() {
+    var resultCallback = function() {};
+    var navigateCallback = function() {};
+    var dataModel = {'url': 'http://www.example.com'};
+    var params = {};
+
+    gadgets.views.openEmbeddedExperience(resultCallback, navigateCallback,
+        dataModel, params);
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.views.openEmbeddedExperience', rpcs[0][1]);
+    this.assertNull('Assert null error', rpcs[0][2]);
+    this.assertEquals(resultCallback, rpcs[0][3]);
+    this.assertEquals(navigateCallback, rpcs[0][4]);
+    this.assertEquals('http://www.example.com', rpcs[0][5]['url']);
+    this.assertEquals(params, rpcs[0][6]);
+  };
+
+  ViewEnhancementsTest.prototype.testOpenUrl = function() {
+    var url = 'www...';
+    var navigateCallback = function() {};
+    var viewTarget = 'dialog';
+
+    gadgets.views.openUrl(url, navigateCallback);
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.views.openUrl', rpcs[0][1]);
+    this.assertNull('Assert null error', rpcs[0][2]);
+    this.assertEquals(url, rpcs[0][3]);
+    this.assertEquals(navigateCallback, rpcs[0][4]);
+    this.assertUndefined('Assert undefined error', rpcs[0][5]);
+
+    gadgets.views.openUrl(url, navigateCallback, viewTarget);
+    this.assertEquals(viewTarget, rpcs[0][5]);
+  };
+
+  ViewEnhancementsTest.prototype.testClose = function() {
+
+    var site = {};
+
+    gadgets.views.close();
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.views.close', rpcs[0][1]);
+    this.assertNull('Assert null error', rpcs[0][2]);
+    this.assertUndefined('Assert undefined error', rpcs[0][3]);
+
+    gadgets.views.close(site);
+    this.assertEquals(site, rpcs[0][3]);
+  };
+
+  ViewEnhancementsTest.prototype.testSetReturnValue = function() {
+
+    var returnValue = {};
+
+    gadgets.views.setReturnValue(returnValue);
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.views.setReturnValue', rpcs[0][1]);
+    this.assertNull('Assert null error', rpcs[0][2]);
+    this.assertEquals(returnValue, rpcs[0][3]);
+  };
+
+  ViewEnhancementsTest.prototype.testGetContainerDimensions = function() {
+
+    var resultCallback = function() {};
+
+    gadgets.window.getContainerDimensions(resultCallback);
+
+    this.assertEquals('..', rpcs[0][0]);
+    this.assertEquals('gadgets.window.getContainerDimensions', rpcs[0][1]);
+    this.assertEquals(resultCallback, rpcs[0][2]);
+    this.assertNull('Assert null error', rpcs[0][3]);
+  };
+
+})();



Mime
View raw message