Back to index

plone3  3.1.7
testCSSandJSRegistry.py
Go to the documentation of this file.
00001 #
00002 # CSSRegistry tests
00003 #
00004 
00005 from Products.CMFPlone.tests import PloneTestCase
00006 
00007 from Products.ResourceRegistries.config import CSSTOOLNAME, JSTOOLNAME
00008 from Products.CMFCore.utils import getToolByName
00009 
00010 
00011 class TestCSSRegistry(PloneTestCase.PloneTestCase):
00012 
00013     def afterSetUp(self):
00014         self.tool = getToolByName(self.portal, CSSTOOLNAME)
00015 
00016     def testToolExists(self):
00017         self.failUnless(CSSTOOLNAME in self.portal.objectIds())
00018 
00019     def testDefaultCssIsInstalled(self):
00020         installedStylesheetIds = self.tool.getResourceIds()
00021         expected = ['ploneCustom.css',
00022                     'authoring.css', 
00023                     'public.css',
00024                     'base.css',
00025                     'portlets.css',
00026                     'deprecated.css',
00027                     'member.css',
00028                     'print.css',
00029                     'RTL.css',
00030                     'mobile.css',]
00031         for e in expected:
00032             self.failUnless(e in installedStylesheetIds, e)
00033 
00034 
00035 class TestJSRegistry(PloneTestCase.PloneTestCase):
00036 
00037     def afterSetUp(self):
00038         self.tool = getToolByName(self.portal, JSTOOLNAME)
00039 
00040     def testToolExists(self):
00041         self.failUnless(JSTOOLNAME in self.portal.objectIds())
00042 
00043     def testDefaultJSIsInstalled(self):
00044         installedScriptIds = self.tool.getResourceIds()
00045         expected = [
00046              'calendar_formfield.js',
00047              'calendarpopup.js',
00048              'collapsiblesections.js',
00049              'first_input_focus.js',
00050              'highlightsearchterms.js',
00051              'mark_special_links.js',
00052              'select_all.js',
00053              'styleswitcher.js',
00054              'livesearch.js',
00055              'table_sorter.js',
00056              'dropdown.js',
00057              'dragdropreorder.js',
00058              'cssQuery.js',
00059              'cookie_functions.js',
00060              'nodeutilities.js',
00061              'plone_javascript_variables.js',
00062              'register_function.js', 
00063              'formUnload.js',
00064              'formsubmithelpers.js',
00065              'form_tabbing.js']
00066         for e in expected:
00067             self.failUnless(e in installedScriptIds, e)
00068 
00069     def testJSIsInsertedInPage(self):
00070         page = self.portal.index_html()
00071         self.failUnless("" in page)
00072 
00073 
00074 def test_suite():
00075     from unittest import TestSuite, makeSuite
00076     suite = TestSuite()
00077     suite.addTest(makeSuite(TestCSSRegistry))
00078     suite.addTest(makeSuite(TestJSRegistry))
00079     return suite