def test_codemirror_single_field_js_assets(): """Test codemirror_field_js_assets tag for a single field""" f = SampleForm() f.as_p() assets = codemirror_field_js_assets(f.fields['foo']) assert assets == """<script type="text/javascript" src="/static/CodeMirror/lib/codemirror.js"></script>"""
def test_codemirror_single_field_js_assets(): """Test codemirror_field_js_assets tag for a single field""" f = SampleForm() f.as_p() assets = codemirror_field_css_assets(f.fields['foo']) assert assets == '<link rel="stylesheet" href="/static/CodeMirror/lib/codemirror.css">'
def test_css_html(settings): manifesto = CodemirrorAssetTagRender() f = SampleForm() f.as_p() manifesto.register_from_fields(f.fields['foo'], ) assets = manifesto.css_html() assert assets == '<link rel="stylesheet" href="/static/CodeMirror/lib/codemirror.css">'
def test_css_html(settings): manifesto = CodemirrorAssetTagRender() f = SampleForm() f.as_p() manifesto.register_from_fields( f.fields['foo'], ) assets = manifesto.css_html() assert assets == '<link rel="stylesheet" href="/static/CodeMirror/lib/codemirror.css">'
def test_form_basic(): """Basic field usage""" f = SampleForm({'foo': 'bar'}) if django_versioning[1] < 10: assert f.as_p() == ("""<p><label for="id_foo">Foo:</label> """ """<textarea cols="40" id="id_foo" name="foo" """ """rows="10">\r\nbar</textarea></p>""") else: # Since Django 1.10, required form fields set the required HTML assert f.as_p() == ("""<p><label for="id_foo">Foo:</label> """ """<textarea cols="40" id="id_foo" name="foo" """ """rows="10" required>\r\nbar</textarea></p>""")
def test_form_basic(): """Basic field usage""" f = SampleForm({'foo': 'bar'}) assert f.as_p() == ("""<p><label for="id_foo">Foo:</label> """ """<textarea cols="40" id="id_foo" name="foo" """ """rows="10">\r\nbar</textarea></p>""")