File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66- Included new ` WithEventLoop ` configuration extensions
77- Added constructors to ` window ` (#12 )
88- Fixed ` btoa ` and ` atob ` missing (#55 )
9+ - Included ` javascript: ` URL handler (#47 )
910
1011# 0.12.1
1112
Original file line number Diff line number Diff line change 11namespace AngleSharp . Js . Tests
22{
33 using AngleSharp . Dom ;
4+ using AngleSharp . Html . Dom ;
45 using AngleSharp . Scripting ;
56 using Jint . Runtime ;
67 using NUnit . Framework ;
@@ -110,14 +111,25 @@ public async Task RunScriptSnippetDirectlyGetSimpleValueFromCalculation()
110111 Assert . AreEqual ( 3.0 , result ) ;
111112 }
112113
114+ [ Test ]
115+ public async Task RunScriptAtPressingLink_Issue47 ( )
116+ {
117+ var html = "<!doctype html><pre id=test></pre><a href=\" javascript:document.querySelector('#test').textContent='success';\" >Test</a>" ;
118+ var config = Configuration . Default . WithJs ( ) ;
119+ var document = await BrowsingContext . New ( config ) . OpenAsync ( m => m . Content ( html ) ) ;
120+ var otherDocument = await document . QuerySelector < IHtmlAnchorElement > ( "a" ) . NavigateAsync ( ) ;
121+ Assert . AreEqual ( document , otherDocument ) ;
122+ Assert . AreEqual ( "success" , document . QuerySelector ( "#test" ) . TextContent ) ;
123+ }
124+
113125 [ Test ]
114126 public async Task SetLocationViaSimpleString_Issue31 ( )
115127 {
116128 var html = "<!doctype html><span id=test>Test</span><script>window.location = '/foo';</script>" ;
117129 var config = Configuration . Default . WithJs ( ) ;
118130 var context = BrowsingContext . New ( config ) ;
119131 await context . OpenAsync ( m => m . Content ( html ) . Address ( "http://example.com" ) )
120- . Then ( _ => Assert . AreEqual ( "foo" , context . Active . Location . Href ) ) ;
132+ . Then ( _ => Assert . AreEqual ( "http://example.com/ foo" , context . Active . Location . Href ) ) ;
121133 }
122134
123135 class Person
You can’t perform that action at this time.
0 commit comments