<commit_before>Text type browser integration
=============================

Add a new text[#browser]_:

>>> browser.open('http://localhost/++skin++cms/repository/2006')
>>> menu = browser.getControl(name='add_menu')
>>> menu.displayValue = ['Plain text']
>>> browser.open(menu.value[0])
>>> print browser.contents
<?xml ...
 <title>... Add plain text </title>
 ...

We're looking at the add form now. Enter a filename and a text:

>>> browser.getControl('File name').value = 'render.xslt'
>>> browser.getControl('Content').value = '''\
...     <?xml encoding="utf8"?>
...     <foo/>'''

We can choose the encoding:

>>> browser.getControl('Encoding').displayOptions
['UTF-8', 'ISO8859-15']
>>> browser.getControl('Encoding').displayValue
['UTF-8']
>>> browser.getControl('Encoding').displayValue = ['ISO8859-15']


After adding we're at the edit form:

>>> browser.getControl('Add').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...


Change text and encoding and save. Note that the value which is passed between
browser and server is *always* UTF-8 regardles of the storage encoding.

>>> browser.getControl('Content').value = u'F\xfc'.encode('utf8')
>>> browser.getControl('Encoding').displayValue = ['UTF-8']
>>> browser.getControl('Apply').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...Updated on...


Check in (note that the contents is preformatted):

>>> browser.getLink('Checkin').click()
>>> print browser.contents
<?xml...
 <title>... View plain text </title>
 ...
        <div class="widget"><pre>Fü</pre></div>
        ...
 

Check out: 

>>> browser.getLink('Checkout').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...



Verify the metdata preview:

>>> browser.open('http://localhost/++skin++cms/repository/2006/'
...              'render.xslt/metadata_preview')
>>> print browser.contents
  <div...
    <p>
      http://namespaces.zeit.de/CMS/meta type:
      text
    </p>
    ...

We have a special icon:

>>> browser.open('http://localhost/++skin++cms/repository/2006/')
>>> print browser.contents
<?xml...
       <img src="http://localhost/++skin++cms/@@/zeit-content-text-interfaces-IText-zmi_icon.png" alt="Text" width="18" height="18" border="0" />
       ...


.. [#browser]

    >>> from z3c.etestbrowser.testing import ExtendedTestBrowser
    >>> browser = ExtendedTestBrowser()
    >>> browser.addHeader('Authorization', 'Basic user:userpw')<commit_msg>re #11082: fixed test after refactoring: icons used for ICMSOldStyle had different dimensions than modern ones<commit_after>Text type browser integration
=============================

Add a new text[#browser]_:

>>> browser.open('http://localhost/++skin++cms/repository/2006')
>>> menu = browser.getControl(name='add_menu')
>>> menu.displayValue = ['Plain text']
>>> browser.open(menu.value[0])
>>> print browser.contents
<?xml ...
 <title>... Add plain text </title>
 ...

We're looking at the add form now. Enter a filename and a text:

>>> browser.getControl('File name').value = 'render.xslt'
>>> browser.getControl('Content').value = '''\
...     <?xml encoding="utf8"?>
...     <foo/>'''

We can choose the encoding:

>>> browser.getControl('Encoding').displayOptions
['UTF-8', 'ISO8859-15']
>>> browser.getControl('Encoding').displayValue
['UTF-8']
>>> browser.getControl('Encoding').displayValue = ['ISO8859-15']


After adding we're at the edit form:

>>> browser.getControl('Add').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...


Change text and encoding and save. Note that the value which is passed between
browser and server is *always* UTF-8 regardles of the storage encoding.

>>> browser.getControl('Content').value = u'F\xfc'.encode('utf8')
>>> browser.getControl('Encoding').displayValue = ['UTF-8']
>>> browser.getControl('Apply').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...Updated on...


Check in (note that the contents is preformatted):

>>> browser.getLink('Checkin').click()
>>> print browser.contents
<?xml...
 <title>... View plain text </title>
 ...
        <div class="widget"><pre>Fü</pre></div>
        ...
 

Check out: 

>>> browser.getLink('Checkout').click()
>>> print browser.contents
<?xml...
 <title>... Edit plain text </title>
 ...



Verify the metdata preview:

>>> browser.open('http://localhost/++skin++cms/repository/2006/'
...              'render.xslt/metadata_preview')
>>> print browser.contents
  <div...
    <p>
      http://namespaces.zeit.de/CMS/meta type:
      text
    </p>
    ...

We have a special icon:

>>> browser.open('http://localhost/++skin++cms/repository/2006/')
>>> print browser.contents
<?xml...
       <img src="http://localhost/++skin++cms/@@/zeit-content-text-interfaces-IText-zmi_icon.png" alt="Text" width="20" height="20" border="0" />
       ...


.. [#browser]

    >>> from z3c.etestbrowser.testing import ExtendedTestBrowser
    >>> browser = ExtendedTestBrowser()
    >>> browser.addHeader('Authorization', 'Basic user:userpw')
{'fraction_non_alphanumeric': 0.21030887271296478, 'fraction_numerical': 0.015542002754278968, 'mean_word_length': 3.733705772811918, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 203, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2388196', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1510, 'n_words': 374}