shindig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbaxte...@apache.org
Subject svn commit: r1351771 - in /shindig/trunk/features/src: main/javascript/features/embeddedexperiences/embedded_experiences_container.js test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js
Date Tue, 19 Jun 2012 16:38:40 GMT
Author: rbaxter85
Date: Tue Jun 19 16:38:40 2012
New Revision: 1351771

URL: http://svn.apache.org/viewvc?rev=1351771&view=rev
Log:
SHINDIG-1802
We handle invalid EE data model target types incorrectly in the EE container code

Modified:
    shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
    shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js

Modified: shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js?rev=1351771&r1=1351770&r2=1351771&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
(original)
+++ shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
Tue Jun 19 16:38:40 2012
@@ -145,7 +145,12 @@
         if (pe[ee_pe.TARGET]) {
           var peTarget = pe[ee_pe.TARGET];
           if(peTarget && peTarget[ee_pe.TYPE]) {
-            return peTarget[ee_pe.TYPE];
+            var type = peTarget[ee_pe.TYPE];
+            if((osapi.container.ee.TargetType.URL === type && typeof dataModel.url
!== 'undefined') ||
+                    (osapi.container.ee.TargetType.GADGET === type &&
+                            typeof dataModel.gadget !== 'undefined')) {
+              return type
+            }
           }
         }
       }

Modified: shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js?rev=1351771&r1=1351770&r2=1351771&view=diff
==============================================================================
--- shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js
(original)
+++ shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js
Tue Jun 19 16:38:40 2012
@@ -115,6 +115,43 @@ EEContainerTest.prototype.testNavigateGa
 
 };
 
+EEContainerTest.prototype.testNavigateGadgetWithBadGadgetTarget = function() {
+  this.setupGadgetsRpcRegister();
+  var container = new osapi.container.Container({});
+  var eeDataModel =
+    {'url' : 'http://example.com/myee.html',
+      'preferredExperience' : {'target' : {'type' : 'gadget','view' : 'my-ee-view', 'viewTarget'
: 'DIALOG'},
+      'display' : {'type' : 'text', 'label' : 'Click me to say Hello World'}}};
+
+  this.setupUrlSite(1, null, null);
+  this.setupPreload();
+  container.ee.navigate({}, eeDataModel, {});
+
+  // verify
+  this.assertEquals('http://example.com/myee.html', this.urlsite_render_url);
+
+};
+
+EEContainerTest.prototype.testNavigateGadgetWithBadUrlTarget = function() {
+  this.setupGadgetsRpcRegister();
+  var container = new osapi.container.Container({});
+  var eeDataModel =
+    {'gadget' : 'http://example.com/myee.xml', 'context' : {'objectid' : '123'},
+      'preferredExperience' : {'target' : {'type' : 'url', 'viewTarget' : 'DIALOG'},
+      'display' : {'type' : 'text', 'label' : 'Click me to say Hello World'}}};
+
+  this.setupGadgetSite(1, {}, null);
+  this.setupPreload();
+  container.ee.navigate({}, eeDataModel, {});
+
+  // verify
+  var renderParamDataModel = this.site_navigateTo_renderParams['eeDataModel'];
+  this.assertEquals('http://example.com/myee.xml', renderParamDataModel.gadget);
+  this.assertEquals({"objectid":"123"}, renderParamDataModel.context);
+  this.assertEquals('embedded', this.site_navigateTo_renderParams['view']);
+
+};
+
 EEContainerTest.prototype.testGadgetNavigateWithCustomEENavigation = function() {
       this.setupGadgetsRpcRegister();
       var customEENavigate = function(dataModel) {



Mime
View raw message