Skip to content

Commit 70a284d

Browse files
committed
Provide test for working jQuery 1 closes #16
1 parent dd5bfb9 commit 70a284d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

AngleSharp.Scripting.JavaScript.Tests/JqueryTests.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@
1010
[TestFixture]
1111
public class JqueryTests
1212
{
13-
public static async Task<String> EvaluateScriptWithJqueryAsync(params String[] sources)
13+
public static Task<String> EvaluateScriptWithJqueryAsync(params String[] sources)
1414
{
1515
var list = new List<String>(sources);
1616
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>";
1924
var html = "<!doctype html><div id=result></div>" + scripts;
2025
var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(html));
2126
return document.GetElementById("result").InnerHtml;
@@ -84,5 +89,12 @@ public async Task JqueryWithAjaxToDelayedResponse()
8489
await result.AwaitEvent("xhrdone").ConfigureAwait(false);
8590
Assert.AreEqual(message, result.TextContent);
8691
}
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+
}
8799
}
88100
}

0 commit comments

Comments
 (0)