File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 33import html5lib
44from django .test import TestCase
55
6+ from intl_tel_input .widgets import IntlTelInputWidget
7+
68
79class IntlTelInputTest (TestCase ):
810 def assertValidHTML (self , content , msg = None ):
@@ -39,7 +41,14 @@ def test_with_attrs(self):
3941 r = self .client .get ('/attrs-test/' )
4042 self .assertIn ('title="Telephone number"' , r .content .decode ('utf-8' ))
4143 self .assertIn ('data-default-code="jp"' , r .content .decode ('utf-8' ))
44+ self .assertIn ('data-preferred-countries="["jp"]"' ,
45+ r .content .decode ('utf-8' ))
4246
4347 def test_with_initial (self ):
4448 r = self .client .get ('/initial-test/' )
4549 self .assertIn ('value="+81123456789"' , r .content .decode ('utf-8' ))
50+
51+ def test_extra_attrs (self ):
52+ widget = IntlTelInputWidget ()
53+ attrs = widget .build_attrs (extra_attrs = {'required' : True })
54+ self .assertTrue (attrs ['required' ])
You can’t perform that action at this time.
0 commit comments