Skip to content

Commit 4041c4d

Browse files
committed
add test case for isse #239, passes
1 parent fd9ef93 commit 4041c4d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,4 +1273,31 @@ public void generatorFunction() throws Exception {
12731273
}
12741274
}
12751275

1276+
/**
1277+
* Test for https://github.com/HtmlUnit/htmlunit/issues/239.
1278+
*
1279+
* @throws Exception if the test fails
1280+
*/
1281+
@Test
1282+
@Alerts({"pt1 = [object Promise]", "pt2 = [object Object]", "true"})
1283+
public void symbolSpecies() throws Exception {
1284+
final String html = DOCTYPE_HTML
1285+
+ "<html><body>"
1286+
+ "<script>\n"
1287+
+ LOG_TITLE_FUNCTION
1288+
+ " var emptyFunc=function() {};\n"
1289+
+ " var p = Promise.resolve(1);\n"
1290+
+ " p.constructor = {};\n"
1291+
+ " var pt1 = p.then(emptyFunc);\n"
1292+
+ " log('pt1 = ' + pt1);\n"
1293+
1294+
+ " var t = function(e) { e(emptyFunc, emptyFunc); };\n"
1295+
+ " p.constructor[Symbol.species] = t;\n"
1296+
+ " var pt2 = p.then(emptyFunc);\n"
1297+
+ " log('pt2 = ' + pt2);\n"
1298+
+ " log(pt2 instanceof t);\n"
1299+
+ "</script></body></html>";
1300+
1301+
loadPageVerifyTitle2(html);
1302+
}
12761303
}

0 commit comments

Comments
 (0)