From fa38a991d3b4e6c33fb65e2b74d868197b745144 Mon Sep 17 00:00:00 2001 From: Shangeeth Rajasekar Date: Wed, 7 Jan 2026 01:07:06 +0530 Subject: [PATCH] Fix invalid nested + * After fix: + */ + @Test + public void testOptgroupInsideSelectDoesNotAddExtraSelectTags() { + PolicyFactory factory = new HtmlPolicyBuilder() + .allowElements("select", "optgroup", "option") + .allowAttributes("label").globally() + .toFactory(); + + String input = ""; + String result = factory.sanitize(input); + + // The key assertion: no extra select tags should be inserted + assertEquals(input, result); + } +} \ No newline at end of file