Exemplo n.º 1
0
class TestEmpty(support.VerifyResults, unittest.TestCase):

    def setUp(self):
        field = Text(__name__ = 'foo')
        request = TestRequest()
        request.form['foo'] = u'Foo Value'
        self._widget = TextWidget(field, request)
        self._widget.setPrefix('')

    def testGetData(self):
        self.assertEqual(self._widget.getInputValue(), u'Foo Value')

    def testRender(self):
        check_list = ('id="foo"', 'name="foo"')
        self.verifyResult(self._widget(), check_list)
        self.verifyResult(self._widget.hidden(), check_list)
Exemplo n.º 2
0
class Test(support.VerifyResults, unittest.TestCase):

    def setUp(self):
        field = Text(__name__ = 'foo')
        request = TestRequest()
        request.form['spam.foo'] = u'Foo Value'
        self._widget = TextWidget(field, request)
        self._widget.setPrefix('spam')

    def testGetData(self):
        self.assertEqual(self._widget.getInputValue(), u'Foo Value')

    def testRender(self):
        value = 'Foo Value 2'
        check_list = ('type="text"', 'id="spam.foo"', 'name="spam.foo"',
                      'value="Foo Value 2"', 'size="20"')
        self._widget.setRenderedValue(value)
        self.verifyResult(self._widget(), check_list)
        check_list = ('type="hidden"',) + check_list[1:-1]
        self.verifyResult(self._widget.hidden(), check_list)
        check_list = ('style="color: red"',) + check_list
        self._widget.extra = 'style="color: red"'
        self.verifyResult(self._widget.hidden(), check_list)
Exemplo n.º 3
0
def personWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"person_widget"
    return widget
Exemplo n.º 4
0
def endTimeWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"end_time_widget"
    return widget
Exemplo n.º 5
0
def startTimeWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"start_time_widget"
    return widget
def disabled_text_widget(field, request):
    retval = TextWidget(field, request)
    retval.cssClass = "disabled"
    return retval
Exemplo n.º 7
0
def personWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"person_widget"
    return widget
Exemplo n.º 8
0
def endTimeWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"end_time_widget"
    return widget
Exemplo n.º 9
0
def startTimeWidget(field, request):
    widget = TextWidget(field, request)
    widget.cssClass = u"start_time_widget"
    return widget
Exemplo n.º 10
0
 def setUp(self):
     field = Text(__name__ = 'foo')
     request = TestRequest()
     request.form['foo'] = u'Foo Value'
     self._widget = TextWidget(field, request)
     self._widget.setPrefix('')