Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ResourceRegistries.tests.testCSSRegistry.TestStylesheetRegistration Class Reference
Inheritance diagram for ResourceRegistries.tests.testCSSRegistry.TestStylesheetRegistration:
Inheritance graph
[legend]
Collaboration diagram for ResourceRegistries.tests.testCSSRegistry.TestStylesheetRegistration:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testStoringStylesheet
def testDefaultStylesheetAttributes
def testStylesheetAttributes
def testDisallowingDuplicateIds
def testPloneCustomStaysOnTop
def testUnregisterStylesheet
def testStylesheetsDict

Public Attributes

 tool

Detailed Description

Definition at line 63 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 65 of file testCSSRegistry.py.

00065 
00066     def afterSetUp(self):
00067         self.tool = getattr(self.portal, CSSTOOLNAME)
00068         self.tool.clearResources()

Definition at line 74 of file testCSSRegistry.py.

00074 
00075     def testDefaultStylesheetAttributes(self):
00076         self.tool.registerStylesheet('foodefault')
00077         self.assertEqual(self.tool.getResources()[0].getId(), 'foodefault')
00078         self.assertEqual(self.tool.getResources()[0].getExpression(), '')
00079         self.assertEqual(self.tool.getResources()[0].getMedia(), None)
00080         self.assertEqual(self.tool.getResources()[0].getRel(), 'stylesheet')
00081         self.assertEqual(self.tool.getResources()[0].getTitle(), None)
00082         self.assertEqual(self.tool.getResources()[0].getRendering(), 'import')
00083         self.failUnless(self.tool.getResources()[0].getEnabled())

Definition at line 96 of file testCSSRegistry.py.

00096 
00097     def testDisallowingDuplicateIds(self):
00098         self.tool.registerStylesheet('foo')
00099         self.assertRaises(ValueError, self.tool.registerStylesheet, 'foo')

Definition at line 100 of file testCSSRegistry.py.

00100 
00101     def testPloneCustomStaysOnTop(self):
00102         self.tool.registerStylesheet('foo')
00103         self.tool.registerStylesheet('ploneCustom.css')
00104         self.tool.registerStylesheet('bar')
00105         self.assertEqual(len(self.tool.getResources()), 3)
00106         self.assertEqual(self.tool.getResourceIds(),
00107                          ('foo', 'bar', 'ploneCustom.css'))

Definition at line 69 of file testCSSRegistry.py.

00069 
00070     def testStoringStylesheet(self):
00071         self.tool.registerStylesheet('foo')
00072         self.assertEqual(len(self.tool.getResources()), 1)
00073         self.assertEqual(self.tool.getResources()[0].getId(), 'foo')

Definition at line 84 of file testCSSRegistry.py.

00084 
00085     def testStylesheetAttributes(self):
00086         self.tool.registerStylesheet('foo', expression='python:1',
00087                                      media='print', rel='alternate stylesheet',
00088                                      title='Foo', rendering='inline', enabled=0)
00089         self.assertEqual(self.tool.getResources()[0].getId(), 'foo')
00090         self.assertEqual(self.tool.getResources()[0].getExpression(), 'python:1')
00091         self.assertEqual(self.tool.getResources()[0].getMedia(), 'print')
00092         self.assertEqual(self.tool.getResources()[0].getRel(), 'alternate stylesheet')
00093         self.assertEqual(self.tool.getResources()[0].getTitle(), 'Foo')
00094         self.assertEqual(self.tool.getResources()[0].getRendering(), 'inline')
00095         self.failIf(self.tool.getResources()[0].getEnabled())

Definition at line 115 of file testCSSRegistry.py.

00115 
00116     def testStylesheetsDict(self):
00117         self.tool.registerStylesheet('spam')
00118         self.tool.registerStylesheet('ham')
00119         keys = self.tool.getResourcesDict().keys()
00120         keys.sort()
00121         res = ['ham', 'spam']
00122         res.sort()
00123         self.assertEqual(res, keys)
00124         self.assertEqual(self.tool.getResourcesDict()['ham'].getId(), 'ham')
00125 

Definition at line 108 of file testCSSRegistry.py.

00108 
00109     def testUnregisterStylesheet(self):
00110         self.tool.registerStylesheet('foo')
00111         self.assertEqual(len(self.tool.getResources()), 1)
00112         self.assertEqual(self.tool.getResources()[0].getId(), 'foo')
00113         self.tool.unregisterResource('foo')
00114         self.assertEqual(len(self.tool.getResources()), 0)


Member Data Documentation

Definition at line 66 of file testCSSRegistry.py.


The documentation for this class was generated from the following file: