Skip to content

Commit 23cbd54

Browse files
committed
more tests
1 parent 5036ac6 commit 23cbd54

4 files changed

Lines changed: 188 additions & 1 deletion

File tree

src/main/java/org/htmlunit/javascript/host/intl/Intl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private static void defineStaticFunctions(final ClassConfiguration config,
105105
if (staticFunctionMap != null) {
106106
for (final Map.Entry<String, Method> entry : staticFunctionMap.entrySet()) {
107107
final FunctionObject fn = new FunctionObject(entry.getKey(), entry.getValue(), scope);
108-
target.defineProperty(entry.getKey(), fn, ScriptableObject.EMPTY);
108+
target.defineProperty(entry.getKey(), fn, ScriptableObject.DONTENUM);
109109
}
110110
}
111111
}

src/test/java/org/htmlunit/general/ElementOwnPropertiesTest.java

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18710,4 +18710,117 @@ public void notification() throws Exception {
1871018710
public void console() throws Exception {
1871118711
testInstanceString("", "console");
1871218712
}
18713+
18714+
/**
18715+
* @throws Exception if the test fails
18716+
*/
18717+
@Test
18718+
@Alerts(CHROME = "Collator(),DateTimeFormat(),DisplayNames(),DurationFormat(),getCanonicalLocales(),ListFormat(),"
18719+
+ "Locale(),NumberFormat(),PluralRules(),RelativeTimeFormat(),Segmenter(),supportedValuesOf(),"
18720+
+ "v8BreakIterator()",
18721+
EDGE = "Collator(),DateTimeFormat(),DisplayNames(),DurationFormat(),getCanonicalLocales(),ListFormat(),"
18722+
+ "Locale(),NumberFormat(),PluralRules(),RelativeTimeFormat(),Segmenter(),supportedValuesOf(),"
18723+
+ "v8BreakIterator()",
18724+
FF = "Collator(),DateTimeFormat(),DisplayNames(),DurationFormat(),getCanonicalLocales(),ListFormat(),"
18725+
+ "Locale(),NumberFormat(),PluralRules(),RelativeTimeFormat(),Segmenter(),"
18726+
+ "supportedValuesOf()",
18727+
FF_ESR = "Collator(),DateTimeFormat(),DisplayNames(),DurationFormat(),getCanonicalLocales(),ListFormat(),"
18728+
+ "Locale(),NumberFormat(),PluralRules(),RelativeTimeFormat(),Segmenter(),"
18729+
+ "supportedValuesOf()")
18730+
@HtmlUnitNYI(
18731+
CHROME = "Collator(),DateTimeFormat(),getCanonicalLocales(),Locale(),NumberFormat(),v8BreakIterator()",
18732+
EDGE = "Collator(),DateTimeFormat(),getCanonicalLocales(),Locale(),NumberFormat(),v8BreakIterator()",
18733+
FF = "Collator(),DateTimeFormat(),getCanonicalLocales(),Locale(),NumberFormat()",
18734+
FF_ESR = "Collator(),DateTimeFormat(),getCanonicalLocales(),Locale(),NumberFormat()")
18735+
public void intl() throws Exception {
18736+
testString("", "Intl", false);
18737+
}
18738+
18739+
/**
18740+
* @throws Exception if the test fails
18741+
*/
18742+
@Test
18743+
@Alerts(CHROME = "compare[GC],constructor(),resolvedOptions()",
18744+
EDGE = "compare[GC],constructor(),resolvedOptions()",
18745+
FF = "compare[GC],constructor(),resolvedOptions()",
18746+
FF_ESR = "compare[GC],constructor(),resolvedOptions()")
18747+
@HtmlUnitNYI(
18748+
CHROME = "constructor()",
18749+
EDGE = "constructor()",
18750+
FF = "constructor()",
18751+
FF_ESR = "constructor()")
18752+
public void intl_Collator() throws Exception {
18753+
testString("", "new Intl.Collator('de')");
18754+
}
18755+
18756+
/**
18757+
* @throws Exception if the test fails
18758+
*/
18759+
@Test
18760+
@Alerts(CHROME = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18761+
EDGE = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18762+
FF = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18763+
FF_ESR = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()")
18764+
@HtmlUnitNYI(
18765+
CHROME = "constructor(),format(),resolvedOptions()",
18766+
EDGE = "constructor(),format(),resolvedOptions()",
18767+
FF = "constructor(),format(),resolvedOptions()",
18768+
FF_ESR = "constructor(),format(),resolvedOptions()")
18769+
public void intl_DateTimeFormat() throws Exception {
18770+
testString("", "new Intl.DateTimeFormat('en-US')");
18771+
}
18772+
18773+
/**
18774+
* @throws Exception if the test fails
18775+
*/
18776+
@Test
18777+
@Alerts(CHROME = "baseName[GC],calendar[GC],caseFirst[GC],collation[GC],constructor(),firstDayOfWeek[GC],"
18778+
+ "getCalendars(),getCollations(),getHourCycles(),getNumberingSystems(),getTextInfo(),"
18779+
+ "getTimeZones(),getWeekInfo(),hourCycle[GC],language[GC],maximize(),minimize(),"
18780+
+ "numberingSystem[GC],numeric[GC],region[GC],script[GC],"
18781+
+ "toString()",
18782+
EDGE = "baseName[GC],calendar[GC],caseFirst[GC],collation[GC],constructor(),firstDayOfWeek[GC],"
18783+
+ "getCalendars(),getCollations(),getHourCycles(),getNumberingSystems(),getTextInfo(),"
18784+
+ "getTimeZones(),getWeekInfo(),hourCycle[GC],language[GC],maximize(),minimize(),"
18785+
+ "numberingSystem[GC],numeric[GC],region[GC],script[GC],"
18786+
+ "toString()",
18787+
FF = "baseName[GC],calendar[GC],caseFirst[GC],collation[GC],constructor(),hourCycle[GC],language[GC],"
18788+
+ "maximize(),minimize(),numberingSystem[GC],numeric[GC],region[GC],script[GC],toString(),"
18789+
+ "variants[GC]",
18790+
FF_ESR = "baseName[GC],calendar[GC],caseFirst[GC],collation[GC],constructor(),hourCycle[GC],language[GC],"
18791+
+ "maximize(),minimize(),numberingSystem[GC],numeric[GC],region[GC],script[GC],"
18792+
+ "toString()")
18793+
@HtmlUnitNYI(
18794+
CHROME = "baseName[GCE],calendar[GCE],caseFirst[GCE],collation[GCE],constructor(),hourCycle[GCE],"
18795+
+ "language[GCE],maximize(),minimize(),numberingSystem[GCE],numeric[GCE],region[GCE],"
18796+
+ "script[GCE],toString()",
18797+
EDGE = "baseName[GCE],calendar[GCE],caseFirst[GCE],collation[GCE],constructor(),hourCycle[GCE],"
18798+
+ "language[GCE],maximize(),minimize(),numberingSystem[GCE],numeric[GCE],region[GCE],"
18799+
+ "script[GCE],toString()",
18800+
FF = "baseName[GCE],calendar[GCE],caseFirst[GCE],collation[GCE],constructor(),hourCycle[GCE],"
18801+
+ "language[GCE],maximize(),minimize(),numberingSystem[GCE],numeric[GCE],region[GCE],"
18802+
+ "script[GCE],toString()",
18803+
FF_ESR = "baseName[GCE],calendar[GCE],caseFirst[GCE],collation[GCE],constructor(),hourCycle[GCE],"
18804+
+ "language[GCE],maximize(),minimize(),numberingSystem[GCE],numeric[GCE],region[GCE],"
18805+
+ "script[GCE],toString()")
18806+
public void intl_Locale() throws Exception {
18807+
testString("", "new Intl.Locale('de')");
18808+
}
18809+
18810+
/**
18811+
* @throws Exception if the test fails
18812+
*/
18813+
@Test
18814+
@Alerts(CHROME = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18815+
EDGE = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18816+
FF = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()",
18817+
FF_ESR = "constructor(),format[GC],formatRange(),formatRangeToParts(),formatToParts(),resolvedOptions()")
18818+
@HtmlUnitNYI(
18819+
CHROME = "constructor(),format(),resolvedOptions()",
18820+
EDGE = "constructor(),format(),resolvedOptions()",
18821+
FF = "constructor(),format(),resolvedOptions()",
18822+
FF_ESR = "constructor(),format(),resolvedOptions()")
18823+
public void intl_NumberFormat() throws Exception {
18824+
testString("", "new Intl.NumberFormat('de-DE')");
18825+
}
1871318826
}

src/test/java/org/htmlunit/general/ElementOwnPropertySymbolsTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3500,6 +3500,18 @@ public void intl_DateTimeFormat() throws Exception {
35003500
testString("", "new Intl.DateTimeFormat('en-US')");
35013501
}
35023502

3503+
/**
3504+
* @throws Exception if the test fails
3505+
*/
3506+
@Test
3507+
@Alerts(CHROME = "Symbol(Symbol.toStringTag) [C] [Intl.Locale]",
3508+
EDGE = "Symbol(Symbol.toStringTag) [C] [Intl.Locale]",
3509+
FF = "Symbol(Symbol.toStringTag) [C] [Intl.Locale]",
3510+
FF_ESR = "Symbol(Symbol.toStringTag) [C] [Intl.Locale]")
3511+
public void intl_Locale() throws Exception {
3512+
testString("", "new Intl.Locale('de')");
3513+
}
3514+
35033515
/**
35043516
* @throws Exception if the test fails
35053517
*/

src/test/java/org/htmlunit/general/ElementPropertiesTest.java

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9777,4 +9777,66 @@ public void notification() throws Exception {
97779777
public void console() throws Exception {
97789778
testString("", "console");
97799779
}
9780+
9781+
/**
9782+
* @throws Exception if the test fails
9783+
*/
9784+
@Test
9785+
@Alerts("-")
9786+
public void intl() throws Exception {
9787+
testString("", "Intl");
9788+
}
9789+
9790+
/**
9791+
* @throws Exception if the test fails
9792+
*/
9793+
@Test
9794+
@Alerts("-")
9795+
public void intl_Collator() throws Exception {
9796+
testString("", "new Intl.Collator('de')");
9797+
}
9798+
9799+
/**
9800+
* @throws Exception if the test fails
9801+
*/
9802+
@Test
9803+
@Alerts("-")
9804+
@HtmlUnitNYI(CHROME = "format(),resolvedOptions()",
9805+
EDGE = "format(),resolvedOptions()",
9806+
FF = "format(),resolvedOptions()",
9807+
FF_ESR = "format(),resolvedOptions()")
9808+
public void intl_DateTimeFormat() throws Exception {
9809+
testString("", "new Intl.DateTimeFormat('en-US')");
9810+
}
9811+
9812+
/**
9813+
* @throws Exception if the test fails
9814+
*/
9815+
@Test
9816+
@Alerts("-")
9817+
@HtmlUnitNYI(
9818+
CHROME = "baseName,calendar,caseFirst,collation,hourCycle,language,maximize(),minimize(),"
9819+
+ "numberingSystem,numeric,region,script,toString()",
9820+
EDGE = "baseName,calendar,caseFirst,collation,hourCycle,language,maximize(),minimize(),"
9821+
+ "numberingSystem,numeric,region,script,toString()",
9822+
FF = "baseName,calendar,caseFirst,collation,hourCycle,language,maximize(),minimize(),"
9823+
+ "numberingSystem,numeric,region,script,toString()",
9824+
FF_ESR = "baseName,calendar,caseFirst,collation,hourCycle,language,maximize(),minimize(),"
9825+
+ "numberingSystem,numeric,region,script,toString()")
9826+
public void intl_Locale() throws Exception {
9827+
testString("", "new Intl.Locale('de')");
9828+
}
9829+
9830+
/**
9831+
* @throws Exception if the test fails
9832+
*/
9833+
@Test
9834+
@Alerts("-")
9835+
@HtmlUnitNYI(CHROME = "format(),resolvedOptions()",
9836+
EDGE = "format(),resolvedOptions()",
9837+
FF = "format(),resolvedOptions()",
9838+
FF_ESR = "format(),resolvedOptions()")
9839+
public void intl_NumberFormat() throws Exception {
9840+
testString("", "new Intl.NumberFormat('de-DE')");
9841+
}
97809842
}

0 commit comments

Comments
 (0)