YARN-2610. Hamlet should close table tags. (Ray Chiang via kasha)

(cherry picked from commit f7743dd07d)
This commit is contained in:
Karthik Kambatla 2014-09-29 11:33:44 -07:00
parent ab3cab0b53
commit c206265b7e
4 changed files with 17 additions and 14 deletions

View File

@ -441,6 +441,8 @@ Release 2.6.0 - UNRELEASED
YARN-2606. Application History Server tries to access hdfs before doing
secure login (Mit Desai via jeagles)
YARN-2610. Hamlet should close table tags. (Ray Chiang via kasha)
YARN-2387. Resource Manager crashes with NPE due to lack of
synchronization (Mit Desai via jlowe)

View File

@ -2423,10 +2423,10 @@ public class Hamlet extends HamletImpl implements HamletSpec._Html {
}
private <T extends _> TH<T> th_(T e, boolean inline) {
return new TH<T>("th", e, opt(false, inline, false)); }
return new TH<T>("th", e, opt(true, inline, false)); }
private <T extends _> TD<T> td_(T e, boolean inline) {
return new TD<T>("td", e, opt(false, inline, false)); }
return new TD<T>("td", e, opt(true, inline, false)); }
public class COL<T extends _> extends EImp<T> implements HamletSpec.COL {
public COL(String name, T parent, EnumSet<EOpt> opts) {
@ -3719,10 +3719,10 @@ public class Hamlet extends HamletImpl implements HamletSpec._Html {
return new COLGROUP<T>("colgroup", e, opt(false, inline, false)); }
private <T extends _> THEAD<T> thead_(T e, boolean inline) {
return new THEAD<T>("thead", e, opt(false, inline, false)); }
return new THEAD<T>("thead", e, opt(true, inline, false)); }
private <T extends _> TFOOT<T> tfoot_(T e, boolean inline) {
return new TFOOT<T>("tfoot", e, opt(false, inline, false)); }
return new TFOOT<T>("tfoot", e, opt(true, inline, false)); }
private <T extends _> TBODY<T> tbody_(T e, boolean inline) {
return new TBODY<T>("tbody", e, opt(true, inline, false)); }
@ -3731,7 +3731,7 @@ public class Hamlet extends HamletImpl implements HamletSpec._Html {
return new COL<T>("col", e, opt(false, inline, false)); }
private <T extends _> TR<T> tr_(T e, boolean inline) {
return new TR<T>("tr", e, opt(false, inline, false)); }
return new TR<T>("tr", e, opt(true, inline, false)); }
public class BUTTON<T extends _> extends EImp<T> implements HamletSpec.BUTTON {
public BUTTON(String name, T parent, EnumSet<EOpt> opts) {

View File

@ -88,8 +88,8 @@ public class TestHamlet {
assertEquals(0, h.nestLevel);
verify(out).print("<table");
verify(out).print("</table>");
verify(out, never()).print("</td>");
verify(out, never()).print("</tr>");
verify(out, atLeast(1)).print("</td>");
verify(out, atLeast(1)).print("</tr>");
}
@Test public void testEnumAttrs() {

View File

@ -68,7 +68,7 @@ public class TestInfoBlock {
static {
resInfo = new ResponseInfo();
resInfo._("Single_line_value", "This is one line.");
resInfo._("Multiple_line_value", "This is one line.");
resInfo._("Multiple_line_value", "This is first line.\nThis is second line.");
}
@ -98,13 +98,14 @@ public class TestInfoBlock {
WebAppTests.testBlock(MultilineInfoBlock.class);
TestInfoBlock.pw.flush();
String output = TestInfoBlock.sw.toString().replaceAll(" +", " ");
String expectedSinglelineData = String.format("<tr class=\"odd\">%n"
+ " <th>%n Single_line_value%n <td>%n This is one line.%n");
String expectedMultilineData = String.format("<tr class=\"even\">%n"
+ " <th>%n Multiple_line_value%n <td>%n <div>%n"
String expectedMultilineData1 = String.format("<tr class=\"odd\">%n"
+ " <th>%n Multiple_line_value%n </th>%n"
+ " <td>%n This is one line.%n </td>%n");
String expectedMultilineData2 = String.format("<tr class=\"even\">%n"
+ " <th>%n Multiple_line_value%n </th>%n <td>%n <div>%n"
+ " This is first line.%n </div>%n <div>%n"
+ " This is second line.%n </div>%n");
assertTrue(output.contains(expectedSinglelineData) && output.contains(expectedMultilineData));
assertTrue(output.contains(expectedMultilineData1) && output.contains(expectedMultilineData2));
}
@Test(timeout=60000L)
@ -115,4 +116,4 @@ public class TestInfoBlock {
assertFalse(output.contains("<script>"));
assertTrue(output.contains(JAVASCRIPT_ESCAPED));
}
}
}