File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
AngleSharp.Scripting.JavaScript.Tests Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 10
10
[ TestFixture ]
11
11
public class JqueryTests
12
12
{
13
- public static async Task < String > EvaluateScriptWithJqueryAsync ( params String [ ] sources )
13
+ public static Task < String > EvaluateScriptWithJqueryAsync ( params String [ ] sources )
14
14
{
15
15
var list = new List < String > ( sources ) ;
16
16
list . Insert ( 0 , Sources . Jquery ) ;
17
- var cfg = Configuration . Default . WithDefaultLoader ( setup => setup . IsResourceLoadingEnabled = true ) . WithJavaScript ( ) ;
18
- var scripts = "<script>" + String . Join ( "</script><script>" , list ) + "</script>" ;
17
+ return EvaluateScriptsAsync ( list ) ;
18
+ }
19
+
20
+ public static async Task < String > EvaluateScriptsAsync ( List < String > sources )
21
+ {
22
+ var cfg = Configuration . Default . WithDefaultLoader ( setup => setup . IsResourceLoadingEnabled = true ) . WithJavaScript ( ) . WithCss ( ) ;
23
+ var scripts = "<script>" + String . Join ( "</script><script>" , sources ) + "</script>" ;
19
24
var html = "<!doctype html><div id=result></div>" + scripts ;
20
25
var document = await BrowsingContext . New ( cfg ) . OpenAsync ( m => m . Content ( html ) ) ;
21
26
return document . GetElementById ( "result" ) . InnerHtml ;
@@ -84,5 +89,12 @@ public async Task JqueryWithAjaxToDelayedResponse()
84
89
await result . AwaitEvent ( "xhrdone" ) . ConfigureAwait ( false ) ;
85
90
Assert . AreEqual ( message , result . TextContent ) ;
86
91
}
92
+
93
+ [ Test ]
94
+ public async Task JqueryVersionOne ( )
95
+ {
96
+ var result = await EvaluateScriptsAsync ( new List < String > { Sources . Jquery1 , SetResult ( "$.toString()" ) } ) ;
97
+ Assert . AreNotEqual ( "" , result ) ;
98
+ }
87
99
}
88
100
}
You can’t perform that action at this time.
0 commit comments