1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.html;
16
17 import org.htmlunit.WebDriverTestCase;
18 import org.htmlunit.junit.BrowserRunner;
19 import org.htmlunit.junit.annotation.Alerts;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import org.openqa.selenium.By;
23 import org.openqa.selenium.WebDriver;
24 import org.openqa.selenium.htmlunit.HtmlUnitDriver;
25
26
27
28
29
30
31
32 @RunWith(BrowserRunner.class)
33 public class HtmlQuoteTest extends WebDriverTestCase {
34
35
36
37
38 @Test
39 @Alerts({"[object HTMLQuoteElement]", "[object HTMLQuoteElement]"})
40 public void simpleScriptable() throws Exception {
41 final String html = DOCTYPE_HTML
42 + "<html><head>\n"
43 + "<script>\n"
44 + LOG_TITLE_FUNCTION
45 + " function test() {\n"
46 + " log(document.getElementById('myId1'));\n"
47 + " log(document.getElementById('myId2'));\n"
48 + " }\n"
49 + "</script>\n"
50 + "</head><body onload='test()'>\n"
51 + " <q id='myId1'>First Quote</q>\n"
52 + " <blockquote id='myId2'>Second Quote</blockquote>\n"
53 + "</body></html>";
54
55 final WebDriver driver = loadPageVerifyTitle2(html);
56 if (driver instanceof HtmlUnitDriver) {
57 assertTrue(toHtmlElement(driver.findElement(By.id("myId1"))) instanceof HtmlInlineQuotation);
58 assertTrue(toHtmlElement(driver.findElement(By.id("myId2"))) instanceof HtmlBlockQuote);
59 }
60 }
61 }