@@ -1320,6 +1320,146 @@ public void SciterAPIHost_Completed_GlobalPredefinedVariables () {
13201320 Assert . True ( falseValue ) ;
13211321 }
13221322
1323+ [ Fact , Trait ( "Category" , "Integration" ) ]
1324+ public void SciterAPIHost_Completed_NodeNextSibling ( ) {
1325+ //Arrange
1326+ var host = new SciterAPIHost ( "" ) ;
1327+
1328+ host . CreateMainWindow ( ) ;
1329+ host . LoadHtml (
1330+ """
1331+ <html>
1332+ <body>
1333+ <div>Sibling 1</div><div id="middlesibling">Sibling 2</div><div>Sibling 3</div>
1334+ </body>
1335+ </html>
1336+ """
1337+ ) ;
1338+ var html = "" ;
1339+ host . AddWindowEventHandler (
1340+ new DocumentReadyHandler (
1341+ ( ) => {
1342+ var spanElement = host . MakeCssSelector ( "#middlesibling" ) . First ( ) ;
1343+ var nextSibling = host . NodeNextSibling ( spanElement ) ;
1344+ html = host . GetElementHtml ( nextSibling , false ) ;
1345+ host . CloseWindow ( host . MainWindow ) ;
1346+ } ,
1347+ host
1348+ )
1349+ ) ;
1350+
1351+ //Act
1352+ host . Process ( ) ;
1353+
1354+ //Assert
1355+ Assert . Equal ( "Sibling 3" , html ) ;
1356+ }
1357+
1358+ [ Fact , Trait ( "Category" , "Integration" ) ]
1359+ public void SciterAPIHost_Completed_NodePreviousSibling ( ) {
1360+ //Arrange
1361+ var host = new SciterAPIHost ( "" ) ;
1362+
1363+ host . CreateMainWindow ( ) ;
1364+ host . LoadHtml (
1365+ """
1366+ <html>
1367+ <body>
1368+ <div>Sibling 1</div><div id="middlesibling">Sibling 2</div><div>Sibling 3</div>
1369+ </body>
1370+ </html>
1371+ """
1372+ ) ;
1373+ var html = "" ;
1374+ host . AddWindowEventHandler (
1375+ new DocumentReadyHandler (
1376+ ( ) => {
1377+ var spanElement = host . MakeCssSelector ( "#middlesibling" ) . First ( ) ;
1378+ var nextSibling = host . NodePreviousSibling ( spanElement ) ;
1379+ html = host . GetElementHtml ( nextSibling , false ) ;
1380+ host . CloseWindow ( host . MainWindow ) ;
1381+ } ,
1382+ host
1383+ )
1384+ ) ;
1385+
1386+ //Act
1387+ host . Process ( ) ;
1388+
1389+ //Assert
1390+ Assert . Equal ( "Sibling 1" , html ) ;
1391+ }
1392+
1393+ [ Fact , Trait ( "Category" , "Integration" ) ]
1394+ public void SciterAPIHost_Completed_NodeFirstChild ( ) {
1395+ //Arrange
1396+ var host = new SciterAPIHost ( "" ) ;
1397+
1398+ host . CreateMainWindow ( ) ;
1399+ host . LoadHtml (
1400+ """
1401+ <html>
1402+ <body>
1403+ <div id="container"><div>Sibling 1</div><div>Sibling 2</div><div>Sibling 3</div></div>
1404+ </body>
1405+ </html>
1406+ """
1407+ ) ;
1408+ var html = "" ;
1409+ host . AddWindowEventHandler (
1410+ new DocumentReadyHandler (
1411+ ( ) => {
1412+ var spanElement = host . MakeCssSelector ( "#container" ) . First ( ) ;
1413+ var firstChild = host . NodeFirstChild ( spanElement ) ;
1414+ html = host . GetElementText ( firstChild ) ;
1415+ host . CloseWindow ( host . MainWindow ) ;
1416+ } ,
1417+ host
1418+ )
1419+ ) ;
1420+
1421+ //Act
1422+ host . Process ( ) ;
1423+
1424+ //Assert
1425+ Assert . Equal ( "Sibling 1" , html ) ;
1426+ }
1427+
1428+ [ Fact , Trait ( "Category" , "Integration" ) ]
1429+ public void SciterAPIHost_Completed_NodeLastChild ( ) {
1430+ //Arrange
1431+ var host = new SciterAPIHost ( "" ) ;
1432+
1433+ host . CreateMainWindow ( ) ;
1434+ host . LoadHtml (
1435+ """
1436+ <html>
1437+ <body>
1438+ <div id="container"><div>Sibling 1</div><div>Sibling 2</div><div>Sibling 3</div></div>
1439+ </body>
1440+ </html>
1441+ """
1442+ ) ;
1443+ var html = "" ;
1444+ host . AddWindowEventHandler (
1445+ new DocumentReadyHandler (
1446+ ( ) => {
1447+ var spanElement = host . MakeCssSelector ( "#container" ) . First ( ) ;
1448+ var lastChild = host . NodeLastChild ( spanElement ) ;
1449+ html = host . GetElementText ( lastChild ) ;
1450+ host . CloseWindow ( host . MainWindow ) ;
1451+ } ,
1452+ host
1453+ )
1454+ ) ;
1455+
1456+ //Act
1457+ host . Process ( ) ;
1458+
1459+ //Assert
1460+ Assert . Equal ( "Sibling 3" , html ) ;
1461+ }
1462+
13231463 }
13241464
13251465 public class DocumentReadyHandler : SciterEventHandler {
0 commit comments