Package org.waveprotocol.wave.client.editor.content

Examples of org.waveprotocol.wave.client.editor.content.ContentElement



  public void testGetValidSelectionPointIfAvailable() {
    setupTest("<body><line></line></body>");
    Point<ContentNode> point = aggressiveSelectionHelper.getFirstValidSelectionPoint();
    ContentElement localP = doc.getDocumentElement().getFirstChild().getLastChild().asElement();
    assertEquals(Point.end(localP), point);

    setupTest("<body><line></line></body>");
    point = aggressiveSelectionHelper.getLastValidSelectionPoint();
    localP = doc.getDocumentElement().getFirstChild().getLastChild().asElement();
View Full Code Here


   */
  Line delete(int index) {
//    info("Deleting @" + index);

    assert index != 0 : "Code doesn't (yet) support killing the initial line";
    ContentElement e = getLineElement(index);
    Line line = Line.fromLineElement(e).next();
    doc.deleteNode(e);
    return line;
  }
View Full Code Here

   *        "decimal", but the type is "HEADING", the listyle attribute should
   *        normally be ignored and has no meaning. It won't make a difference
   *        if it is set or not. We want to test both scenarios.
   */
  void update(int index, Type type, int indent, boolean alwaysSetRedundant) {
    ContentElement e = getLineElement(index);
//    info("Making @" + ((doc.getLocation(e) - 1)/2) + " " +
//        type + " " + indent + " " + alwaysSetStyle);

    Map<String, String> updates = attributes(type, indent, alwaysSetRedundant, false);

View Full Code Here

      }
    }
  }

  private ContentElement newParaElement() {
    return new ContentElement("p", Document.get().createPElement(), null);
  }
View Full Code Here

    interactor.checkExpectations();
    subHandler.checkExpectations();
  }

  ContentElement newElement() {
    return new ContentElement("p", Document.get().createPElement(), null);
  }
View Full Code Here

  /**
   * Tests mouse event triggers on node.
   */
  public void testMouseEventsTriggeredOnNode() {
    EditorEvent mouseSignal = FakeSignalEvent.createClick(FakeEditorEvent.ED_FACTORY, null);
    ContentElement fakeContentElement = newElement();
    final Point<ContentNode> caret = Point.<ContentNode> end(fakeContentElement);

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

   * 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);
View Full Code Here

    EditorEvent signal = FakeSignalEvent.createKeyPress(FakeEditorEvent.ED_FACTORY,
        KeySignalType.DELETE, isBackspace ? KeyCodes.KEY_BACKSPACE : KeyCodes.KEY_DELETE,
        isShiftDown ? EnumSet.of(KeyModifier.SHIFT) : null);

    FakeRouter router = new FakeRouter();
    ContentElement fakeContentElement = newElement();
    final Point<ContentNode> caret = Point.<ContentNode> end(fakeContentElement);

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

    editor.init(Editor.ROOT_REGISTRIES, KeyBindingRegistry.NONE, EditorSettings.DEFAULT);

    // seed editor and find image in content:
    ContentSerialisationUtil.setContentString(editor,
        "<body><line/><img src=\"imageSource\"></img></body>");
    ContentElement imgTag = editor.getDocument().getDocumentElement()
        .getFirstChild().getLastChild().getFirstChild().asElement();

    // check image in html:
    Element elt = imgTag.getImplNodelet();
    assertEquals("IMG", elt.getTagName().toUpperCase());
    assertEquals("imageSource", elt.getAttribute("src"));
  }
View Full Code Here

        move(hpoint(t1, 0)),
        type("abc"),
        bksp(3)
    );

    ContentElement b = c.createElement("b", root, null);
    runSimpleTest(
        move(hpoint(b, null)),
        type("abc"),
        bksp(3)
    );
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.editor.content.ContentElement

Copyright © 2018 www.massapicom. 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.