Examples of onJavaScriptEvent()


Examples of org.waveprotocol.wave.client.editor.EditorImpl.onJavaScriptEvent()

    EditorImpl editor = createEditor(bindings);

    // 103 = g, this event = CTRL_G which is bound to ORDER_G by the EventWrapper
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action not called on registered keypress", callTracker, 1);
  }

  /** Ensure that when other keys are pressed, they are not passed to the action. */
  public void testAlternativeKeyPress() {
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.EditorImpl.onJavaScriptEvent()

    EditorImpl editor = createEditor(bindings);

    // This event is not ORDER_G, it has other accelerators thrown in.
    Event rawEvent = Document.get().createKeyPressEvent(
        true, true, true, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action called on unregistered keypress", callTracker, 0);
  }

  /**
   * Ensure that new keybindings are used after changing them in the editor.
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.EditorImpl.onJavaScriptEvent()

    bindings.registerAction(KeyCombo.ORDER_G, testAction);

    EditorImpl editor = createEditor(bindings);
    Event rawEvent = Document.get().createKeyPressEvent(
        true, false, false, false, G_CODE, G_CODE).cast();
    editor.onJavaScriptEvent("keypress", rawEvent);
    // callTracker should be 1 assuming the test above passes

    bindings.removeAction(KeyCombo.ORDER_G);
    initEditor(editor, Editor.ROOT_REGISTRIES, bindings);
    editor.onJavaScriptEvent("keypress", rawEvent);
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.EditorImpl.onJavaScriptEvent()

    editor.onJavaScriptEvent("keypress", rawEvent);
    // callTracker should be 1 assuming the test above passes

    bindings.removeAction(KeyCombo.ORDER_G);
    initEditor(editor, Editor.ROOT_REGISTRIES, bindings);
    editor.onJavaScriptEvent("keypress", rawEvent);
    assertEquals("Callback action called on deregistered keypress", callTracker, 1);
  }

  /** Util to help construct an editor instance. */
  private EditorImpl createEditor(KeyBindingRegistry keyBinding) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.