File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
AngleSharp.Scripting.JavaScript.Tests Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
1
namespace AngleSharp . Scripting . JavaScript . Tests
2
2
{
3
+ using AngleSharp . Dom . Html ;
3
4
using NUnit . Framework ;
4
5
using System ;
5
6
using System . Threading . Tasks ;
@@ -49,21 +50,18 @@ public async Task ExtendingWindowExplicitlyShouldWork()
49
50
Assert . AreEqual ( "bla" , result ) ;
50
51
}
51
52
52
- //TODO - enable if bug fixed / feature implemented in AngleSharp itself
53
- //[Test]
53
+ [ Test ]
54
54
public async Task SetContentOfIFrameElement ( )
55
55
{
56
56
var cfg = Configuration . Default . WithJavaScript ( ) ;
57
- var html = @"<!doctype html><iframe id=myframe></iframe><script>
57
+ var html = @"<!doctype html><iframe id=myframe srcdoc='' ></iframe><script>
58
58
var iframe = document.querySelector('#myframe');
59
59
var doc = iframe.contentWindow.document;
60
- doc.open();
61
- doc.write('<html><head><title></title></head><body>Hello world.</body></html>');
62
- doc.close();
60
+ doc.body.textContent = 'Hello world.';
63
61
</script>" ;
64
62
var document = await BrowsingContext . New ( cfg ) . OpenAsync ( m => m . Content ( html ) ) ;
65
- var result = document . GetElementById ( "myframe" ) ;
66
- Assert . AreEqual ( "Hello World ." , result ) ;
63
+ var result = document . GetElementById ( "myframe" ) as IHtmlInlineFrameElement ;
64
+ Assert . AreEqual ( "Hello world ." , result . ContentDocument . Body . TextContent ) ;
67
65
}
68
66
}
69
67
}
You can’t perform that action at this time.
0 commit comments