dev@javaserverfaces.java.net

Re: Seeking Review 1777: headRenderer

From: Sheetal Vartak <sheetal.vartak_at_oracle.com>
Date: Tue, 17 Aug 2010 11:56:55 -0700

r=sheetalv

Thanks
Sheetal

On Aug 16, 2010, at 2:34 PM, Ed Burns wrote:

> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1777
>
> Fix HeadRenderer so that it actually follows the spec. https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1777
>
> suggested by java.net user cbd
>
> r=edburns
>
> SECTION: Modified Files
> ----------------------------
> M jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java
>
> - Move the encodeResources() to just before the head end.
>
> M jsf-ri/systest/src/com/sun/faces/systest/ResourceRelocationTestCase.java
>
> - modify test accordingly
>
> SECTION: Diffs
>
> Index: jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java
> ===================================================================
> --- jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java (revision 8557)
> +++ jsf-ri/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java (working copy)
> @@ -73,7 +73,6 @@
> writer,
> component,
> HEAD_ATTRIBUTES);
> - encodeHeadResources(context);
> }
>
> @Override
> @@ -86,6 +85,7 @@
> public void encodeEnd(FacesContext context, UIComponent component)
> throws IOException {
> ResponseWriter writer = context.getResponseWriter();
> + encodeHeadResources(context);
> writer.endElement("head");
> }
>
> Index: jsf-ri/systest/src/com/sun/faces/systest/ResourceRelocationTestCase.java
> ===================================================================
> --- jsf-ri/systest/src/com/sun/faces/systest/ResourceRelocationTestCase.java (revision 8557)
> +++ jsf-ri/systest/src/com/sun/faces/systest/ResourceRelocationTestCase.java (working copy)
> @@ -95,11 +95,11 @@
> int sheetPos;
>
> if (scriptfirst) {
> - scriptPos = 0;
> + scriptPos = 1;
> + sheetPos = 2;
> + } else {
> sheetPos = 1;
> - } else {
> - sheetPos = 0;
> - scriptPos = 1;
> + scriptPos = 2;
> }
>
> // for this request, the script and stylesheet will be in the head
> @@ -110,7 +110,7 @@
> HtmlHead head = headList.get(0);
> List<HtmlElement> headChildren = getChildren(head);
> assertTrue(headChildren.size() == 3);
> - assertTrue(headChildren.get(2) instanceof HtmlTitle);
> + assertTrue(headChildren.get(0) instanceof HtmlTitle);
> assertTrue(headChildren.get(scriptPos) instanceof HtmlScript);
> assertTrue(headChildren.get(sheetPos) instanceof HtmlLink);
> List<HtmlBody> bodyList = new ArrayList<HtmlBody>(1);
> @@ -138,8 +138,8 @@
> head = headList.get(0);
> headChildren = getChildren(head);
> assertTrue(headChildren.size() == 2);
> - assertTrue(headChildren.get(1) instanceof HtmlTitle);
> - assertTrue(headChildren.get(0) instanceof HtmlLink);
> + assertTrue(headChildren.get(0) instanceof HtmlTitle);
> + assertTrue(headChildren.get(1) instanceof HtmlLink);
> bodyList.clear();
> getAllElementsOfGivenClass(page, bodyList, HtmlBody.class);
> assertTrue(bodyList.size() == 1);
> @@ -166,8 +166,8 @@
> head = headList.get(0);
> headChildren = getChildren(head);
> assertTrue(headChildren.size() == 2);
> - assertTrue(headChildren.get(1) instanceof HtmlTitle);
> - assertTrue(headChildren.get(0) instanceof HtmlLink);
> + assertTrue(headChildren.get(0) instanceof HtmlTitle);
> + assertTrue(headChildren.get(1) instanceof HtmlLink);
> bodyList.clear();
> getAllElementsOfGivenClass(page, bodyList, HtmlBody.class);
> assertTrue(bodyList.size() == 1);
>
> --
> | edburns_at_sun.com | office: +1 407 458 0017
> | homepage: | http://ridingthecrest.com/
> | 02 work days until JSF 2.1 Milestone 2
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>