Fix issue with switching to the same frame twice in a row
This commit is contained in:
parent
fd63a7eec3
commit
702bce9ce9
|
@ -83,7 +83,7 @@ module Capybara::Webkit
|
|||
|
||||
def frame_focus(selector=nil)
|
||||
if selector.respond_to?(:base)
|
||||
selector.base.invoke('focus')
|
||||
selector.base.invoke("focus_frame")
|
||||
elsif selector.is_a? Fixnum
|
||||
command("FrameFocus", "", selector.to_s)
|
||||
elsif selector
|
||||
|
|
|
@ -325,6 +325,16 @@ describe Capybara::Session do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "can swap to the same frame multiple times" do
|
||||
subject.visit("/")
|
||||
subject.within_frame("a_frame") do
|
||||
expect(subject).to have_content("Page A")
|
||||
end
|
||||
subject.within_frame("a_frame") do
|
||||
expect(subject).to have_content("Page A")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'click tests' do
|
||||
|
|
|
@ -11,7 +11,7 @@ void Node::start() {
|
|||
QString functionName = functionArguments.takeFirst();
|
||||
QString allowUnattached = functionArguments.takeFirst();
|
||||
InvocationResult result = page()->invokeCapybaraFunction(functionName, allowUnattached == "true", functionArguments);
|
||||
if (functionName == "focus") {
|
||||
if (functionName == "focus_frame") {
|
||||
page()->setCurrentFrameParent(page()->currentFrame()->parentFrame());
|
||||
}
|
||||
finish(&result);
|
||||
|
|
|
@ -357,6 +357,14 @@ Capybara = {
|
|||
this.getNode(index).focus();
|
||||
},
|
||||
|
||||
focus_frame: function(index) {
|
||||
var elem = this.getNode(index);
|
||||
if (elem === document.activeElement) {
|
||||
elem.blur();
|
||||
}
|
||||
elem.focus();
|
||||
},
|
||||
|
||||
selectOption: function(index) {
|
||||
var optionNode = this.getNode(index);
|
||||
var selectNode = optionNode.parentNode;
|
||||
|
|
Loading…
Reference in New Issue