Skip to content

Commit fc456b1

Browse files
committed
matchall test case added
1 parent 414c672 commit fc456b1

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/changes/changes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88

99
<body>
1010
<release version="4.7.0" date="November xx, 2024" description="Bugfixes, Chrome/Edge 131">
11+
<action type="add" dev="RhinoTeam">
12+
core-js: String.prototype.matchAll, Symbol.matchAll, and RegExp.prototype[Symbol.matchAll] added.
13+
</action>
14+
<action type="fix" dev="rbri">
15+
neko: BOM header detection fixed
16+
</action>
17+
<action type="update" dev="rbri">
18+
neko: bunch of micro optimizations
19+
</action>
1120
<action type="add" dev="rbri">
1221
Property navigator pdfViewerEnabled added.
1322
</action>

src/test/java/org/htmlunit/javascript/JavaScriptEngine2Test.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,4 +1175,37 @@ public void ensureOrder() throws Exception {
11751175
Thread.sleep(DEFAULT_WAIT_TIME);
11761176
verifyTitle2(driver, getExpectedAlerts());
11771177
}
1178+
1179+
/**
1180+
* @throws Exception if the test fails
1181+
*/
1182+
@Test
1183+
@Alerts({"false", "aa", "0", "aabbc", "false", "bb", "2", "aabbc", "true", "undefined"})
1184+
public void matchAll() throws Exception {
1185+
final String html = "<html><body>"
1186+
+ "<script>\n"
1187+
+ LOG_TITLE_FUNCTION
1188+
+ "const s = 'aabbc';\n"
1189+
+ "const re = /([a-z])\\1/g;\n"
1190+
+ "const matches = s.matchAll(re);\n"
1191+
1192+
+ "var match = matches.next();\n"
1193+
+ "log(match.done);\n"
1194+
+ "log(match.value[0]);\n"
1195+
+ "log(match.value.index);\n"
1196+
+ "log(match.value.input);\n"
1197+
1198+
+ "match = matches.next();\n"
1199+
+ "log(match.done);\n"
1200+
+ "log(match.value[0]);\n"
1201+
+ "log(match.value.index);\n"
1202+
+ "log(match.value.input);\n"
1203+
1204+
+ "match = matches.next();\n"
1205+
+ "log(match.done);\n"
1206+
+ "log(match.value);\n"
1207+
+ "</script></body></html>";
1208+
1209+
loadPageVerifyTitle2(html);
1210+
}
11781211
}

0 commit comments

Comments
 (0)