Skip to content

Commit

Permalink
resolve #13
Browse files Browse the repository at this point in the history
  • Loading branch information
gravity-api committed Mar 14, 2020
1 parent eee6be6 commit c2f0d4c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ public void ScriptElementPositive()
// assert
Assert.IsTrue(true);
}

[DataTestMethod]
[DataRow("window.open('about:blank', '_blank');")]
public void NewTab(string script)
{
// setup
var driver = new MockWebDriver();
var expected = driver.WindowHandles.Count + 1;

// execute
driver.ExecuteScript(script);

// assert
Assert.AreEqual(expected, actual: driver.WindowHandles.Count);
}
}
}
#pragma warning restore S4144
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,20 @@ private string SrcGetScroll(string script, object[] args)
// result
return script.Contains("scrollLeft") ? x : y;
}

[Description(@"^window.open\('about:blank', '_blank'\);$")]
private string SrcBlankPage(string script)
{
// setup
var list = WindowHandles.ToList();

// append
list.Add($"window-{Guid.NewGuid()}");
WindowHandles = new ReadOnlyCollection<string>(list);

// result
return script;
}
#pragma warning restore

// UTILITIES
Expand Down

0 comments on commit c2f0d4c

Please sign in to comment.