Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
7d60659e
Kaydet (Commit)
7d60659e
authored
Agu 21, 2015
tarafından
Maxime Lorant
Kaydeden (comit)
Tim Graham
Agu 22, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25300 -- Added unit tests for BoundField.id_for_label
üst
26dcf739
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
test_forms.py
tests/forms_tests/tests/test_forms.py
+19
-0
No files found.
tests/forms_tests/tests/test_forms.py
Dosyayı görüntüle @
7d60659e
...
@@ -2289,6 +2289,25 @@ class FormsTestCase(SimpleTestCase):
...
@@ -2289,6 +2289,25 @@ class FormsTestCase(SimpleTestCase):
self
.
assertHTMLEqual
(
boundfield
.
label_tag
(),
'<label for="id_field"></label>'
)
self
.
assertHTMLEqual
(
boundfield
.
label_tag
(),
'<label for="id_field"></label>'
)
def
test_boundfield_id_for_label
(
self
):
class
SomeForm
(
Form
):
field
=
CharField
(
label
=
''
)
self
.
assertEqual
(
SomeForm
()[
'field'
]
.
id_for_label
,
'id_field'
)
def
test_boundfield_id_for_label_override_by_attrs
(
self
):
"""
If an id is provided in `Widget.attrs`, it overrides the generated ID,
unless it is `None`.
"""
class
SomeForm
(
Form
):
field
=
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'id'
:
'myCustomID'
}))
field_none
=
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'id'
:
None
}))
form
=
SomeForm
()
self
.
assertEqual
(
form
[
'field'
]
.
id_for_label
,
'myCustomID'
)
self
.
assertEqual
(
form
[
'field_none'
]
.
id_for_label
,
'id_field_none'
)
def
test_label_tag_override
(
self
):
def
test_label_tag_override
(
self
):
"""
"""
BoundField label_suffix (if provided) overrides Form label_suffix
BoundField label_suffix (if provided) overrides Form label_suffix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment