Permalink
Browse files

use a div to put tests in

git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@2228 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information...
1 parent e99ceda commit c66b15d4d199fd45237dc3554760107a42925b00 lkcl committed Nov 8, 2009
@@ -9,12 +9,10 @@ class LabelTest(UnitTest):
def testLabelAdd(self):
self.l = Label("Hello World (label)", StyleName='teststyle')
- RootPanel().add(self.l)
- ht = doc().body.innerHTML
- self.write_test_output(ht, 'addlabel')
+ RootPanel('tests').add(self.l)
+ self.write_test_output('addlabel')
- if not RootPanel().remove(self.l):
+ if not RootPanel('tests').remove(self.l):
self.fail("Label added but apparently not owned by RootPanel()")
- ht = doc().body.innerHTML
- self.write_test_output(ht, 'removelabel')
+ self.write_test_output('removelabel')
@@ -5,6 +5,7 @@
IN_JS = sys.platform in ['mozilla', 'ie6', 'opera', 'oldmoz',
'safari', 'spidermonkey', 'pyv8']
+from pyjamas import DOM
from pyjamas.Timer import Timer
from pyjamas.HTTPRequest import HTTPRequest
@@ -57,7 +58,12 @@ def do_test(self, output, name):
fname = "%s.txt" % self.current_test_name
HTTPRequest().asyncGet(fname, handler)
- def write_test_output(self, output, name=None):
+ def write_test_output(self, name=None, div_id=None):
+ if div_id is None:
+ div_id = 'tests'
+ element = DOM.getElementById(div_id)
+ output = element.innerHTML
+
if self.test_gen_folder is None:
if self.tests_outstanding is None:
self.tests_outstanding = 0
@@ -76,6 +82,9 @@ def write_test_output(self, output, name=None):
f.write(output)
f.close()
+ if self.tests_outstanding is None:
+ self.tests_outstanding = 0
+
return False
def _run_test(self, test_method_name):
@@ -91,13 +100,6 @@ def _run_test(self, test_method_name):
def run(self):
self.getTestMethods()
- #if not IN_BROWSER:
- # for test_method_name in self.test_methods:
- # self._run_test(test_method_name)
- # self.displayStats()
- # if hasattr(self, "start_next_test"):
- # self.check_start_next_test()
- # return
self.test_idx = 0
Timer(1, self)
@@ -1,3 +1 @@
-<pre>Unit Tests will appear and disappear.</pre>
-<script language="javascript" src="bootstrap.js"></script>
<div style="white-space: normal;" class="teststyle">Hello World (label)</div>
@@ -1,2 +0,0 @@
-<pre>Unit Tests will appear and disappear.</pre>
-<script language="javascript" src="bootstrap.js"></script>
@@ -9,5 +9,6 @@
</head>
<body bgcolor="white"><pre>Unit Tests will appear and disappear.</pre>
<script language="javascript" src="bootstrap.js"></script>
+<div id='tests'></div>
</body>
</html>

0 comments on commit c66b15d

Please sign in to comment.