提交 d5f6b3bc 编写于 作者: M Martin Zikmund

test: Verify ExecuteScriptAsync does not throw

上级 38cfd0f6
......@@ -16,6 +16,7 @@ using Uno.UI.Xaml.Controls;
#if __IOS__
using UIKit;
using _View = UIKit.UIView;
using FluentAssertions;
#endif
namespace Uno.UI.RuntimeTests.Tests.Microsoft_UI_Xaml_Controls;
......@@ -116,6 +117,31 @@ public class Given_WebView2
}
#endif
[TestMethod]
public async Task When_ExecuteScriptAsync_Has_No_Result()
{
async Task Do()
{
var border = new Border();
var webView = new WebView2();
webView.Width = 200;
webView.Height = 200;
border.Child = webView;
TestServices.WindowHelper.WindowContent = border;
bool navigated = false;
await TestServices.WindowHelper.WaitForLoaded(border);
await webView.EnsureCoreWebView2Async();
webView.NavigationCompleted += (sender, e) => navigated = true;
webView.NavigateToString("<html><body><script>function testMe(){ }</script><div id='test' style='width: 100px; height: 100px; background-color: blue;' /></body></html>");
await TestServices.WindowHelper.WaitFor(() => navigated);
Func<Task> act = async () => await webView.ExecuteScriptAsync("testMe()");
await act.Should().NotThrowAsync();
}
await TestHelper.RetryAssert(Do, 3);
}
#if !__IOS__ // Temporarily disabled due to #11997
[TestMethod]
public async Task When_ExecuteScriptAsync()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册