Skip to content

Commit

Permalink
#7: Final cleanup in ScriptExecutor.
Browse files Browse the repository at this point in the history
  • Loading branch information
RusKnyaz committed Sep 6, 2019
1 parent 3d2ecea commit 8cc0700
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions source/Knyaz.Optimus.Tests/ScriptExecuting/ScriptExecutorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ public void AddEventListenerWithOptions()
add.Item3.Passive == true);
}

[Test]
public void AddEventListenerWithOptions()
{
Tuple<string, Action<Event>, EventListenerOptions> argsAdd = null;

var window = Mock.Of<IWindowEx>();
Mock.Get(window).Setup(x => x.AddEventListener(It.IsAny<string>(), It.IsAny<Action<Event>>(), It.IsAny<EventListenerOptions>()))
.Callback<string, Action<Event>, EventListenerOptions>((a1, a2, a3) =>
{
argsAdd = new Tuple<string, Action<Event>, EventListenerOptions>(a1,a2,a3);
});

Execute(window,
@"var listener = function(){console.log('ok');};
addEventListener('click', listener, {capture:true, passive:true});
");

argsAdd.Assert(add =>
add.Item1 == "click" &&
add.Item3.Capture == true &&
add.Item3.Passive == true);
}

[Test]
public void AddEventListenerAndRemoveEventListener()
{
Expand Down

0 comments on commit 8cc0700

Please sign in to comment.