[py-svn] r34783 - py/dist/py/test/rsession/testing

guido at codespeak.net guido at codespeak.net
Mon Nov 20 12:58:53 CET 2006


Author: guido
Date: Mon Nov 20 12:58:51 2006
New Revision: 34783

Modified:
   py/dist/py/test/rsession/testing/test_webjs.py
Log:
Some more webjs tests.


Modified: py/dist/py/test/rsession/testing/test_webjs.py
==============================================================================
--- py/dist/py/test/rsession/testing/test_webjs.py	(original)
+++ py/dist/py/test/rsession/testing/test_webjs.py	Mon Nov 20 12:58:51 2006
@@ -26,3 +26,41 @@
     assert msgbox.childNodes[0].nodeName == 'PRE'
     assert msgbox.childNodes[0].childNodes[0].nodeValue == 'foo\nbar'
 
+def test_show_info():
+    info = dom.window.document.getElementById('info')
+    info.style.visibility = 'hidden'
+    info.innerHTML = ''
+    webjs.show_info('foobar')
+    content = info.innerHTML
+    assert content == 'foobar'
+    bgcolor = info.style.backgroundColor
+    assert bgcolor == 'beige'
+
+def test_hide_info():
+    info = dom.window.document.getElementById('info')
+    info.style.visibility = 'visible'
+    webjs.hide_info()
+    assert info.style.visibility == 'hidden'
+
+def test_process():
+    main_t = dom.window.document.getElementById('main_table')
+    assert len(main_t.getElementsByTagName('tr')) == 0
+    assert not webjs.process({})
+
+    msg = {'type': 'ItemStart',
+           'itemtype': 'Module',
+           'itemname': 'foo.py',
+           'fullitemname': 'modules/foo.py',
+           'length': 10,
+           }
+    assert webjs.process(msg)
+    trs = main_t.getElementsByTagName('tr')
+    assert len(trs) == 1
+    tr = trs[0]
+    assert len(tr.childNodes) == 2
+    assert tr.childNodes[0].nodeName == 'TD'
+    assert tr.childNodes[0].innerHTML == 'foo.py[10]'
+    # XXX this is bad I think! table should be inside td
+    assert tr.childNodes[1].nodeName == 'TABLE'
+    assert len(tr.childNodes[1].getElementsByTagName('tr')) == 0
+



More information about the pytest-commit mailing list