Examples of FakeEditorEvent


Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  /**
   * Ensure that the event handler normalises the selection when necessary
   * Note that this is currently just for firefox.
   */
  public void testNormalisesSelection() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.INPUT, 'a');
    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

   * Firefox specific-
   *
   * Test that typing extractor is notifed of the correct caret location.
   */
  public void testNormalTypingNotifiesExtractor() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.INPUT, 'a');
    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  /**
   * Tests that events handled by listeners exits the EditorEventHandler and
   * does not continue triggering other handler methods.
   */
  public void testEventsHandledByListenerExitsHandler() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.INPUT, 'a');
    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());

    FakeEditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  /**
   * Test that handleLeft/Right are triggered on the correct node.
   */
  public void testHandleLeftRightTriggeredOnNode() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.NAVIGATION, KeyCodes.KEY_LEFT);
    FakeRouter router = new FakeRouter();
    ContentElement fakeContentElement = newElement();
    final Point<ContentNode> caret = Point.<ContentNode> end(fakeContentElement);

    EditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(new FocusedContentRange(caret));
    EditorEventHandler handler = createEditorEventHandler(router, interactor, subHandler);

    router.ctx.call(FakeRouter.HANDLE_LEFT).nOf(1).withArgs(fakeEvent).returns(
        true);
    interactor.call(FakeEditorInteractor.CLEAR_ANNOTATIONS).nOf(1);

    boolean cancel1 = handler.handleEvent(fakeEvent);

    router.ctx.checkExpectations();
    assertEquals(!fakeEvent.shouldAllowBrowserDefault(), cancel1);


    router.ctx.reset();

    FakeEditorEvent fakeEvent2 =
        FakeEditorEvent.create(KeySignalType.NAVIGATION, KeyCodes.KEY_RIGHT);
    router.ctx.call(FakeRouter.HANDLE_RIGHT).nOf(1).withArgs(fakeEvent2)
        .returns(true);
    boolean cancel2 = handler.handleEvent(fakeEvent2);

View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

    assertEquals(!fakeEvent.shouldAllowBrowserDefault(), cancel2);
    router.ctx.checkExpectations();
  }

  public void testDeleteWithRangeSelectedDeletesRange() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.DELETE, KeyCodes.KEY_LEFT);

    //Event event = Document.get().createKeyPressEvent(
    //    false, false, false, false, KeyCodes.KEY_BACKSPACE, 0).cast();

    Text input = Document.get().createTextNode("ABCDE");
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  /**
   * Firefox specific- Test that typing with selection deletes the selected
   * range and reports correct cursor to typing extractor.
   */
  public void testTypingWithRangeSelectedDeletesRangeAndNotifiesExtrator() {
    FakeEditorEvent fakeEvent = FakeEditorEvent.create(KeySignalType.INPUT, 'a');
    final Point<ContentNode> start =
        Point.<ContentNode> end(newParaElement());
    final Point<ContentNode> end =
        Point.<ContentNode> end(newParaElement());

View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  public void testRoutePasteEvent() {
    final Point<ContentNode> caret =
      Point.<ContentNode> end(newParaElement());
    FocusedContentRange selection = new FocusedContentRange(caret);

    FakeEditorEvent pasteEvent = FakeEditorEvent.createPasteEvent();
    FakeEditorInteractor interactor = setupFakeEditorInteractor(selection);
    FakeEditorEventsSubHandler subHandler = new FakeEditorEventsSubHandler();
    EditorEventHandler handler = createEditorEventHandler(interactor, subHandler);

    subHandler.call(FakeEditorEventsSubHandler.HANDLE_PASTE).nOf(1).withArgs(pasteEvent).returns(
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

  }

  public void testCompositionEventsChangeState() {
    FakeEditorEvent[] events = FakeEditorEvent.compositionSequence(2);

    FakeEditorEvent keyEvent1 = FakeEditorEvent.create(KeySignalType.INPUT, 'a');
    FakeEditorEvent keyEvent2 = FakeEditorEvent.create(KeySignalType.INPUT,
        SignalKeyLogic.IME_CODE);

    final Point<ContentNode> caret =
        Point.<ContentNode> end(newParaElement());
View Full Code Here

Examples of org.waveprotocol.wave.client.editor.testing.FakeEditorEvent

    interactor.call(FakeEditorInteractor.HAS_CONTENT_SELECTION).nOf(1).returns(false);
    interactor.call(FakeEditorInteractor.FORCE_FLUSH).nOf(1);
    interactor.call(FakeEditorInteractor.GET_SELECTION_POINTS).nOf(1).returns(null);

    // didn't have content selection, so don't cancel.
    FakeEditorEvent keyEvent = FakeEditorEvent.createPasteEvent();
    assertFalse(handler.handleEvent(keyEvent));

    /// part two - now have content selection

    // should check for selection, the flush, realise selection is lost, and get a null selection.
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.