CKEditor control panel
======================

Log in as manager

    >>> from plone.testing.z2 import Browser
    >>> from plone.app.testing import SITE_OWNER_NAME
    >>> from plone.app.testing import SITE_OWNER_PASSWORD
    >>> app = layer['app']
    >>> portal = layer['portal']
    >>> browser = Browser(app)
    >>> browser.open('http://nohost/plone/login_form')
    >>> browser.getControl('Login Name').value = SITE_OWNER_NAME
    >>> browser.getControl('Password').value = SITE_OWNER_PASSWORD
    >>> browser.getControl('Log in').click()

First just try to get some property from ckeditor_properties sheet:

    >>> ptool = portal.portal_properties
    >>> ckeditor_props = ptool.ckeditor_properties
    >>> ckeditor_props.allow_link_byuid
    True
    >>> ckeditor_props.allow_file_upload
    True

Viewing the ckeditor control panel
----------------------------------

    >>> browser.open('http://nohost/plone/@@ckeditor-controlpanel')
    >>> browser.url
    'http://nohost/plone/@@ckeditor-controlpanel'

Click the cancel button:

    >>> browser.getControl(name="form.actions.cancel").click()
    >>> browser.url.endswith('plone_control_panel')
    True

There should be still no changes:

    >>> 'Changes canceled.' in browser.contents
    True

Make some changes
-----------------

    >>> browser.open('http://nohost/plone/@@ckeditor-controlpanel')
    >>> browser.url.endswith('ckeditor-controlpanel')
    True

    >>> browser.getControl('Allow file upload').selected = False
    >>> browser.getControl(name='form.width').value = '80%'


Click the save button:

    >>> browser.getControl("Save").click()
    >>> browser.url.endswith('ckeditor-controlpanel')
    True

We should be informed that something has changed:

    >>> 'Changes saved.' in browser.contents
    True

Make sure the changes have been applied correctly to the ckeditor properties sheet:

    >>> ckeditor_props.allow_file_upload
    False

    >>> ckeditor_props.width
    u'80%'

Test the fieldsets
------------------

    >>> 'fieldset-cke_base' in browser.contents
    True

    >>> 'fieldset-cke_skin' in browser.contents
    True

    >>> 'fieldset-cke_browser' in browser.contents
    True

    >>> 'fieldset-cke_advanced' in browser.contents
    True

