Added some tests for #21725.
Fixed test failures when running in a narrow Python build.
Deprecated django.utils.text.javascript_quote.

Refs #21725.