Skip to content

Commit

Permalink
working on jquery support
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 17, 2017
1 parent a62b92a commit 193e070
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/jquery.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@ public function with($selector, Closure $callback)
return $this;
}

/**
* Ensure that jQuery is available on the page.
*
* @return void
*/
protected function ensurejQueryIsAvailable()
{
if (is_null($this->driver->executeScript("return window.$"))) {

This comment has been minimized.

Copy link
@renedekat

renedekat Jan 17, 2017

Contributor

Shouldn't that be removed?

dd('here');
$this->driver->executeScript(file_get_contents(__DIR__.'/../bin/jquery.js'));
}
}

/**
* Pause for the given amount of milliseconds.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Concerns/InteractsWithElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function click($selector)
*/
public function clickLink($link)
{
$this->ensurejQueryIsAvailable();

$selector = trim($this->resolver->format("a:contains('{$link}')"));

$this->driver->executeScript("$(\"{$selector}\")[0].click();");
Expand Down
2 changes: 2 additions & 0 deletions src/Concerns/MakesAssertions.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ public function assertDontSeeLink($link)
*/
public function seeLink($link)
{
$this->ensurejQueryIsAvailable();

$selector = trim($this->resolver->format("a:contains('{$link}')"));

$script = <<<JS
Expand Down

0 comments on commit 193e070

Please sign in to comment.