Author: erinnp
Date: Mon Jul 1 16:10:05 2013
New Revision: 1498539
URL: http://svn.apache.org/r1498539
Log:
adding openajax, widgetmanager tests
Added:
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_openajax_hub.spec
Removed:
rave/branches/require/rave-portal-resources/src/test/dependencies/backbone.js
rave/branches/require/rave-portal-resources/src/test/dependencies/bootstrap.js
rave/branches/require/rave-portal-resources/src/test/dependencies/jqueryHashChange.js
rave/branches/require/rave-portal-resources/src/test/dependencies/jqueryUI.js
Modified:
rave/branches/require/rave-portal-resources/src/test/dependencies/osapi.js
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_widget_manager.spec
Modified:
rave/branches/require/rave-portal-resources/src/test/dependencies/osapi.js
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/test/dependencies/osapi.js?rev=1498539&r1=1498538&r2=1498539&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/test/dependencies/osapi.js
(original)
+++ rave/branches/require/rave-portal-resources/src/test/dependencies/osapi.js
Mon Jul 1 16:10:05 2013
@@ -1,10 +1,23 @@
-/**
- * Created with IntelliJ IDEA.
- * User: dgornstein
- * Date: 6/26/13
- * Time: 8:29 AM
- * To change this template use File | Settings | File Templates.
+/*
+ * 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.
*/
+
+
window.___jsl=window.___jsl||{};
(window.___jsl.ci=window.___jsl.ci||[]).push({opensocial:{invalidatePath:"http://%host%/rpc",path:"http://%host%/rpc",domain:"shindig",supportedFields:{person:["id",{name:["familyName","givenName","unstructured"]},"thumbnailUrl","profileUrl"],mediaItem:"album_id
created description duration file_size id language last_updated location
mime_type num_comments num_views num_votes rating start_time tagged_people tags
thumbnail_url title type url".split(" "),album:"id thumbnailUrl title
description location ownerId".split(" "),group:["id",
"title","description"],activity:"appId body bodyId externalId id
mediaItems postedTime priority streamFaviconUrl streamSourceUrl streamTitle
streamUrl templateParams title url userId".split(" "),activityEntry:"actor
content generator icon id object published provider target title updated url
verb openSocial extensions".split("
")},enableCaja:!1},rpc:{commSwf:"/xpc.swf",passReferrer:"c2p:query",parentRelayUrl:"/container/rpc_relay.html",useLegacyProtocol:!1},"shindig.auth":{},views:{"default":{isOnlyVisible:!1,
Added:
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_openajax_hub.spec
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_openajax_hub.spec?rev=1498539&view=auto
==============================================================================
---
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_openajax_hub.spec
(added)
+++
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_openajax_hub.spec
Mon Jul 1 16:10:05 2013
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+describe('rave_openajax_hub', function(){
+ it('managed hub gets created correctly', function(){
+ OpenAjax = {}
+ OpenAjax.hub = {}
+ OpenAjax.hub.ManagedHub = function(){}
+
+ spyOn(OpenAjax.hub, 'ManagedHub')
+
+ expect(OpenAjax.hub.ManagedHub).not.toHaveBeenCalled()
+
+ OpenAjaxHub = testr('core/rave_openajax_hub', {
+ 'osapi': OpenAjax
+ })
+
+ expect(OpenAjax.hub.ManagedHub).toHaveBeenCalled()
+
+ })
+})
Modified:
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_widget_manager.spec
URL:
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_widget_manager.spec?rev=1498539&r1=1498538&r2=1498539&view=diff
==============================================================================
---
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_widget_manager.spec
(original)
+++
rave/branches/require/rave-portal-resources/src/test/javascript/core/rave_widget_manager.spec
Mon Jul 1 16:10:05 2013
@@ -43,7 +43,8 @@ describe('rave_widget_manager', function
"userPrefs": { "headlineCount": "9", "summaryCount": "1"},
"collapsed": false,
"widgetId": "3",
- "regionId": "1"
+ "regionId": "1",
+ "render": function(){}
};
widget2 = {
@@ -67,7 +68,8 @@ describe('rave_widget_manager', function
"userPrefs": { "headlineCount": "9", "summaryCount": "1"},
"collapsed": false,
"widgetId": "3",
- "regionId": "2"
+ "regionId": "2",
+ "render":function(){}
};
/*************************
@@ -140,21 +142,6 @@ describe('rave_widget_manager', function
expect(registeredWidget1).toEqual(widget1);
expect(registeredWidget2).toEqual(widget2);
});
- /*
- it('does not call RegionWidget constructor until rave.init is called',
function () {
- WidgetManager.registerWidget(widget1);
- expect(mockRegionWidget.RegionWidget).not.toHaveBeenCalled();
- eventManager.init();
- expect(mockRegionWidget.RegionWidget).toHaveBeenCalled();
- });
-
- it('instatiates a new RegionWidget immediately if rave.init was
already called', function () {
- expect(rave.RegionWidget).not.toHaveBeenCalled();
- rave.init();
- rave.registerWidget(widget1);
- expect(rave.RegionWidget).toHaveBeenCalled();
- });*/
-
});
describe('unregisterWidget', function () {
@@ -198,4 +185,17 @@ describe('rave_widget_manager', function
expect(WidgetManager.getWidgets({widgetId:
"3"})).toEqual([widget1, widget2]);
});
});
+
+ describe('renderWidgets', function(){
+ it('renders the widget correctly', function(){
+ WidgetManager.registerWidget(widget1);
+ var widget = WidgetManager.getWidget(widget1.regionWidgetId);
+
+ spyOn(widget, 'render');
+
+ expect(widget.render).not.toHaveBeenCalled();
+ WidgetManager.renderWidgets('el', 'opts');
+ expect(widget.render).toHaveBeenCalled();
+ })
+ })
});