suite.test('isCaretContainerInline', function () {
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(document.createTextNode('text')), false);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span></span>')[0]), false);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span data-mce-caret="1"></span>')[0]), false);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(DomQuery('<span data-mce-caret="1">a</span>')[0].firstChild), false);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(document.createTextNode(Zwsp.ZWSP)), true);
 });
    Step.sync(function () {
      setupHtml('<span contentEditable="false">1</span>');

      CaretContainer.insertInline(getRoot().firstChild, true);
      Assertions.assertEq('Should be inline container', true, CaretContainer.isCaretContainerInline(getRoot().firstChild));

      CaretContainerRemove.remove(getRoot().firstChild);
      Assertions.assertEq('Should not be inline container', false, CaretContainer.isCaretContainerInline(getRoot().firstChild));
    })
示例#3
0
  suite.test('down from P to inline cE=false', function (editor) {
    editor.setContent('<p>abc</p><p>a<span contentEditable="false">1</span></p>');
    LegacyUnit.setSelection(editor, 'p:first', 3);

    downArrow(editor);
    LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.$('p:last')[0].lastChild), true);
  });
示例#4
0
  suite.test('left/right over cE=false inline', function (editor) {
    editor.focus();
    editor.setContent('<span contenteditable="false">1</span>');
    editor.selection.select(editor.$('span')[0]);

    leftArrow(editor);
    LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>');
    LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.selection.getRng().startContainer), true);
    LegacyUnit.equalDom(editor.selection.getRng().startContainer, editor.$('p')[0].firstChild);

    rightArrow(editor);
    LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>');
    LegacyUnit.equalDom(editor.selection.getNode(), editor.$('span')[0]);

    rightArrow(editor);
    LegacyUnit.equal(editor.getContent(), '<p><span contenteditable="false">1</span></p>');
    LegacyUnit.equal(CaretContainer.isCaretContainerInline(editor.selection.getRng().startContainer), true);
    LegacyUnit.equalDom(editor.selection.getRng().startContainer, editor.$('p')[0].lastChild);
  });
 suite.test('insertBlock between elements', function () {
   setupHtml('<span contentEditable="false">1</span><span contentEditable="false">1</span>');
   LegacyUnit.equalDom(CaretContainer.insertInline(getRoot().lastChild, true), getRoot().childNodes[1]);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(getRoot().childNodes[1]), true);
 });
 suite.test('insertInline after element with ZWSP', function () {
   setupHtml('<span contentEditable="false">1</span>' + Zwsp.ZWSP + 'abc');
   LegacyUnit.equalDom(CaretContainer.insertInline(getRoot().firstChild, false), getRoot().childNodes[1]);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(getRoot().lastChild), false);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(getRoot().childNodes[1]), true);
 });
 suite.test('insertInline before element', function () {
   setupHtml('<span contentEditable="false">1</span>');
   LegacyUnit.equalDom(CaretContainer.insertInline(getRoot().firstChild, true), getRoot().firstChild);
   LegacyUnit.equal(CaretContainer.isCaretContainerInline(getRoot().firstChild), true);
 });