Skip to content

Commit

Permalink
added parent for issue #73
Browse files Browse the repository at this point in the history
  • Loading branch information
lefthandedgoat committed Apr 22, 2013
1 parent d7af3ee commit a811354
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions basictests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ test (fun _ ->
count ".item" 5
2 === (element "span" |> elementsWithin ".item" |> List.length))

"parent of firstItem and secondItem is list" &&&& (fun _ ->
url "http://localhost:4567/parent"
"list" === (element "#firstItem" |> parent).GetAttribute("id"))

context "reddit tests"
once (fun _ -> Console.WriteLine "once: reddit tests")
before (fun _ -> Console.WriteLine "before: reddit tests")
Expand Down
2 changes: 2 additions & 0 deletions canopy/canopy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ let element cssSelector = find cssSelector elementTimeout browser

let elementWithin cssSelector (elem:IWebElement) = find cssSelector elementTimeout elem

let parent (elem:IWebElement) = elem |> elementWithin ".."

let elements cssSelector = findMany cssSelector elementTimeout browser

let elementsWithin cssSelector (elem:IWebElement) = findMany cssSelector elementTimeout elem
Expand Down
4 changes: 4 additions & 0 deletions testpages/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,8 @@

get '/elementWithin' do
erb :elementWithin
end

get '/parent' do
erb :parent
end
16 changes: 16 additions & 0 deletions testpages/views/parent.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>
<head>
<title>canopy testing page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>

<body>

<ul id="list">
<li id="firstItem">item 1</li>
<li id="secondItem">item 2</li>
</ul>

</body>
</html>

2 changes: 1 addition & 1 deletion testpages/views/waitFor.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<title>floak testing page</title>
<title>canopy testing page</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>

Expand Down

0 comments on commit a811354

Please sign in to comment.