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 Optgroup_Test extends TestBase {
26  
27  	@Test void a01_basicSetters() {
28  		Optgroup x = optgroup()
29  			.disabled("a")
30  			.label("b")
31  			._class("c")
32  			.accesskey("d")
33  			.contenteditable("e")
34  			.dir("f")
35  			.hidden("g")
36  			.id("h")
37  			.lang("i")
38  			.onabort("j")
39  			.onblur("k")
40  			.oncancel("l")
41  			.oncanplay("m")
42  			.oncanplaythrough("n")
43  			.onchange("o")
44  			.onclick("p")
45  			.oncuechange("q")
46  			.ondblclick("r")
47  			.ondurationchange("s")
48  			.onemptied("t")
49  			.onended("u")
50  			.onerror("v")
51  			.onfocus("w")
52  			.oninput("x")
53  			.oninvalid("y")
54  			.onkeydown("z")
55  			.onkeypress("aa")
56  			.onkeyup("ab")
57  			.onload("ac")
58  			.onloadeddata("ad")
59  			.onloadedmetadata("ae")
60  			.onloadstart("af")
61  			.onmousedown("ag")
62  			.onmouseenter("ah")
63  			.onmouseleave("ai")
64  			.onmousemove("aj")
65  			.onmouseout("ak")
66  			.onmouseover("al")
67  			.onmouseup("am")
68  			.onmousewheel("an")
69  			.onpause("ao")
70  			.onplay("ap")
71  			.onplaying("aq")
72  			.onprogress("ar")
73  			.onratechange("as")
74  			.onreset("at")
75  			.onresize("au")
76  			.onscroll("av")
77  			.onseeked("aw")
78  			.onseeking("ax")
79  			.onselect("ay")
80  			.onshow("az")
81  			.onstalled("ba")
82  			.onsubmit("bb")
83  			.onsuspend("bc")
84  			.ontimeupdate("bd")
85  			.ontoggle("be")
86  			.onvolumechange("bf")
87  			.onwaiting("bg")
88  			.spellcheck("bh")
89  			.style("bi")
90  			.tabindex("bj")
91  			.title("bk")
92  			.translate("bl")
93  			.child("child1")
94  			.children("bm", strong("bn"));
95  
96  		assertString(
97  			"<optgroup disabled='a' label='b' class='c' accesskey='d' contenteditable='e' dir='f' hidden='g' id='h' lang='i' onabort='j' onblur='k' oncancel='l' oncanplay='m' oncanplaythrough='n' onchange='o' onclick='p' oncuechange='q' ondblclick='r' ondurationchange='s' onemptied='t' onended='u' onerror='v' onfocus='w' oninput='x' oninvalid='y' onkeydown='z' onkeypress='aa' onkeyup='ab' onload='ac' onloadeddata='ad' onloadedmetadata='ae' onloadstart='af' onmousedown='ag' onmouseenter='ah' onmouseleave='ai' onmousemove='aj' onmouseout='ak' onmouseover='al' onmouseup='am' onmousewheel='an' onpause='ao' onplay='ap' onplaying='aq' onprogress='ar' onratechange='as' onreset='at' onresize='au' onscroll='av' onseeked='aw' onseeking='ax' onselect='ay' onshow='az' onstalled='ba' onsubmit='bb' onsuspend='bc' ontimeupdate='bd' ontoggle='be' onvolumechange='bf' onwaiting='bg' spellcheck='bh' style='bi' tabindex='bj' title='bk' translate='bl'>child1bm<strong>bn</strong></optgroup>",
98  			x
99  		);
100 	}
101 
102 	@Test void a02_emptyBean() {
103 		assertString("<optgroup></optgroup>", optgroup());
104 	}
105 
106 	@Test void a03_otherConstructors() {
107 		Optgroup x1 = new Optgroup("a1", strong("a2"));
108 		assertString("<optgroup>a1<strong>a2</strong></optgroup>", x1);
109 
110 	}
111 }