| 1 |
from django.forms.widgets import Input |
| 2 |
|
| 3 |
from .base import WidgetTest |
| 4 |
|
| 5 |
|
| 6 |
class InputTests(WidgetTest): |
| 7 |
def test_attrs_with_type(self): |
| 8 |
attrs = {"type": "date"} |
| 9 |
widget = Input(attrs) |
| 10 |
self.check_html( |
| 11 |
widget, "name", "value", '<input type="date" name="name" value="value">' |
| 12 |
) |
| 13 |
# reuse the same attrs for another widget |
| 14 |
self.check_html( |
| 15 |
Input(attrs), |
| 16 |
"name", |
| 17 |
"value", |
| 18 |
'<input type="date" name="name" value="value">', |
| 19 |
) |
| 20 |
attrs["type"] = "number" # shouldn't change the widget type |
| 21 |
self.check_html( |
| 22 |
widget, "name", "value", '<input type="date" name="name" value="value">' |
| 23 |
) |