Back to index

plone3  3.1.7
Public Member Functions
plone.app.form.tests.test_wysiwygwidget.WYSIWYGWidgetTestCase Class Reference

List of all members.

Public Member Functions

def test_right_macro

Detailed Description

Base class used for test cases

Definition at line 12 of file test_wysiwygwidget.py.


Member Function Documentation

Definition at line 16 of file test_wysiwygwidget.py.

00016 
00017     def test_right_macro(self):
00018         # fixes #8016
00019         class MyField:
00020             __name__ = 'the field'
00021             required = True
00022             default = u'the value'
00023             missing_value = None
00024 
00025         # the wysiwyg widget depends on the used editor
00026         pm = getToolByName(self.portal, 'portal_membership')
00027         member = pm.getAuthenticatedMember()
00028         editor = member.getProperty('wysiwyg_editor', '').lower()
00029 
00030         # we have kupu by default
00031         self.assertEquals(editor, 'kupu')
00032 
00033         # so it means the widget should use the macro
00034         # provided by kupu (default skin with .css includes)
00035         w = WYSIWYGWidget(MyField(), TestRequest())
00036         kupu = w()
00037 
00038         # let's add a custom editor
00039         # with a fake skin that should be catched
00040         # to provide a custom macro
00041         site = getSite()
00042         class  MyMacros(object):
00043             def wysiwygEditorBox(self):
00044                 return (('version', '1.6'), ('mode', 'html'))
00045         class MySkin(object):
00046             macros = MyMacros()
00047         site.cool_editor_wysiwyg_support = MySkin()
00048 
00049         # let's change it to `cool_editor`
00050         member.setMemberProperties({'wysiwyg_editor': 'cool_editor'})
00051 
00052         w = WYSIWYGWidget(MyField(), TestRequest())
00053         cool_editor = w()
00054 
00055         # the macro used by wysiwygwidget should differ
00056         self.assertNotEquals(kupu, cool_editor)

Here is the call graph for this function:


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