Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'should return true when image widget is the only element in the selection', () => {
// We need to create a container for the element to be able to create a Range on this element.
frag = new ViewDocumentFragment( [ element ] );
const selection = writer.createSelection( element, 'on' );
expect( getSelectedImageWidget( selection ) ).to.equal( element );
} );
it( 'should return false when widget element is not the only element in the selection', () => {
const notWidgetizedElement = writer.createContainerElement( 'p' );
frag = new ViewDocumentFragment( [ element, notWidgetizedElement ] );
const selection = writer.createSelection( writer.createRangeIn( frag ) );
expect( getSelectedImageWidget( selection ) ).to.be.null;
} );
} );
if ( currentParent ) {
currentParent.appendChildren( newNode );
}
if ( node.isContainer ) {
currentParent = newNode;
}
} else {
if ( currentParent.parent ) {
currentParent = currentParent.parent;
}
}
}
}
return currentParent || new ViewDocumentFragment();
}
}