~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/browser/tests/base-layout.txt

[r=jcsackett][bug=798605] Show a notification and update the
        subscribers portlet when marking a bug as private using ajax.

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
Notifications
237
237
-------------
238
238
 
239
 
Notifications are diplayed between the breadcrumbs and the page content.
 
239
Notifications are displayed between the breadcrumbs and the page content.
240
240
 
241
241
    >>> request.response.addInfoNotification('I cannot do that Dave.')
242
242
    >>> view = MainOnlyView(user, request)
249
249
      </div>
250
250
      <div class="top-portlet">
251
251
      ...
 
252
 
 
253
For ajax requests to form views, notifications are added to the response
 
254
headers.
 
255
 
 
256
    >>> from lp.app.browser.launchpadform import action, LaunchpadFormView
 
257
    >>> from zope.interface import Interface
 
258
    >>> class FormView(LaunchpadFormView):
 
259
    ...     """A simple view to test notifications."""
 
260
    ...     class schema(Interface):
 
261
    ...         """A default schema."""
 
262
    ...     @action('Test', name='test')
 
263
    ...     def test_action(self, action, data):
 
264
    ...         pass
 
265
 
 
266
    >>> extra = {'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'}
 
267
    >>> request = LaunchpadTestRequest(
 
268
    ...     method='POST', form={'field.actions.test': 'Test'}, **extra)
 
269
    >>> request.response.addInfoNotification('I cannot do that Dave.')
 
270
    >>> view = FormView(user, request)
 
271
    >>> view.initialize()
 
272
    >>> print request.response.getHeader('X-Lazr-Notifications')
 
273
    [[20, "I cannot do that Dave."]]