Back to index

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

List of all members.

Public Member Functions

def afterSetUp
def testStylesheetCooking
def testStylesheetCookingValues
def testGetEvaluatedStylesheetsCollapsing
def testMoreComplexStylesheetsCollapsing
def testConcatenatedStylesheetsHaveNoMedia
def testGetEvaluatedStylesheetsWithExpression
def testGetEvaluatedStylesheetsWithFailingExpression
def testGetEvaluatedStylesheetsWithContextualExpression
def testCollapsingStylesheetsLookup
def testRenderingIsInTheRightOrder
def testConcatenatedSheetsAreInTheRightOrderToo
def testRenderingStylesheetLinks
def testReenderingConcatenatesInline
def testDifferentMediaAreCollapsed
def testDifferentRenderingAreNotCollapsed
def testRenderingWorksInMainTemplate

Public Attributes

 tool

Detailed Description

Definition at line 201 of file testCSSRegistry.py.


Member Function Documentation

Definition at line 203 of file testCSSRegistry.py.

00203 
00204     def afterSetUp(self):
00205         self.tool = getattr(self.portal, CSSTOOLNAME)
00206         self.tool.clearResources()

Definition at line 283 of file testCSSRegistry.py.

00283 
00284     def testCollapsingStylesheetsLookup(self):
00285         self.tool.registerStylesheet('ham')
00286         self.tool.registerStylesheet('spam', expression='string:ham')
00287         self.tool.registerStylesheet('spam spam', expression='string:ham')
00288         evaluated = self.tool.getEvaluatedResources(self.folder)
00289         self.assertEqual(len(evaluated), 2)
00290         self.tool.setAutoGroupingMode(True)
00291         evaluated = self.tool.getEvaluatedResources(self.folder)
00292         self.assertEqual(len(evaluated), 2)

Here is the call graph for this function:

Definition at line 305 of file testCSSRegistry.py.

00305 
00306     def testConcatenatedSheetsAreInTheRightOrderToo(self):
00307         self.tool.registerStylesheet('ham')
00308         self.tool.registerStylesheet('spam')
00309         self.tool.registerStylesheet('eggs')
00310         evaluated = self.tool.getEvaluatedResources(self.folder)
00311         results = self.tool.concatenatedresources[evaluated[0].getId()]
00312         self.failUnless(results[0] == 'ham')
00313         self.failUnless(results[1] == 'spam')
00314         self.failUnless(results[2] == 'eggs')
00315         self.tool.setAutoGroupingMode(True)
00316         evaluated = self.tool.getEvaluatedResources(self.folder)
00317         results = self.tool.concatenatedresources[evaluated[0].getId()]
00318         self.failUnless(results[0] == 'ham')
00319         self.failUnless(results[1] == 'spam')
00320         self.failUnless(results[2] == 'eggs')

Here is the call graph for this function:

Definition at line 256 of file testCSSRegistry.py.

00256 
00257     def testConcatenatedStylesheetsHaveNoMedia(self):
00258         self.tool.registerStylesheet('ham')
00259         self.tool.registerStylesheet('spam', media='print')
00260         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)
00261         self.failIf(self.tool.getEvaluatedResources(self.folder)[0].getMedia())

Here is the call graph for this function:

Definition at line 347 of file testCSSRegistry.py.

00347 
00348     def testDifferentMediaAreCollapsed(self):
00349         self.tool.registerStylesheet('test_rr_1.css', media='print')
00350         self.tool.registerStylesheet('test_rr_2.css', media='all')
00351         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)

Here is the call graph for this function:

Definition at line 352 of file testCSSRegistry.py.

00352 
00353     def testDifferentRenderingAreNotCollapsed(self):
00354         self.tool.registerStylesheet('ham', rendering='inline')
00355         self.tool.registerStylesheet('spam', rendering='link')
00356         self.tool.registerStylesheet('egg', rendering='inline')
00357         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 3)
00358         self.tool.setAutoGroupingMode(True)
00359         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 2)

Here is the call graph for this function:

Definition at line 227 of file testCSSRegistry.py.

00227 
00228     def testGetEvaluatedStylesheetsCollapsing(self):
00229         self.tool.registerStylesheet('ham')
00230         self.tool.registerStylesheet('spam')
00231         self.tool.registerStylesheet('eggs')
00232         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)

Here is the call graph for this function:

Definition at line 276 of file testCSSRegistry.py.

00276 
00277     def testGetEvaluatedStylesheetsWithContextualExpression(self):
00278         self.folder.invokeFactory('Document', 'eggs')
00279         self.tool.registerStylesheet('spam', expression='python:"eggs" in object.objectIds()')
00280         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)
00281         self.tool.setAutoGroupingMode(True)
00282         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)

Here is the call graph for this function:

Definition at line 262 of file testCSSRegistry.py.

00262 
00263     def testGetEvaluatedStylesheetsWithExpression(self):
00264         self.tool.registerStylesheet('ham')
00265         self.tool.registerStylesheet('spam', expression='python:1')
00266         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 2)
00267         self.tool.setAutoGroupingMode(True)
00268         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 2)

Here is the call graph for this function:

Definition at line 269 of file testCSSRegistry.py.

00269 
00270     def testGetEvaluatedStylesheetsWithFailingExpression(self):
00271         self.tool.registerStylesheet('ham')
00272         self.tool.registerStylesheet('spam', expression='python:0')
00273         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)
00274         self.tool.setAutoGroupingMode(True)
00275         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 1)

Here is the call graph for this function:

Definition at line 233 of file testCSSRegistry.py.

00233 
00234     def testMoreComplexStylesheetsCollapsing(self):
00235         self.tool.registerStylesheet('ham')
00236         self.tool.registerStylesheet('spam', expression='string:spam')
00237         self.tool.registerStylesheet('spam spam', expression='string:spam')
00238         self.tool.registerStylesheet('spam spam spam', expression='string:spam')
00239         self.tool.registerStylesheet('eggs')
00240         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 3)
00241         magic_ids = [item.getId() for item in self.tool.getEvaluatedResources(self.folder)]
00242         self.failUnless('ham' in self.tool.concatenatedresources[magic_ids[0]])
00243         self.failUnless('eggs' in self.tool.concatenatedresources[magic_ids[2]])
00244         self.failUnless('spam' in self.tool.concatenatedresources[magic_ids[1]])
00245         self.failUnless('spam spam' in self.tool.concatenatedresources[magic_ids[1]])
00246         self.failUnless('spam spam spam' in self.tool.concatenatedresources[magic_ids[1]])
00247 
00248         self.tool.setAutoGroupingMode(True)
00249         self.assertEqual(len(self.tool.getEvaluatedResources(self.folder)), 2)
00250         magic_ids = [item.getId() for item in self.tool.getEvaluatedResources(self.folder)]
00251         self.failUnless('ham' in self.tool.concatenatedresources[magic_ids[0]])
00252         self.failUnless('eggs' in self.tool.concatenatedresources[magic_ids[0]])
00253         self.failUnless('spam' in self.tool.concatenatedresources[magic_ids[1]])
00254         self.failUnless('spam spam' in self.tool.concatenatedresources[magic_ids[1]])
00255         self.failUnless('spam spam spam' in self.tool.concatenatedresources[magic_ids[1]])

Here is the call graph for this function:

Definition at line 337 of file testCSSRegistry.py.

00337 
00338     def testReenderingConcatenatesInline(self):
00339         self.tool.registerStylesheet('test_rr_1.css', rendering='inline')
00340         self.tool.registerStylesheet('test_rr_2.css', rendering='inline')
00341         view = self.portal.restrictedTraverse('@@plone')
00342         viewletmanager = getMultiAdapter((self.portal, self.portal.REQUEST, view), IContentProvider, name = u'plone.resourceregistries.styles')
00343         viewletmanager.update()
00344         all = viewletmanager.render()
00345         self.failUnless('background-color' in all)
00346         self.failUnless('blue' in all)

Here is the call graph for this function:

Definition at line 293 of file testCSSRegistry.py.

00293 
00294     def testRenderingIsInTheRightOrder(self):
00295         self.tool.registerStylesheet('ham', expression='string:ham')
00296         self.tool.registerStylesheet('spam', expression='string:spam')
00297         evaluated = self.tool.getEvaluatedResources(self.folder)
00298         magic_ids = [item.getId() for item in evaluated]
00299         ids = []
00300         for magic_id in magic_ids:
00301             self.assertEqual(len(self.tool.concatenatedresources[magic_id]), 1)
00302             ids.append(self.tool.concatenatedresources[magic_id][0])
00303         self.failUnless(ids[0] == 'ham')
00304         self.failUnless(ids[1] == 'spam')

Here is the call graph for this function:

Definition at line 321 of file testCSSRegistry.py.

00321 
00322     def testRenderingStylesheetLinks(self):
00323         self.tool.registerStylesheet('ham', rendering='link')
00324         self.tool.registerStylesheet('ham 2 b merged', rendering='link')
00325         self.tool.registerStylesheet('spam', expression='string:ham', rendering='link')
00326         self.tool.registerStylesheet('test_rr_1.css', rendering='inline')
00327         view = self.portal.restrictedTraverse('@@plone')
00328         viewletmanager = getMultiAdapter((self.portal, self.portal.REQUEST, view), IContentProvider, name = u'plone.resourceregistries.styles')
00329         viewletmanager.update()
00330         all = viewletmanager.render()
00331         evaluated = self.tool.getEvaluatedResources(self.folder)
00332         magic_ids = [item.getId() for item in evaluated]
00333         self.failUnless('background-color' in all)
00334         self.failUnless('<link' in all)
00335         self.failUnless('/%s' % magic_ids[1] in all)
00336         self.failIf('/test_rr_1.css"' in all)

Here is the call graph for this function:

Definition at line 360 of file testCSSRegistry.py.

00360 
00361     def testRenderingWorksInMainTemplate(self):
00362         renderedpage = getattr(self.portal, 'index_html')()
00363         self.failIf('background-color' in renderedpage)
00364         self.tool.registerStylesheet('test_rr_1.css', rendering='inline')
00365         renderedpage = getattr(self.portal, 'index_html')()
00366         self.failUnless('background-color' in renderedpage)
00367 

Here is the call graph for this function:

Definition at line 207 of file testCSSRegistry.py.

00207 
00208     def testStylesheetCooking(self):
00209         self.tool.registerStylesheet('ham')
00210         self.tool.registerStylesheet('spam')
00211         self.tool.registerStylesheet('eggs')
00212         self.assertEqual(len(self.tool.getResources()), 3)
00213         self.assertEqual(len(self.tool.cookedresources), 1)
00214         self.assertEqual(len(self.tool.concatenatedresources.keys()), 4)
00215         self.tool.setAutoGroupingMode(True)
00216         self.assertEqual(len(self.tool.getResources()), 3)
00217         self.assertEqual(len(self.tool.cookedresources), 1)
00218         self.assertEqual(len(self.tool.concatenatedresources.keys()), 4)

Definition at line 219 of file testCSSRegistry.py.

00219 
00220     def testStylesheetCookingValues(self):
00221         self.tool.registerStylesheet('ham')
00222         self.tool.registerStylesheet('spam')
00223         self.tool.registerStylesheet('eggs')
00224         self.assertEqual(self.tool.concatenatedresources[
00225                          self.tool.cookedresources[0].getId()],
00226                          ['ham', 'spam', 'eggs'])


Member Data Documentation

Definition at line 204 of file testCSSRegistry.py.


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