File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 6
6
- Included new ` WithEventLoop ` configuration extensions
7
7
- Added constructors to ` window ` (#12 )
8
8
- Fixed ` btoa ` and ` atob ` missing (#55 )
9
+ - Included ` javascript: ` URL handler (#47 )
9
10
10
11
# 0.12.1
11
12
Original file line number Diff line number Diff line change 1
1
namespace AngleSharp . Js . Tests
2
2
{
3
3
using AngleSharp . Dom ;
4
+ using AngleSharp . Html . Dom ;
4
5
using AngleSharp . Scripting ;
5
6
using Jint . Runtime ;
6
7
using NUnit . Framework ;
@@ -110,14 +111,25 @@ public async Task RunScriptSnippetDirectlyGetSimpleValueFromCalculation()
110
111
Assert . AreEqual ( 3.0 , result ) ;
111
112
}
112
113
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
+
113
125
[ Test ]
114
126
public async Task SetLocationViaSimpleString_Issue31 ( )
115
127
{
116
128
var html = "<!doctype html><span id=test>Test</span><script>window.location = '/foo';</script>" ;
117
129
var config = Configuration . Default . WithJs ( ) ;
118
130
var context = BrowsingContext . New ( config ) ;
119
131
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 ) ) ;
121
133
}
122
134
123
135
class Person
You can’t perform that action at this time.
0 commit comments