Skip to content

Commit 6b24a1a

Browse files
committed
Enabled test for iframe content #4
1 parent b96d7e2 commit 6b24a1a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

AngleSharp.Scripting.JavaScript.Tests/ScriptEvalTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace AngleSharp.Scripting.JavaScript.Tests
22
{
3+
using AngleSharp.Dom.Html;
34
using NUnit.Framework;
45
using System;
56
using System.Threading.Tasks;
@@ -49,21 +50,18 @@ public async Task ExtendingWindowExplicitlyShouldWork()
4950
Assert.AreEqual("bla", result);
5051
}
5152

52-
//TODO - enable if bug fixed / feature implemented in AngleSharp itself
53-
//[Test]
53+
[Test]
5454
public async Task SetContentOfIFrameElement()
5555
{
5656
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>
5858
var iframe = document.querySelector('#myframe');
5959
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.';
6361
</script>";
6462
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);
6765
}
6866
}
6967
}

0 commit comments

Comments
 (0)