~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/widgets/tests/test_popup.py

[r=abentley][bug=801388,
        806179] Re-lands wallyworlds fix to keep the assign me button from
        appearing in goofy places,
        and fixes a problem that prevented personpickers from rendering.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
from canonical.launchpad.webapp.servers import LaunchpadTestRequest
14
14
from canonical.testing.layers import DatabaseFunctionalLayer
15
 
from lp.app.widgets.popup import VocabularyPickerWidget
 
15
from lp.app.widgets.popup import (
 
16
    PersonPickerWidget,
 
17
    VocabularyPickerWidget,
 
18
    )
16
19
from lp.testing import TestCaseWithFactory
17
20
 
18
21
 
112
115
            'Y.lp.app.picker.connect_select_menu\( '
113
116
            'select_menu, text_input\);',
114
117
            markup)
 
118
 
 
119
    def test_widget_extra_buttons(self):
 
120
        # The picker widgets define defaults for the display of extra buttons.
 
121
        field = ITest['test_valid.item']
 
122
        bound_field = field.bind(self.context)
 
123
 
 
124
        # A vocabulary widget does not show the extra buttons by default.
 
125
        picker_widget = VocabularyPickerWidget(
 
126
            bound_field, self.vocabulary, self.request)
 
127
        self.assertEqual('false', picker_widget.show_assign_me_button)
 
128
        self.assertEqual('false', picker_widget.show_remove_button)
 
129
 
 
130
        # A person picker widget does show them by default.
 
131
        person_picker_widget = PersonPickerWidget(
 
132
            bound_field, self.vocabulary, self.request)
 
133
        self.assertEqual('true', person_picker_widget.show_assign_me_button)
 
134
        self.assertEqual('true', person_picker_widget.show_remove_button)