예제 #1
0
def test_vselect_value_with_unicode_coertion():
    # FIXME: This test may fail in Python 3.4 because of HTML attribute
    # ordering.
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {'foo': '1'})
    assert mod.tag('option', 'bar', value=1, selected=None) in s
    assert mod.tag('option', 'baz', value=2) in s
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {'foo': 2})
    assert mod.tag('option', 'bar', value=1) in s
    assert mod.tag('option', 'baz', value=2, selected=None) in s
예제 #2
0
파일: forms.py 프로젝트: AbelMon/librarian
 def render(self):
     return html.vselect(self.name,
                         self.choices,
                         {self.name: self.value},
                         _id=self._id_prefix + self.name,
                         **self.kwargs)
예제 #3
0
def test_vselect_empty():
    s = mod.vselect('foo', ((1, 'bar'),), {}, empty='foo')
    assert mod.tag('option', 'foo', value=None) in s
    assert mod.tag('option', 'bar', value=1) in s
예제 #4
0
def test_vselect_choices():
    s = mod.vselect('foo', ((1, 'bar'), (2, 'baz')), {})
    assert mod.tag('option', 'bar', value=1) in s
    assert mod.tag('option', 'baz', value=2) in s
예제 #5
0
def test_vselect():
    s = mod.vselect('foo', [], {})
    assert_tag(s, 'select')
    assert_content(s, '')