1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.intl;
16
17 import org.htmlunit.WebDriverTestCase;
18 import org.htmlunit.junit.annotation.Alerts;
19 import org.junit.jupiter.api.Test;
20
21
22
23
24
25
26
27 public class IntlTest extends WebDriverTestCase {
28
29
30
31
32 @Test
33 @Alerts("[object Intl]")
34 public void intl() throws Exception {
35 test("Intl");
36 }
37
38 private void test(final String string) throws Exception {
39 final String html = DOCTYPE_HTML
40 + "<html><head>\n"
41 + "<script>\n"
42 + LOG_TITLE_FUNCTION
43 + " function test() {\n"
44 + " try {\n"
45 + " log(" + string + ");\n"
46 + " } catch(e) { logEx(e) }\n"
47 + " }\n"
48 + "</script>\n"
49 + "</head><body onload='test()'>\n"
50 + "</body></html>";
51
52 loadPageVerifyTitle2(html);
53 }
54
55
56
57
58 @Test
59 @Alerts("function Collator() { [native code] }")
60 public void collator() throws Exception {
61 test("Intl.Collator");
62 }
63
64
65
66
67 @Test
68 @Alerts("function DateTimeFormat() { [native code] }")
69 public void dateTimeFormat() throws Exception {
70 test("Intl.DateTimeFormat");
71 }
72
73
74
75
76 @Test
77 @Alerts("function NumberFormat() { [native code] }")
78 public void numberFormat() throws Exception {
79 test("Intl.NumberFormat");
80 }
81
82
83
84
85 @Test
86 @Alerts(DEFAULT = "undefined",
87 CHROME = "function v8BreakIterator() { [native code] }",
88 EDGE = "function v8BreakIterator() { [native code] }")
89 public void v8BreakIterator() throws Exception {
90 test("Intl.v8BreakIterator");
91 }
92
93 }