1from nevow import loaders, tags 2from nevow.livetrial import testcase 3 4 5class SetNodeContent(testcase.TestCase): 6 jsClass = u'Divmod.Runtime.Tests.SetNodeContent' 7 8 9 10class AppendNodeContent(testcase.TestCase): 11 jsClass = u'Divmod.Runtime.Tests.AppendNodeContent' 12 13 14 15class AppendNodeContentScripts(testcase.TestCase): 16 jsClass = u'Divmod.Runtime.Tests.AppendNodeContentScripts' 17 18 19 20class ElementSize(testcase.TestCase): 21 jsClass = u'Divmod.Runtime.Tests.ElementSize' 22 23 24 def getWidgetDocument(self): 25 """ 26 Return part of a document which contains some explicitly sized 27 elements. The client portion of this test will retrieve them by their 28 class value and assert things about their size. 29 """ 30 return tags.div[ 31 tags.div(class_='foo', style='height: 126px; width: 1px'), 32 tags.div(class_='bar', style='padding: 1px 2px 3px 4px; height: 12px; width: 70px')] 33 34 35class ElementsByTagNameShallow(testcase.TestCase): 36 jsClass = u'Divmod.Runtime.Tests.ElementsByTagNameShallow' 37 38 def getWidgetDocument(self): 39 """ 40 Return part of a document which consists of an element with some 41 immediate child and some grandchild. The client portion of this test 42 will make sure only the immediate children are returned by 43 C{getElementsByTagNameShallow}. 44 """ 45 return tags.div(class_="foo")[tags.p["foo"], tags.div[tags.p["bar"]]] 46 47 48class PageSize(testcase.TestCase): 49 jsClass = u'Divmod.Runtime.Tests.PageSize' 50 51 52 53class TraversalOrdering(testcase.TestCase): 54 jsClass = u'Divmod.Runtime.Tests.TraversalOrdering' 55 56 def getWidgetDocument(self): 57 """ 58 Return part of a document which contains nodes nested several layers 59 deep. The client side of this test will use their class names to 60 determine that ordering of results from the DOM traversal function is 61 correct. 62 """ 63 return tags.div(_class='container')[ 64 tags.div(_class='left_child')[ 65 tags.div(_class='left_grandchild')], 66 tags.div(_class='right_child')[ 67 tags.div(_class='right_grandchild')]] 68 69 70 71class FindInRootNode(testcase.TestCase): 72 jsClass = u'Divmod.Runtime.Tests.FindInRootNode' 73 74 75 76class Standalone(testcase.TestCase): 77 jsClass = u'Divmod.Runtime.Tests.Standalone' 78 79 80 81class ElementPosition(testcase.TestCase): 82 """ 83 Tests for the element position-getting methods 84 """ 85 jsClass = u'Divmod.Runtime.Tests.ElementPosition' 86 87 88 89class LoadScript(testcase.TestCase): 90 """ 91 Tests for C{Divmod.Runtime.Platform.loadScript}. 92 """ 93 jsClass = u'Divmod.Runtime.Tests.LoadScript' 94