Skip to content

Commit

Permalink
Merge pull request #758 from volosied/MYFACES-4681-5.0
Browse files Browse the repository at this point in the history
Fix MYFACES-4681 [5.0] + tests
  • Loading branch information
volosied authored Oct 1, 2024
2 parents ac9c675 + 2e2b1f9 commit 7435859
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ public void writeDoctype(String name, String publicId, String systemId)

DoctypeUnit unit = new DoctypeUnit(this.alias, this.nextTagId(),
name, publicId, systemId, faceletsProcessingInstructions.isHtml5Doctype());
if(faceletsProcessingInstructions.isHtml5Doctype())
{
// MYFACES-4681: if facelet processing is HTML5 (default) then these should be null
publicId = null;
systemId = null;
}
this.doctype = new DoctypeImpl(name, publicId, systemId);
this.startUnit(unit);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ public void testCompilerXhtml() throws Exception {

Assertions.assertNotNull(((AbstractFacelet) f).getDoctype());
Assertions.assertEquals("html", ((AbstractFacelet) f).getDoctype().getRootElement());
Assertions.assertEquals("-//W3C//DTD XHTML 1.0 Transitional//EN", ((AbstractFacelet) f).getDoctype().getPublic());
Assertions.assertEquals("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", ((AbstractFacelet) f).getDoctype().getSystem());
// MYFACES-4681 - Simplified to <!DOCTYPE html> as HTML5 is default
Assertions.assertEquals(null, ((AbstractFacelet) f).getDoctype().getPublic());
Assertions.assertEquals(null, ((AbstractFacelet) f).getDoctype().getSystem());
}

@Test
Expand All @@ -92,7 +93,8 @@ public void testXhtml() throws Exception

Assertions.assertNotNull(root.getDoctype());
Assertions.assertEquals("html", root.getDoctype().getRootElement());
Assertions.assertEquals("-//W3C//DTD XHTML 1.0 Transitional//EN", root.getDoctype().getPublic());
Assertions.assertEquals("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd", root.getDoctype().getSystem());
// MYFACES-4681 - Simplified to <!DOCTYPE html> as HTML5 is default
Assertions.assertEquals(null, root.getDoctype().getPublic());
Assertions.assertEquals(null, root.getDoctype().getSystem());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public void testUpdateScript3Head() throws Exception
// the inclusion should trigger update head
Assertions.assertTrue(text.contains("update id=\"jakarta.faces.Resource\""));
Assertions.assertTrue(text.contains("alert(\"script3\");"));
Assertions.assertTrue(text.contains("link rel=\"stylesheet\" type=\"text/css\" href=\"/test/faces/jakarta.faces.resource/style3.css\""));
// MYFACES-4681 - HTML5 is default output mode, so the type attribute is unnecessary
Assertions.assertTrue(text.contains("link rel=\"stylesheet\" href=\"/test/faces/jakarta.faces.resource/style3.css\""));
//System.out.println(text);
endRequest();
}
Expand Down

0 comments on commit 7435859

Please sign in to comment.