Commit fb3ebfbb authored by Lowik BOURGEOISAT's avatar Lowik BOURGEOISAT Committed by ntome

filters: Add color to FormValue

parent 4b955145
......@@ -181,7 +181,7 @@ class FormValue(Filter):
if el.attrib.get('type') in ('radio', 'checkbox'):
return 'checked' in el.attrib
# regular text input
elif el.attrib.get('type', '') in ('', 'text', 'email', 'search', 'tel', 'url', 'password', 'hidden'):
elif el.attrib.get('type', '') in ('', 'text', 'email', 'search', 'tel', 'url', 'password', 'hidden', 'color'):
try:
return unicode(el.attrib['value'])
except KeyError:
......
......@@ -64,6 +64,7 @@ class FormValueTest(TestCase):
<input type="checkbox" name="test_checkbox2">
<input type="date" value="2012-12-12" name="test_date">
<input type="range" value="20" name="test_range">
<input type="color" value="#fff666" name="test_color">
</form>
''')
......@@ -74,6 +75,7 @@ class FormValueTest(TestCase):
self.assertEqual(True, FormValue('//form//input[@name="test_checkbox1"]')(self.e))
self.assertEqual(False, FormValue('//form//input[@name="test_checkbox2"]')(self.e))
self.assertEqual(20, FormValue('//form//input[@name="test_range"]')(self.e))
self.assertEqual('#fff666', FormValue('//form//input[@name="test_color"]')(self.e))
class LinkTest(TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment