Commit 377c5eb4 authored by Henrik Skupin's avatar Henrik Skupin
Browse files

Bug 1776190 - [marionette] Allow a modifier key to be reset when sending it...

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
parent 4d5c49af
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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

Empty file added.

+24 −0
Original line number Diff line number Diff line
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"