Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
kss.core.tests.test_kssview_core.TestKSSViewCoreCommandSet Class Reference
Inheritance diagram for kss.core.tests.test_kssview_core.TestKSSViewCoreCommandSet:
Inheritance graph
[legend]
Collaboration diagram for kss.core.tests.test_kssview_core.TestKSSViewCoreCommandSet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_empty
def test_addCommand
def test_replaceInnerHTMLTextPlusEntity
def test_replaceInnerHTMLTextPlusEntityOthers
def test_replaceInnerHTMLTextOnly
def test_replaceInnerHTMLTagOnly
def test_replaceInnerHTMLTagPlusText
def test_replaceInnerHTMLTextTagPlusText
def test_setHtmlAcceptsUnicode
def test_setHtmlChecksForNonUnicode
def loadCoreConfig
def createView
def setDebugRequest

Public Attributes

 view

Static Public Attributes

 layer = KSSLayer

Private Member Functions

def _checkSetHtmlResult

Detailed Description

Definition at line 25 of file test_kssview_core.py.


Member Function Documentation

def kss.core.tests.test_kssview_core.TestKSSViewCoreCommandSet._checkSetHtmlResult (   self,
  content,
  content2 = None 
) [private]

Definition at line 45 of file test_kssview_core.py.

00045 
00046     def _checkSetHtmlResult(self, content, content2=None):
00047         view = self.createView()
00048         view.getCommandSet('core').replaceInnerHTML('div.class', content)
00049         commands = view.getCommands()
00050         self.assertEqual(len(commands), 1)
00051         command = commands[0]
00052         self.assertEqual(command.getName(), 'replaceInnerHTML')
00053         self.assertEqual(command.getSelector(), 'div.class')
00054         params = command.getParams()
00055         self.assertEqual(len(params), 2)
00056         self.assertEqual(params[0].getName(), 'html')
00057         self.assertEqual(params[1].getName(), 'withKssSetup')
00058         if content2 == None:
00059             content2 = content
00060         content2 = content2.encode('ascii', 'xmlcharrefreplace')
00061         # wrap content into CDATA
00062         content2 = '<![CDATA[%s]]>' % (content2, )
00063         # and finally check it
00064         self.assertEqual(params[0].getContent().encode('ascii', 'xmlcharrefreplace'), content2)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 108 of file base.py.

00108 
00109     def createView(self):
00110         "Set up a fake view (with no content)"
00111         self.view = self.folder.restrictedTraverse('testMethod')
00112         return self.view

Here is the caller graph for this function:

def kss.core.tests.base.KSSViewTestCaseMixin.loadCoreConfig (   self,
  kss_core = True 
) [inherited]

Definition at line 102 of file base.py.

00102 
00103     def loadCoreConfig(self, kss_core=True):
00104         warnings.warn(
00105             "KSS tests are now using layers.  Please do not use "
00106             "loadCoreConfig anymore.",
00107             DeprecationWarning)
    

Definition at line 113 of file base.py.

00113 
00114     def setDebugRequest(self):
00115         'commands will be rendered as test friendly data structures'
00116         request = self.folder.REQUEST
00117         interface.directlyProvides(
00118             request,
00119             interface.directlyProvidedBy(request) + IDebugRequest)

Here is the caller graph for this function:

Definition at line 32 of file test_kssview_core.py.

00032 
00033     def test_addCommand(self):
00034         view = self.createView()
00035         commands = view.getCommands()
00036         command = commands.addCommand('replaceInnerHTML', 'selector')
00037         self.assertEqual(len(commands), 1)
00038         self.assertEqual(command.getName(), 'replaceInnerHTML')
00039         self.assertEqual(command.getSelector(), 'selector')
00040         params = command.getParams()
00041         self.assertEqual(len(params), 0)
        

Here is the call graph for this function:

Definition at line 27 of file test_kssview_core.py.

00027 
00028     def test_empty(self):
00029         view = self.createView()
00030         commands = view.getCommands()
00031         self.assertEqual(len(commands), 0)

Here is the call graph for this function:

Definition at line 80 of file test_kssview_core.py.

00080 
00081     def test_replaceInnerHTMLTagOnly(self):
00082         self._checkSetHtmlResult('<p xmlns="http://www.w3.org/1999/xhtml">new_content</p>')
        

Here is the call graph for this function:

Definition at line 83 of file test_kssview_core.py.

00083 
00084     def test_replaceInnerHTMLTagPlusText(self):
00085         self._checkSetHtmlResult('<p xmlns="http://www.w3.org/1999/xhtml">new_content</p>after')
        

Here is the call graph for this function:

Definition at line 77 of file test_kssview_core.py.

00077 
00078     def test_replaceInnerHTMLTextOnly(self):
00079         self._checkSetHtmlResult('new content')

Here is the call graph for this function:

Definition at line 65 of file test_kssview_core.py.

00065 
00066     def test_replaceInnerHTMLTextPlusEntity(self):
00067         'See if non breaking space entity works'
00068         ##self._checkSetHtmlResult('&nbsp;')
00069         # XXX we remove html named entities now
00070         self._checkSetHtmlResult('&nbsp;', '&#160;')
        

Here is the call graph for this function:

Definition at line 71 of file test_kssview_core.py.

00071 
00072     def test_replaceInnerHTMLTextPlusEntityOthers(self):
00073         'See if the other HTML entities work as well'
00074         # XXX we remove html named entities now
00075         self._checkSetHtmlResult('<p xmlns="http://www.w3.org/1999/xhtml">&raquo;Hello world!&laquo;</p>',
00076                    '<p xmlns="http://www.w3.org/1999/xhtml">&#187;Hello world!&#171;</p>')

Here is the call graph for this function:

Definition at line 86 of file test_kssview_core.py.

00086 
00087     def test_replaceInnerHTMLTextTagPlusText(self):
00088         self._checkSetHtmlResult('before<p xmlns="http://www.w3.org/1999/xhtml">new_content</p>after')
        

Here is the call graph for this function:

Definition at line 89 of file test_kssview_core.py.

00089 
00090     def test_setHtmlAcceptsUnicode(self):
00091         'Test that it accepts unicode'
00092         self._checkSetHtmlResult(u'abcá')
        

Here is the call graph for this function:

Definition at line 93 of file test_kssview_core.py.

00093 
00094     def test_setHtmlChecksForNonUnicode(self):
00095         'Test that it does not accept non unicode (unless pure ascii)'
00096         self.assertRaises(KSSUnicodeError, self._checkSetHtmlResult, 'abcá')

Here is the call graph for this function:


Member Data Documentation

kss.core.tests.base.KSSViewTestCase.layer = KSSLayer [static, inherited]

Definition at line 121 of file base.py.


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