incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r426275 - in /incubator/xap/trunk/testsrc: XapUnitTestSuite.html xap/mco/_TestDeclarativeArgumentParser.html xap/mco/_TestDeclarativeArgumentParser.js
Date Thu, 27 Jul 2006 22:11:10 GMT
Author: mturyn
Date: Thu Jul 27 15:11:09 2006
New Revision: 426275

URL: http://svn.apache.org/viewvc?rev=426275&view=rev
Log:
Peter's new MCO parser tests added, and added to the test suite..

Added:
    incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html   (with props)
    incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js   (with props)
Modified:
    incubator/xap/trunk/testsrc/XapUnitTestSuite.html

Modified: incubator/xap/trunk/testsrc/XapUnitTestSuite.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/XapUnitTestSuite.html?rev=426275&r1=426274&r2=426275&view=diff
==============================================================================
--- incubator/xap/trunk/testsrc/XapUnitTestSuite.html (original)
+++ incubator/xap/trunk/testsrc/XapUnitTestSuite.html Thu Jul 27 15:11:09 2006
@@ -66,6 +66,12 @@
             return result;
         }
         
+        function mcoSuite( webappContext ) {
+        	var result = new top.jsUnitTestSuite();
+            result.addTestPage( webappContext + "/testsrc/xap/mco/_TestDeclarativeArgumentParser.html"
);
+            return result;
+        }        
+        
         
         function suite() {
             var suite = new top.jsUnitTestSuite();
@@ -79,6 +85,7 @@
             suite.addTestSuite( sessionSuite( webappContext ) );
             suite.addTestSuite( xModifySuite( webappContext ) );
             suite.addTestSuite( xModifyHTMLSuite( webappContext ) );
+            
             
             return suite;
         }

Added: incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html?rev=426275&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html (added)
+++ incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html Thu Jul 27 15:11:09
2006
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
+	"http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+	<title>Element Unit Tests</title>
+	<link rel="stylesheet" type="text/css" href="/jsunit/jsunit/css/jsUnitStyle.css">
+	<script language="JavaScript" type="text/javascript" src="/jsunit/jsunit/app/jsUnitCore.js"></script>
+	<script language="JavaScript" type="text/javascript" src="/jsunit/src/dojo/dojo.js"></script>
+	<script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/util/Utils.js"></script>
+	<script language="JavaScript" type="text/javascript" src="/jsunit/src/xap/Xap.js"></script>
+	
+	<script language="JavaScript" type="text/javascript" src="_TestDeclarativeArgumentParser.js"></script>
+	
+	<script language="JavaScript" type="text/javascript">
+		Xap.bootstrap( "/jsunit" );
+  	</script>
+</head>
+
+<body>
+  		
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js?rev=426275&view=auto
==============================================================================
--- incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js (added)
+++ incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js Thu Jul 27 15:11:09
2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed 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 SimpleMco() {
+}
+ 
+SimpleMco.prototype.hello = function() {
+   return 'hello';
+}
+
+SimpleMco.prototype.getInt = function(i,j) {
+   return i;
+}
+
+SimpleMco.prototype.sum = function(i,j) {
+   return i + j;
+}
+
+SimpleMco.prototype.getString = function(s) {
+   return s;
+}
+
+ 
+ 
+function exposeTestFunctionNames(){
+	 return ["testParser"];
+}
+
+function testParser() {
+
+   /* var session = new xap.session.ClientSession('', '', document.body); */
+    
+   var session = {
+     getMcoContainer: function() {return this._mcoContainer},
+     getEventHandler: function() {return this._eventHandler},
+     getDeclarativeArgumentParser: function() {return this._declarativeArgumentParser},
+     addContainer: function(name, container) {this._namesToContainers.put(name, container)},
+     getContainer: function(name) {return this._namesToContainers.get(name)},
+     getDocumentContainer: function() {return this._documentContainer},
+     initialize: function() {
+        this._declarativeArgumentParser = new xap.session.DeclarativeArgumentParser(this);
+        this._documentContainer = new xap.xml.DocumentContainer(this);
+        this._namesToContainers = new xap.util.Hashtable(this);
+        this._eventHandler = new xap.session.EventHandler(this);
+        this._mcoContainer = new xap.session.Container(this);
+        this.addContainer('mco', this._mcoContainer); 
+     }
+   };
+   
+   session.initialize();
+   
+   var mcoContainer = session.getMcoContainer();
+   mcoContainer.put('simple', new SimpleMco());
+   
+   /*var buttonElement =  document.createElement('button');
+   buttonElement.setAttribute('text', 'button text');*/
+   
+    var doc = new xap.xml.dom.Document(null);
+    var buttonElement = doc.createElement('button');
+    buttonElement.setAttribute('text', 'my button text');   
+   
+
+   var eventHandler = session.getEventHandler();
+   
+   assertNotNull('NOT NULL => EVENTHANDLER', eventHandler);
+   assertNotNull("HAS EVENT", eventHandler._handleObjectEvent);
+   
+   var test = eventHandler._handleObjectEvent('mco:simple.hello()', buttonElement); 
+   assertTrue("String Test", test == 'hello');
+   
+   test = eventHandler._handleObjectEvent('mco:simple.getInt(10,11)', buttonElement); 
+   assertTrue("Integer Test", test == 10);
+   
+   test = eventHandler._handleObjectEvent('mco:simple.sum(10,11)', buttonElement); 
+   assertTrue("Sum Test", test == 21);
+
+   test = eventHandler._handleObjectEvent('mco:simple.getString("nice day")', buttonElement);

+   assertTrue("Parameter String Test", test == 'nice day');
+   
+   test = eventHandler._handleObjectEvent('mco:simple.getString(this.text)', buttonElement);

+   assertTrue("THIS Test", test == 'my button text');
+
+}
+
+
+
+
+
+	
+	
\ No newline at end of file

Propchange: incubator/xap/trunk/testsrc/xap/mco/_TestDeclarativeArgumentParser.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message