diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-12-11 00:49:54 -0800 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-12-11 09:49:54 +0100 |
| commit | e703b93a656b78b9b444bb3a9980e305ed002a70 (patch) | |
| tree | a97f9a7da09ddf36b2f4886b4b5680f1144faf0e /tests | |
| parent | d8e233352877c37c469687287e7761e05bdae94e (diff) | |
Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/admin_views/templates/admin/admin_views/article/prepopulated_fields_js.html | 3 | ||||
| -rw-r--r-- | tests/forms_tests/tests/test_media.py | 138 | ||||
| -rw-r--r-- | tests/model_forms/tests.py | 2 | ||||
| -rw-r--r-- | tests/staticfiles_tests/test_forms.py | 8 | ||||
| -rw-r--r-- | tests/templates/custom_admin/change_list.html | 2 | ||||
| -rw-r--r-- | tests/utils_tests/files/strip_tags1.html | 4 | ||||
| -rw-r--r-- | tests/view_tests/templates/jsi18n-multi-catalogs.html | 8 | ||||
| -rw-r--r-- | tests/view_tests/templates/jsi18n.html | 18 |
8 files changed, 91 insertions, 92 deletions
diff --git a/tests/admin_views/templates/admin/admin_views/article/prepopulated_fields_js.html b/tests/admin_views/templates/admin/admin_views/article/prepopulated_fields_js.html index 0ee8c7a06c..4103338b3b 100644 --- a/tests/admin_views/templates/admin/admin_views/article/prepopulated_fields_js.html +++ b/tests/admin_views/templates/admin/admin_views/article/prepopulated_fields_js.html @@ -1,6 +1,5 @@ {% load l10n static %} -<script type="text/javascript" - id="django-admin-prepopulated-fields-constants" +<script id="django-admin-prepopulated-fields-constants" class="override-prepopulated_fields_js" src="{% static "admin/js/prepopulate_init.js" %}" data-prepopulated-fields="{{ prepopulated_fields_json }}"> diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py index 192d78f331..c119066ad7 100644 --- a/tests/forms_tests/tests/test_media.py +++ b/tests/forms_tests/tests/test_media.py @@ -19,9 +19,9 @@ class FormsMediaTestCase(SimpleTestCase): str(m), """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) self.assertEqual( repr(m), @@ -40,9 +40,9 @@ class FormsMediaTestCase(SimpleTestCase): str(m3), """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # A widget can exist without a media definition @@ -72,9 +72,9 @@ class FormsMediaTestCase(SimpleTestCase): str(w1.media), """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # Media objects can be interrogated by media type @@ -86,9 +86,9 @@ class FormsMediaTestCase(SimpleTestCase): self.assertEqual( str(w1.media['js']), - """<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" + """<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) def test_combine_media(self): @@ -123,10 +123,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # media addition hasn't affected the original objects @@ -134,9 +134,9 @@ class FormsMediaTestCase(SimpleTestCase): str(w1.media), """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # Regression check for #12879: specifying the same CSS or JS file @@ -149,7 +149,7 @@ class FormsMediaTestCase(SimpleTestCase): w4 = MyWidget4() self.assertEqual(str(w4.media), """<link href="/path/to/css1" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script>""") +<script src="/path/to/js1"></script>""") def test_media_deduplication(self): # A deduplication test applied directly to a Media object, to confirm @@ -160,7 +160,7 @@ class FormsMediaTestCase(SimpleTestCase): js=('/path/to/js1', '/path/to/js1'), ) self.assertEqual(str(media), """<link href="/path/to/css1" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script>""") +<script src="/path/to/js1"></script>""") def test_media_property(self): ############################################################### @@ -175,7 +175,7 @@ class FormsMediaTestCase(SimpleTestCase): w4 = MyWidget4() self.assertEqual(str(w4.media), """<link href="/some/path" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/some/js"></script>""") +<script src="/some/js"></script>""") # Media properties can reference the media of their parents class MyWidget5(MyWidget4): @@ -186,8 +186,8 @@ class FormsMediaTestCase(SimpleTestCase): w5 = MyWidget5() self.assertEqual(str(w5.media), """<link href="/some/path" type="text/css" media="all" rel="stylesheet"> <link href="/other/path" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/some/js"></script> -<script type="text/javascript" src="/other/js"></script>""") +<script src="/some/js"></script> +<script src="/other/js"></script>""") def test_media_property_parent_references(self): # Media properties can reference the media of their parents, @@ -210,10 +210,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/other/path" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/other/js"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="/other/js"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) def test_media_inheritance(self): @@ -237,9 +237,9 @@ class FormsMediaTestCase(SimpleTestCase): str(w7.media), """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # If a widget extends another but defines media, it extends the parent widget's media by default @@ -256,10 +256,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> <link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) def test_media_inheritance_from_property(self): @@ -289,8 +289,8 @@ class FormsMediaTestCase(SimpleTestCase): str(w9.media), """<link href="/some/path" type="text/css" media="all" rel="stylesheet"> <link href="/other/path" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/some/js"></script> -<script type="text/javascript" src="/other/js"></script>""" +<script src="/some/js"></script> +<script src="/other/js"></script>""" ) # A widget can disable media inheritance by specifying 'extend=False' @@ -305,8 +305,8 @@ class FormsMediaTestCase(SimpleTestCase): w10 = MyWidget10() self.assertEqual(str(w10.media), """<link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> <link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/path/to/js4"></script>""") +<script src="/path/to/js1"></script> +<script src="/path/to/js4"></script>""") def test_media_inheritance_extends(self): # A widget can explicitly enable full media inheritance by specifying 'extend=True' @@ -331,10 +331,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> <link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) def test_media_inheritance_single_type(self): @@ -360,8 +360,8 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> <link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/path/to/js4"></script>""" +<script src="/path/to/js1"></script> +<script src="/path/to/js4"></script>""" ) def test_multi_media(self): @@ -386,8 +386,8 @@ class FormsMediaTestCase(SimpleTestCase): <link href="/file3" type="text/css" media="screen" rel="stylesheet"> <link href="/file1" type="text/css" media="screen, print" rel="stylesheet"> <link href="/file2" type="text/css" media="screen, print" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/path/to/js4"></script>""" +<script src="/path/to/js1"></script> +<script src="/path/to/js4"></script>""" ) def test_multi_widget(self): @@ -429,10 +429,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) def test_form_media(self): @@ -471,10 +471,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # Form media can be combined to produce a single media definition. @@ -486,10 +486,10 @@ class FormsMediaTestCase(SimpleTestCase): """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # Forms can also define media, following the same rules as widgets. @@ -509,21 +509,21 @@ class FormsMediaTestCase(SimpleTestCase): <link href="/some/form/css" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css3" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/some/form/javascript"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" +<script src="/path/to/js1"></script> +<script src="/some/form/javascript"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" ) # Media works in templates self.assertEqual( Template("{{ form.media.js }}{{ form.media.css }}").render(Context({'form': f3})), - """<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="/some/form/javascript"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="/path/to/js4"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script>""" + """<script src="/path/to/js1"></script> +<script src="/some/form/javascript"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="/path/to/js4"></script> +<script src="https://secure.other.com/path/to/js3"></script>""" """<link href="http://media.example.com/static/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/some/form/css" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index e264b6df77..8259b3b8bd 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -2386,7 +2386,7 @@ class OtherModelFormTests(TestCase): self.assertHTMLEqual( str(f.media), '''<link href="/some/form/css" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/some/form/javascript"></script>''' +<script src="/some/form/javascript"></script>''' ) def test_choices_type(self): diff --git a/tests/staticfiles_tests/test_forms.py b/tests/staticfiles_tests/test_forms.py index 0178bab931..1fbcbe164c 100644 --- a/tests/staticfiles_tests/test_forms.py +++ b/tests/staticfiles_tests/test_forms.py @@ -31,8 +31,8 @@ class StaticFilesFormsMediaTestCase(SimpleTestCase): str(m), """<link href="https://example.com/assets/path/to/css1" type="text/css" media="all" rel="stylesheet"> <link href="/path/to/css2" type="text/css" media="all" rel="stylesheet"> -<script type="text/javascript" src="/path/to/js1"></script> -<script type="text/javascript" src="http://media.other.com/path/to/js2"></script> -<script type="text/javascript" src="https://secure.other.com/path/to/js3"></script> -<script type="text/javascript" src="https://example.com/assets/relative/path/to/js4"></script>""" +<script src="/path/to/js1"></script> +<script src="http://media.other.com/path/to/js2"></script> +<script src="https://secure.other.com/path/to/js3"></script> +<script src="https://example.com/assets/relative/path/to/js4"></script>""" ) diff --git a/tests/templates/custom_admin/change_list.html b/tests/templates/custom_admin/change_list.html index eebc9c7e30..bb6f43748e 100644 --- a/tests/templates/custom_admin/change_list.html +++ b/tests/templates/custom_admin/change_list.html @@ -1,7 +1,7 @@ {% extends "admin/change_list.html" %} {% block extrahead %} -<script type="text/javascript"> +<script> var hello = '{{ extra_var }}'; </script> {% endblock %} diff --git a/tests/utils_tests/files/strip_tags1.html b/tests/utils_tests/files/strip_tags1.html index 5e191f31fd..1e09134e81 100644 --- a/tests/utils_tests/files/strip_tags1.html +++ b/tests/utils_tests/files/strip_tags1.html @@ -24,8 +24,8 @@ - <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-d76b58e749b52bc47a4c46620bf2c320fabe5248.js" type="text/javascript"></script> - <script src="https://a248.e.akamai.net/assets.github.com/assets/github-67b55380cff8d6766b298e6935a3c1db7d5c6d5d.js" type="text/javascript"></script> + <script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-d76b58e749b52bc47a4c46620bf2c320fabe5248.js"></script> + <script src="https://a248.e.akamai.net/assets.github.com/assets/github-67b55380cff8d6766b298e6935a3c1db7d5c6d5d.js"></script> <meta http-equiv="x-pjax-version" content="1212ad79754350a805cefbcd08a3dadf"> diff --git a/tests/view_tests/templates/jsi18n-multi-catalogs.html b/tests/view_tests/templates/jsi18n-multi-catalogs.html index 8ec902e1c7..11b84d0bfa 100644 --- a/tests/view_tests/templates/jsi18n-multi-catalogs.html +++ b/tests/view_tests/templates/jsi18n-multi-catalogs.html @@ -1,15 +1,15 @@ <html> <head> - <script type="text/javascript" src="/jsi18n/app1/"></script> - <script type="text/javascript" src="/jsi18n/app2/"></script> + <script src="/jsi18n/app1/"></script> + <script src="/jsi18n/app2/"></script> <body> <p id="app1string"> - <script type="text/javascript"> + <script> document.write(gettext('this app1 string is to be translated')) </script> </p> <p id="app2string"> - <script type="text/javascript"> + <script> document.write(gettext('this app2 string is to be translated')) </script> </p> diff --git a/tests/view_tests/templates/jsi18n.html b/tests/view_tests/templates/jsi18n.html index f0bd17c199..40ae8e7221 100644 --- a/tests/view_tests/templates/jsi18n.html +++ b/tests/view_tests/templates/jsi18n.html @@ -1,11 +1,11 @@ <html> <head> - <script type="text/javascript" src="/jsi18n_admin/"></script> + <script src="/jsi18n_admin/"></script> </head> <body> <p id="formats"> - <script type="text/javascript"> + <script> document.write("DATE_INPUT_FORMATS is an " + typeof get_format("DATE_INPUT_FORMATS") + "; "); document.write("DECIMAL_SEPARATOR is a " + typeof get_format("DECIMAL_SEPARATOR") + "; "); document.write("FIRST_DAY_OF_WEEK is a " + typeof get_format("FIRST_DAY_OF_WEEK") + ";"); @@ -13,44 +13,44 @@ </p> <p id="gettext"> - <script type="text/javascript"> + <script> document.write(gettext("Remove")); </script> </p> <p id="ngettext_sing"> - <script type="text/javascript"> + <script> document.write(interpolate(ngettext("%s item", "%s items", 1), [1])); </script> </p> <p id="ngettext_plur"> - <script type="text/javascript"> + <script> document.write(interpolate(ngettext("%s item", "%s items", 455), [455])); </script> </p> <p id="ngettext_onnonplural"> <!-- The po file only contains the non plural "Image" string. --> - <script type="text/javascript"> + <script> document.write(interpolate(ngettext("Image", "Images", 5), [1])); </script> </p> <p id="pgettext"> - <script type="text/javascript"> + <script> document.write(pgettext("verb", "May")); </script> </p> <p id="npgettext_sing"> - <script type="text/javascript"> + <script> document.write(interpolate(npgettext("search", "%s result", "%s results", 1), [1])); </script> </p> <p id="npgettext_plur"> - <script type="text/javascript"> + <script> document.write(interpolate(npgettext("search", "%s result", "%s results", 455), [455])); </script> </p> |
