Пример #1
0
 it("returns the first descendant", () => {
   const node = root;
   assert.isNotNull(node); // make sure we got something
   assert.isDefined(node); // make sure we got something
   assert.equal(domutil.firstDescendantOrSelf(node),
                root.getElementsByTagName("title")[0].firstChild);
 });
Пример #2
0
    it("moves the caret to the previous line", () => {
      // Text node inside 2nd paragraph.
      const initial = editor.dataRoot.querySelectorAll("body>p")[1];
      caretManager.setCaret(initial.firstChild, 0);

      editor.type(keyConstants.UP_ARROW);

      // We end up in the previous paragraph.
      dataCaretCheck(editor,
                     firstDescendantOrSelf(initial.previousElementSibling)!,
                     0, "moved up");
    });
Пример #3
0
    it("moves the caret to the next line", () => {
      // Text node inside paragraph.
      const initial = editor.dataRoot.querySelector("body>p")!;
      caretManager.setCaret(initial.firstChild, 0);

      editor.type(keyConstants.DOWN_ARROW);

      // We end up in the next paragraph.
      dataCaretCheck(editor,
                     firstDescendantOrSelf(initial.nextElementSibling)!,
                     0, "moved down");
    });
Пример #4
0
 it("returns null when passed undefined", () => {
   assert.isNull(domutil.firstDescendantOrSelf(undefined));
 });
Пример #5
0
 it("returns null when passed null", () => {
   assert.isNull(domutil.firstDescendantOrSelf(null));
 });