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 Input_Test extends TestBase {
26  
27  	@Test void a01_basicSetters() {
28  		Input x = input()
29  			.accept("a")
30  			.alt("b")
31  			.autocomplete("c")
32  			.autofocus("d")
33  			.checked("e")
34  			.dirname("f")
35  			.disabled("g")
36  			.form("h")
37  			.formaction("i")
38  			.formenctype("j")
39  			.formmethod("k")
40  			.formnovalidate("l")
41  			.formtarget("m")
42  			.height("n")
43  			.inputmode("o")
44  			.list("p")
45  			.max("q")
46  			.maxlength("r")
47  			.min("s")
48  			.minlength("t")
49  			.multiple("u")
50  			.name("v")
51  			.pattern("w")
52  			.placeholder("x")
53  			.readonly("y")
54  			.readonly(true)
55  			.required("aa")
56  			.size("ab")
57  			.src("ac")
58  			.step("ad")
59  			.type("ae")
60  			.value("af")
61  			.width("ag")
62  			._class("ah")
63  			.accesskey("ai")
64  			.contenteditable("aj")
65  			.dir("ak")
66  			.hidden("al")
67  			.id("am")
68  			.lang("an")
69  			.onabort("ao")
70  			.onblur("ap")
71  			.oncancel("aq")
72  			.oncanplay("ar")
73  			.oncanplaythrough("as")
74  			.onchange("at")
75  			.onclick("au")
76  			.oncuechange("av")
77  			.ondblclick("aw")
78  			.ondurationchange("ax")
79  			.onemptied("ay")
80  			.onended("az")
81  			.onerror("ba")
82  			.onfocus("bb")
83  			.oninput("bc")
84  			.oninvalid("bd")
85  			.onkeydown("be")
86  			.onkeypress("bf")
87  			.onkeyup("bg")
88  			.onload("bh")
89  			.onloadeddata("bi")
90  			.onloadedmetadata("bj")
91  			.onloadstart("bk")
92  			.onmousedown("bl")
93  			.onmouseenter("bm")
94  			.onmouseleave("bn")
95  			.onmousemove("bo")
96  			.onmouseout("bp")
97  			.onmouseover("bq")
98  			.onmouseup("br")
99  			.onmousewheel("bs")
100 			.onpause("bt")
101 			.onplay("bu")
102 			.onplaying("bv")
103 			.onprogress("bw")
104 			.onratechange("bx")
105 			.onreset("by")
106 			.onresize("bz")
107 			.onscroll("ca")
108 			.onseeked("cb")
109 			.onseeking("cc")
110 			.onselect("cd")
111 			.onshow("ce")
112 			.onstalled("cf")
113 			.onsubmit("cg")
114 			.onsuspend("ch")
115 			.ontimeupdate("ci")
116 			.ontoggle("cj")
117 			.onvolumechange("ck")
118 			.onwaiting("cl")
119 			.spellcheck("cm")
120 			.style("cn")
121 			.tabindex("co")
122 			.title("cp")
123 			.translate("cq");
124 
125 		assertString(
126 			"<input accept='a' alt='b' autocomplete='c' autofocus='d' checked='e' dirname='f' disabled='g' form='h' formaction='i' formenctype='j' formmethod='k' formnovalidate='l' formtarget='m' height='n' inputmode='o' list='p' max='q' maxlength='r' min='s' minlength='t' multiple='u' name='v' pattern='w' placeholder='x' readonly='y' value='af' required='aa' size='ab' src='ac' step='ad' type='ae' width='ag' class='ah' accesskey='ai' contenteditable='aj' dir='ak' hidden='al' id='am' lang='an' onabort='ao' onblur='ap' oncancel='aq' oncanplay='ar' oncanplaythrough='as' onchange='at' onclick='au' oncuechange='av' ondblclick='aw' ondurationchange='ax' onemptied='ay' onended='az' onerror='ba' onfocus='bb' oninput='bc' oninvalid='bd' onkeydown='be' onkeypress='bf' onkeyup='bg' onload='bh' onloadeddata='bi' onloadedmetadata='bj' onloadstart='bk' onmousedown='bl' onmouseenter='bm' onmouseleave='bn' onmousemove='bo' onmouseout='bp' onmouseover='bq' onmouseup='br' onmousewheel='bs' onpause='bt' onplay='bu' onplaying='bv' onprogress='bw' onratechange='bx' onreset='by' onresize='bz' onscroll='ca' onseeked='cb' onseeking='cc' onselect='cd' onshow='ce' onstalled='cf' onsubmit='cg' onsuspend='ch' ontimeupdate='ci' ontoggle='cj' onvolumechange='ck' onwaiting='cl' spellcheck='cm' style='cn' tabindex='co' title='cp' translate='cq'/>",
127 			x
128 		);
129 	}
130 
131 	@Test void a02_emptyBean() {
132 		assertString("<input/>", input());
133 	}
134 
135 	@Test void a03_otherConstructors() {
136 		Input x1 = new Input("a");
137 		assertString("<input type='a'/>", x1);
138 
139 	}
140 }