зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1776190 - [marionette] Allow a modifier key to be reset when sending it again within the same command. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D175242
This commit is contained in:
Родитель
4d5c49af5b
Коммит
377c5eb43a
|
@ -262,7 +262,12 @@ event.sendKeys = function(keyString, win) {
|
|||
const data = lazy.keyData.getData(keyValue);
|
||||
const key = { ...data, ...modifiers };
|
||||
if (data.modifier) {
|
||||
modifiers[data.modifier] = true;
|
||||
// Negating the state of the modifier here is not spec compliant but
|
||||
// makes us compatible to Chrome's behavior for now. That's fine unless
|
||||
// we know the correct behavior.
|
||||
//
|
||||
// @see: https://github.com/w3c/webdriver/issues/1734
|
||||
modifiers[data.modifier] = !modifiers[data.modifier];
|
||||
}
|
||||
event.sendSingleKey(key, win);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
from tests.support.asserts import assert_success
|
||||
from tests.support.keys import Keys
|
||||
|
||||
|
||||
def element_send_keys(session, element, text):
|
||||
return session.transport.send(
|
||||
"POST",
|
||||
"/session/{session_id}/element/{element_id}/value".format(
|
||||
session_id=session.session_id, element_id=element.id
|
||||
),
|
||||
{"text": text},
|
||||
)
|
||||
|
||||
|
||||
def test_modifier_key_toggles(session, inline, modifier_key):
|
||||
session.url = inline("<input type=text value=foo>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
response = element_send_keys(
|
||||
session, element, f"{modifier_key}a{modifier_key}{Keys.DELETE}cheese"
|
||||
)
|
||||
assert_success(response)
|
||||
|
||||
assert element.property("value") == "cheese"
|
Загрузка…
Ссылка в новой задаче