View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.juneau.bean.html5;
18  
19  import static org.apache.juneau.bean.html5.HtmlBuilder.*;
20  import static org.apache.juneau.junit.bct.BctAssertions.*;
21  
22  import org.apache.juneau.*;
23  import org.junit.jupiter.api.*;
24  
25  class Td_Test extends TestBase {
26  
27  	@Test void a01_basicSetters() {
28  		Td x = td()
29  			.colspan("a")
30  			.headers("b")
31  			.rowspan("c")
32  			._class("d")
33  			.accesskey("e")
34  			.contenteditable("f")
35  			.dir("g")
36  			.hidden("h")
37  			.id("i")
38  			.lang("j")
39  			.onabort("k")
40  			.onblur("l")
41  			.oncancel("m")
42  			.oncanplay("n")
43  			.oncanplaythrough("o")
44  			.onchange("p")
45  			.onclick("q")
46  			.oncuechange("r")
47  			.ondblclick("s")
48  			.ondurationchange("t")
49  			.onemptied("u")
50  			.onended("v")
51  			.onerror("w")
52  			.onfocus("x")
53  			.oninput("y")
54  			.oninvalid("z")
55  			.onkeydown("aa")
56  			.onkeypress("ab")
57  			.onkeyup("ac")
58  			.onload("ad")
59  			.onloadeddata("ae")
60  			.onloadedmetadata("af")
61  			.onloadstart("ag")
62  			.onmousedown("ah")
63  			.onmouseenter("ai")
64  			.onmouseleave("aj")
65  			.onmousemove("ak")
66  			.onmouseout("al")
67  			.onmouseover("am")
68  			.onmouseup("an")
69  			.onmousewheel("ao")
70  			.onpause("ap")
71  			.onplay("aq")
72  			.onplaying("ar")
73  			.onprogress("as")
74  			.onratechange("at")
75  			.onreset("au")
76  			.onresize("av")
77  			.onscroll("aw")
78  			.onseeked("ax")
79  			.onseeking("ay")
80  			.onselect("az")
81  			.onshow("ba")
82  			.onstalled("bb")
83  			.onsubmit("bc")
84  			.onsuspend("bd")
85  			.ontimeupdate("be")
86  			.ontoggle("bf")
87  			.onvolumechange("bg")
88  			.onwaiting("bh")
89  			.spellcheck("bi")
90  			.style("bj")
91  			.tabindex("bk")
92  			.title("bl")
93  			.translate("bm")
94  			.children("bn", strong("bo"));
95  
96  		assertString(
97  			"<td colspan='a' headers='b' rowspan='c' class='d' accesskey='e' contenteditable='f' dir='g' hidden='h' id='i' lang='j' onabort='k' onblur='l' oncancel='m' oncanplay='n' oncanplaythrough='o' onchange='p' onclick='q' oncuechange='r' ondblclick='s' ondurationchange='t' onemptied='u' onended='v' onerror='w' onfocus='x' oninput='y' oninvalid='z' onkeydown='aa' onkeypress='ab' onkeyup='ac' onload='ad' onloadeddata='ae' onloadedmetadata='af' onloadstart='ag' onmousedown='ah' onmouseenter='ai' onmouseleave='aj' onmousemove='ak' onmouseout='al' onmouseover='am' onmouseup='an' onmousewheel='ao' onpause='ap' onplay='aq' onplaying='ar' onprogress='as' onratechange='at' onreset='au' onresize='av' onscroll='aw' onseeked='ax' onseeking='ay' onselect='az' onshow='ba' onstalled='bb' onsubmit='bc' onsuspend='bd' ontimeupdate='be' ontoggle='bf' onvolumechange='bg' onwaiting='bh' spellcheck='bi' style='bj' tabindex='bk' title='bl' translate='bm'>bn<strong>bo</strong></td>",
98  			x
99  		);
100 	}
101 
102 	@Test void a02_emptyBean() {
103 		assertString("<td></td>", td());
104 	}
105 
106 	@Test void a03_otherConstructors() {
107 		Td x1 = new Td("a1", strong("a2"));
108 		assertString("<td>a1<strong>a2</strong></td>", x1);
109 
110 	}
111 }