~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=wgrant][bug=812253] Fix case where picker displays "null" if used
 a second time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        widget_config = simplejson.loads(picker_widget.json_config)
63
63
        self.assertEqual(
64
64
            'ValidTeamOwner', picker_widget.vocabulary_name)
65
 
        self.assertEqual(
66
 
            simplejson.dumps(self.vocabulary.displayname),
67
 
            widget_config['header'])
68
 
        self.assertEqual(
69
 
            simplejson.dumps(self.vocabulary.step_title),
 
65
        self.assertEqual(self.vocabulary.displayname, widget_config['header'])
 
66
        self.assertEqual(self.vocabulary.step_title,
70
67
            widget_config['step_title'])
71
68
        self.assertEqual(
72
69
            'show-widget-field-test_valid-item', picker_widget.show_widget_id)
73
70
        self.assertEqual(
74
71
            'field.test_valid.item', picker_widget.input_id)
75
 
        self.assertEqual(
76
 
            simplejson.dumps(None), picker_widget.extra_no_results_message)
 
72
        self.assertIsNone(picker_widget.extra_no_results_message)
77
73
        markup = picker_widget()
78
 
        self.assertIn(
79
 
            "Y.lp.app.picker.create('ValidTeamOwner', config);", markup)
 
74
        self.assertTextMatchesExpressionIgnoreWhitespace("""\
 
75
            .*
 
76
            var picker = Y\\.lp\\.app\\.picker\\.create\\('ValidTeamOwner',
 
77
                config,
 
78
                'field\\.test_valid.item'\\);
 
79
            .*
 
80
            """, markup)
80
81
 
81
82
    def test_widget_fieldname_with_invalid_html_chars(self):
82
83
        # Check the picker widget is correctly set up for a field which has a