55import re
66
77
8+ class CustomDatePickerInput (DatePickerInput ):
9+ template_name = 'demo_app/custom_input/date-picker.html'
10+
11+
12+ class CustomTimePickerInput (TimePickerInput ):
13+ template_name = 'demo_app/custom_input/time-picker.html'
14+
15+
816class TestContextRender (SimpleTestCase ):
917
1018 def test_get_context (self ):
@@ -30,3 +38,20 @@ def test_time_input_snapshot(self):
3038 html = re .sub ('dp_\\ d+' , '' , html )
3139 snapshot = re .sub ('dp_\\ d+' , '' , snapshot )
3240 self .assertEqual (html , snapshot )
41+
42+ def test_custom_date_input_snapshot (self ):
43+ dp_input = CustomDatePickerInput ()
44+ html = dp_input .render ('input_name' , '2018-04-12' , {})
45+ snapshot = open ('tests/snapshots/date-input-custom.html' ).read ()
46+ html = re .sub ('dp_\\ d+' , '' , html )
47+ snapshot = re .sub ('dp_\\ d+' , '' , snapshot )
48+ self .assertEqual (html , snapshot )
49+
50+ def test_custom_time_input_snapshot (self ):
51+ dp_input = CustomTimePickerInput ()
52+ html = dp_input .render ('input_name' , '12:30' , {})
53+ snapshot = open ('tests/snapshots/time-input-custom.html' ).read ()
54+ html = re .sub ('dp_\\ d+' , '' , html )
55+ snapshot = re .sub ('dp_\\ d+' , '' , snapshot )
56+ self .assertEqual (html , snapshot )
57+
0 commit comments