File: test_read_only_fields.py

package info (click to toggle)
wtforms-components 0.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 352 kB
  • sloc: python: 1,582; makefile: 135; sh: 11
file content (17 lines) | stat: -rw-r--r-- 584 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from wtforms.fields import BooleanField

from tests import MultiDict, SimpleFieldTestCase
from wtforms_components import read_only


class TestReadOnlyCheckboxField(SimpleFieldTestCase):
    field_class = BooleanField

    def test_has_readonly_and_disabled_attributes_in_html(self):
        form_class = self.init_form()
        form = form_class(MultiDict(test_field="y"))
        read_only(form.test_field)
        assert (
            '<input checked disabled id="test_field" '
            'name="test_field" readonly type="checkbox" value="y">'
        ) in str(form.test_field)