feat: TagFormatter - Allow users to customize component template tags (#572)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Juro Oravec 2024-08-18 16:58:56 +02:00 committed by GitHub
parent b89c09aa5f
commit 71d8679e8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 1593 additions and 474 deletions

20
tests/test_utils.py Normal file
View file

@ -0,0 +1,20 @@
from django_components.utils import is_str_wrapped_in_quotes
from .django_test_setup import setup_test_config
from .testutils import BaseTestCase
setup_test_config({"autodiscover": False})
class UtilsTest(BaseTestCase):
def test_is_str_wrapped_in_quotes(self):
self.assertEqual(is_str_wrapped_in_quotes("word"), False)
self.assertEqual(is_str_wrapped_in_quotes('word"'), False)
self.assertEqual(is_str_wrapped_in_quotes('"word'), False)
self.assertEqual(is_str_wrapped_in_quotes('"word"'), True)
self.assertEqual(is_str_wrapped_in_quotes("\"word'"), False)
self.assertEqual(is_str_wrapped_in_quotes('"word" '), False)
self.assertEqual(is_str_wrapped_in_quotes('"'), False)
self.assertEqual(is_str_wrapped_in_quotes(""), False)
self.assertEqual(is_str_wrapped_in_quotes('""'), True)
self.assertEqual(is_str_wrapped_in_quotes("\"'"), False)