=========================
Updating selected persons
=========================

The `update` search result handler allows to update a single field on each
selected person.

Setup
=====

The layer defines some persons. When user searches for them all persons are
selected by default so he only has to select the `update` search handler to
perform a multi-update:

>>> from icemac.addressbook.browser.search.result.handler.update.testing \
...     import select_persons_with_keyword_for_update
>>> browser = select_persons_with_keyword_for_update('family')


Update wizard
=============

The user is guided through the update using a wizard.

Choose field
------------

The first step is to choose a field for update:

>>> browser.getControl('field').displayOptions
['person -- first name', 'person -- last name', 'person -- birth date', ...
>>> browser.getControl('field').displayValue = ['person -- notes']
>>> browser.getControl('Next').click()

Enter new value
---------------

The next step is to enter a new value for the selected field and to choose
an operation which defaults to 'append'.

>>> browser.getControl('operation').displayValue
['append new value to existing one']
>>> browser.getControl('new value', index=0).value = '\nfoobar'
>>> browser.getControl('Next').click()

Check result
------------

In the last step the result is displayed.

>>> print browser.contents
<!DOCTYPE ...
  <tbody>
    <tr class="table-even-row">
      <td>Koch</td>
      <td>father-in-law
foobar</td>
      <td></td>
    </tr>
    <tr class="table-odd-row">
      <td>Velleuer</td>
      <td>
foobar</td>
      <td></td>
    </tr>
  </tbody>
  ...

Hitting `Complete` persists the change and redirects to the person list,
displaying a message.

>>> browser.getControl('Complete').click()
>>> browser.url
'http://localhost/ab'
>>> browser.get_messages()
['Data successfully updated.']

The fields got changed as promised in the message:

>>> browser.getLink('Person list').click()
>>> browser.getLink('Koch').click()
>>> print browser.getControl('notes').value
father-in-law
foobar
