Skip to content

Commit 8f89e69

Browse files
committed
more not tests
1 parent 4af2128 commit 8f89e69

1 file changed

Lines changed: 86 additions & 0 deletions

File tree

src/test/java/org/htmlunit/javascript/host/css/CSSSelector3Test.java

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,92 @@ public void notElement() throws Exception {
6868
loadPageVerifyTitle2(html);
6969
}
7070

71+
/**
72+
* @throws Exception if the test fails
73+
*/
74+
@Test
75+
@Alerts("0")
76+
public void notStar() throws Exception {
77+
final String html = DOCTYPE_HTML
78+
+ "<html>\n"
79+
+ "<head><title></title></head>\n"
80+
+ "<body>\n"
81+
+ "<ul>\n"
82+
+ " <li>ul - item 0</li>\n"
83+
+ "</ul>\n"
84+
85+
+ "<script>\n"
86+
+ LOG_TITLE_FUNCTION
87+
+ " try {\n"
88+
+ " let items = document.querySelectorAll(':not(*)');"
89+
+ " log(items.length);\n"
90+
+ " } catch (e) { logEx(e); }\n"
91+
+ "</script>\n"
92+
93+
+ "</body></html>";
94+
95+
loadPageVerifyTitle2(html);
96+
}
97+
98+
/**
99+
* @throws Exception if the test fails
100+
*/
101+
@Test
102+
@Alerts({"1", "[object HTMLUListElement]"})
103+
public void notId() throws Exception {
104+
final String html = DOCTYPE_HTML
105+
+ "<html>\n"
106+
+ "<head><title></title></head>\n"
107+
+ "<body>\n"
108+
+ "<ul id='foo'>\n"
109+
+ " <li>ul - item 0</li>\n"
110+
+ "</ul>\n"
111+
112+
+ "<script>\n"
113+
+ LOG_TITLE_FUNCTION
114+
+ " try {\n"
115+
+ " let items = document.querySelectorAll('#foo:not(#bar)');"
116+
+ " log(items.length);\n"
117+
+ " log(items[0]);\n"
118+
+ " } catch (e) { logEx(e); }\n"
119+
+ "</script>\n"
120+
121+
+ "</body></html>";
122+
123+
loadPageVerifyTitle2(html);
124+
}
125+
126+
/**
127+
* @throws Exception if the test fails
128+
*/
129+
@Test
130+
@Alerts({"1", "<a>my</a>", "0"})
131+
public void notTable() throws Exception {
132+
final String html = DOCTYPE_HTML
133+
+ "<html>\n"
134+
+ "<head><title></title></head>\n"
135+
+ "<body>\n"
136+
+ "<table>\n"
137+
+ " <tr><td><a>my</a></td></tr>\n"
138+
+ "</table>\n"
139+
140+
+ "<script>\n"
141+
+ LOG_TITLE_FUNCTION
142+
+ " try {\n"
143+
+ " let items = document.querySelectorAll('body :not(table) a');"
144+
+ " log(items.length);\n"
145+
+ " log(items[0].outerHTML);\n"
146+
147+
+ " items = document.querySelectorAll('body a:not(table a)');"
148+
+ " log(items.length);\n"
149+
+ " } catch (e) { logEx(e); }\n"
150+
+ "</script>\n"
151+
152+
+ "</body></html>";
153+
154+
loadPageVerifyTitle2(html);
155+
}
156+
71157
/**
72158
* @throws Exception if the test fails
73159
*/

0 commit comments

Comments
 (0)