Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/rb2k/capybara-webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-burns committed Jul 18, 2011
2 parents 344b051 + 2ad577f commit 43f0479
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/capybara/driver/webkit/node.rb
Expand Up @@ -53,6 +53,10 @@ def visible?
invoke("visible") == "true"
end

def checked?
self['checked']
end

def disabled?
self['disabled']
end
Expand Down
21 changes: 17 additions & 4 deletions spec/driver_spec.rb
Expand Up @@ -119,6 +119,7 @@
<div id="invisible">Can't see me</div>
</div>
<input type="text" disabled="disabled"/>
<input id="checktest" type="checkbox" checked="checked"/>
<script type="text/javascript">
document.write("<p id='greeting'>he" + "llo</p>");
</script>
Expand Down Expand Up @@ -253,6 +254,10 @@
subject.find("//input").first.should be_disabled
end

it "reads checked property" do
subject.find("//input[@id='checktest']").first.should be_checked
end

it "finds visible elements" do
subject.find("//p").first.should be_visible
subject.find("//*[@id='invisible']").first.should_not be_visible
Expand Down Expand Up @@ -371,28 +376,36 @@
checked_box['checked'].should be_true
end

it "knows a checked box is checked using checked?" do
checked_box.checked?.should be_true
end

it "knows an unchecked box is unchecked" do
unchecked_box['checked'].should_not be_true
end

it "knows an unchecked box is unchecked using checked?" do
unchecked_box.checked?.should be_false
end

it "checks an unchecked box" do
unchecked_box.set(true)
unchecked_box['checked'].should be_true
unchecked_box.checked?.should be_true
end

it "unchecks a checked box" do
checked_box.set(false)
checked_box['checked'].should_not be_true
checked_box.checked?.should_not be_true
end

it "leaves a checked box checked" do
checked_box.set(true)
checked_box['checked'].should be_true
checked_box.checked?.should be_true
end

it "leaves an unchecked box unchecked" do
unchecked_box.set(false)
unchecked_box['checked'].should_not be_true
unchecked_box.checked?.should_not be_true
end

let(:enabled_input) { subject.find("//input[@name='foo']").first }
Expand Down

0 comments on commit 43f0479

Please sign in to comment.