Exemplo n.º 1
0
    def test_simple(self):
        context = dict()
        expected = '''
<label for="foo">Foo:</label>
<input type="text" id="foo" value="" name="foo">
<script>$(function() {$("#foo").datepicker({dateFormat:'yy-mm-dd'});});</script>
        '''.strip()
        result = form_fields.datepicker(context, 'foo', "Foo:")
        result = result.strip()
        self.assertEqual(expected, result)
Exemplo n.º 2
0
    def test_simple(self):
        context = dict()
        expected = '''
<label for="foo">Foo:</label>
<input type="text" id="foo" value="" name="foo">
<script>$(function() {$("#foo").datepicker({dateFormat:'yy-mm-dd'});});</script>
        '''.strip()
        result = form_fields.datepicker(context, 'foo', "Foo:")
        result = result.strip()
        assert expected == result
Exemplo n.º 3
0
    def test_disabled_form(self):
        context = dict(disabled_form=True)
        expected = '''
<label for="foo">Foo:</label>
<input disabled type="text" id="foo" value="" name="foo">
<script>$(function() {$("#foo").datepicker({dateFormat:'yy-mm-dd'});});</script>
        '''.strip()
        result = form_fields.datepicker(context, 'foo', "Foo:")
        result = result.strip()
        assert expected == result

        context = dict(disabled_form=False)
        expected = '''
<label for="foo">Foo:</label>
<input type="text" id="foo" value="" name="foo">
<script>$(function() {$("#foo").datepicker({dateFormat:'yy-mm-dd'});});</script>
        '''.strip()
        result = form_fields.datepicker(context, 'foo', "Foo:")
        result = result.strip()
        assert expected == result