From 0314cc9717afc2264013838f504821f9d4ed2962 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Wed, 21 Jan 2026 07:23:48 +0000 Subject: [PATCH] Add tests for global DOM engine behavior --- tests/test_html.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_html.py b/tests/test_html.py index 331b461..790d305 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -224,3 +224,21 @@ def test_render_twice(self): ), "

Header

", ) + + def test_engine_is_global_for_existing_instances(self): + html_string = HTML({"engine": DOM.STRING}) + HTML({"engine": DOM.STRING_COMPAT}) + + self.assertEqual( + html_string.render({"entityMap": {}, "blocks": [{"text": 'Quote "here"'}]}), + "

Quote "here"

", + ) + + def test_engine_switching_affects_previous_instance(self): + html_compat = HTML({"engine": DOM.STRING_COMPAT}) + HTML({"engine": DOM.STRING}) + + self.assertEqual( + html_compat.render({"entityMap": {}, "blocks": [{"text": 'Quote "here"'}]}), + '

Quote "here"

', + )