Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/capybara/rack_test/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ def link?
end

def submits?
return false if disabled?
(tag_name == 'input' && %w[submit image].include?(type)) || (tag_name == 'button' && [nil, 'submit'].include?(type))
end

Expand Down
5 changes: 4 additions & 1 deletion lib/capybara/spec/views/form.erb
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ New line after and before textarea tag
role=button within label element
<span role="button">with other text</span>
</label>
<input type="button" disabled="disabled" value="Disabled button"/>
<span role="button">ARIA button</span>
</p>

Expand Down Expand Up @@ -742,3 +741,7 @@ New line after and before textarea tag
<div>Visual representation of the checkbox</div>
</div>
</label>

<form action="/other_form" method="post">
<input type="submit" disabled="disabled" value="Disabled button"/>
</form>
6 changes: 6 additions & 0 deletions spec/rack_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ module TestSessions
expect(session).not_to have_current_path(/foo|bar/)
end
end

it 'does not click disabled inputs or buttons' do
session.visit('/form')
session.find(:css, 'input[value="Disabled button"]').click
expect(session).to have_current_path('/form')
end
end

describe '#send_keys' do
Expand Down