From d2f0dab01ccee045c5b41aeedac1af008c483ee8 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Mon, 16 Apr 2018 15:19:40 -0700 Subject: [PATCH] Add tests to make sure window events bubble up --- Tests/WindowTests.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Tests/WindowTests.cs b/Tests/WindowTests.cs index 2da4624..e04f627 100644 --- a/Tests/WindowTests.cs +++ b/Tests/WindowTests.cs @@ -89,5 +89,31 @@ namespace Tests b.Document.Body.Call ("foo"); Assert.IsTrue (received); } + + [TestMethod] + public void ParentElementGetsWindowMessages () + { + var b = new Button (); + var d = new Div (b); + var received = false; + d.MessageSent += m => { + received = m.TargetId == "window"; + }; + b.Document.Window.Location = "http://google.com"; + Assert.IsTrue (received); + } + + [TestMethod] + public void ParentElementGetsBodyMessages () + { + var b = new Button (); + var d = new Div (b); + var received = false; + d.MessageSent += m => { + received = m.TargetId == "document.body"; + }; + b.Document.Body.AppendChild (new Button ()); + Assert.IsTrue (received); + } } }