1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
#
# CSSRegistry tests
#
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Products.CMFPlone.tests import PloneTestCase
from Products.ResourceRegistries.config import CSSTOOLNAME, JSTOOLNAME
from Products.CMFCore.utils import getToolByName
class TestCSSRegistry(PloneTestCase.PloneTestCase):
def afterSetUp(self):
self.tool = getToolByName(self.portal, CSSTOOLNAME)
def testToolExists(self):
self.failUnless(CSSTOOLNAME in self.portal.objectIds())
def testDefaultCssIsInstalled(self):
installedStylesheetIds = self.tool.getResourceIds()
expected = ['ploneCustom.css',
'authoring.css',
'public.css',
'base.css',
'portlets.css',
'deprecated.css',
'generated.css',
'member.css',
'print.css',
'presentation.css',
'RTL.css',
'mobile.css',
'textSmall.css',
'textLarge.css']
for e in expected:
self.failUnless(e in installedStylesheetIds, e)
class TestJSRegistry(PloneTestCase.PloneTestCase):
def afterSetUp(self):
self.tool = getToolByName(self.portal, JSTOOLNAME)
def testToolExists(self):
self.failUnless(JSTOOLNAME in self.portal.objectIds())
def testDefaultJSIsInstalled(self):
installedScriptIds = self.tool.getResourceIds()
expected = [
'correctPREformatting.js',
'plone_minwidth.js',
'calendar_formfield.js',
'ie5fixes.js',
'calendarpopup.js',
'collapsiblesections.js',
'first_input_focus.js',
'folder_contents_filter.js',
'fullscreenmode.js',
'highlightsearchterms.js',
'mark_special_links.js',
'select_all.js',
'styleswitcher.js',
'livesearch.js',
'table_sorter.js',
'dropdown.js',
'dragdropreorder.js',
'cssQuery.js',
'cookie_functions.js',
'nodeutilities.js',
'plone_javascript_variables.js',
'register_function.js',
'formUnload.js',
'formsubmithelpers.js']
for e in expected:
self.failUnless(e in installedScriptIds, e)
def testJSIsInsertedInPage(self):
page = self.portal.index_html()
self.failUnless("" in page)
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestCSSRegistry))
suite.addTest(makeSuite(TestJSRegistry))
return suite
if __name__ == '__main__':
framework()
|