|
|
@@ -1804,7 +1804,7 @@ describe( 'Renderer', () => {
|
|
|
expect( textNode.textContent ).to.equal( label );
|
|
|
|
|
|
const domSelection = domRoot.ownerDocument.getSelection();
|
|
|
- assertDomSelectionContents( domSelection, container, 'fake selection label' );
|
|
|
+ assertDomSelectionContents( domSelection, container, /^fake selection label$/ );
|
|
|
} );
|
|
|
|
|
|
describe( 'subsequent call optimization', () => {
|
|
|
@@ -1885,7 +1885,7 @@ describe( 'Renderer', () => {
|
|
|
expect( textNode.textContent ).to.equal( '\u00A0' );
|
|
|
|
|
|
const domSelection = domRoot.ownerDocument.getSelection();
|
|
|
- assertDomSelectionContents( domSelection, container, '\u00A0' );
|
|
|
+ assertDomSelectionContents( domSelection, container, /^[ \u00A0]$/ );
|
|
|
} );
|
|
|
|
|
|
it( 'should remove fake selection container when selection is no longer fake', () => {
|
|
|
@@ -1902,7 +1902,7 @@ describe( 'Renderer', () => {
|
|
|
expect( domParagraph.tagName.toLowerCase() ).to.equal( 'p' );
|
|
|
|
|
|
const domSelection = domRoot.ownerDocument.getSelection();
|
|
|
- assertDomSelectionContents( domSelection, domParagraph, 'foo bar' );
|
|
|
+ assertDomSelectionContents( domSelection, domParagraph, /^foo bar$/ );
|
|
|
} );
|
|
|
|
|
|
it( 'should reuse fake selection container #1', () => {
|
|
|
@@ -2051,15 +2051,16 @@ describe( 'Renderer', () => {
|
|
|
renderer.render();
|
|
|
|
|
|
const domSelection = domRoot.ownerDocument.getSelection();
|
|
|
- assertDomSelectionContents( domSelection, container, 'fake selection label' );
|
|
|
+ assertDomSelectionContents( domSelection, container, /^fake selection label$/ );
|
|
|
} );
|
|
|
|
|
|
// Use a forgiving way of checking what the selection contains
|
|
|
// because Safari normalizes the selection ranges so precise checking is troublesome.
|
|
|
+ // Also, Firefox returns a normal space instead of nbsp so we need to use even more alternatives.
|
|
|
function assertDomSelectionContents( domSelection, expectedContainer, expectedText ) {
|
|
|
const domSelectionContainer = domSelection.getRangeAt( 0 ).commonAncestorContainer;
|
|
|
|
|
|
- expect( domSelection.toString() ).to.equal( expectedText );
|
|
|
+ expect( domSelection.toString() ).to.match( expectedText );
|
|
|
expect(
|
|
|
domSelectionContainer == expectedContainer.firstChild || domSelectionContainer == expectedContainer
|
|
|
).to.be.true;
|
|
|
@@ -3660,6 +3661,13 @@ describe( 'Renderer', () => {
|
|
|
// However, for larger data sets the difference between using `diff()` and `fastDiff()` (see above issue for context)
|
|
|
// is more than 10x in execution time so it is clearly visible in these tests when something goes wrong.
|
|
|
describe( 'rendering performance', () => {
|
|
|
+ before( function() {
|
|
|
+ // Ignore on Edge browser where performance is quite poor.
|
|
|
+ if ( env.isEdge ) {
|
|
|
+ this.skip();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+
|
|
|
it( 'should not take more than 350ms to render around 300 element nodes (same html)', () => {
|
|
|
const renderingTime = measureRenderingTime( viewRoot, generateViewData1( 65 ), generateViewData1( 55 ) );
|
|
|
expect( renderingTime ).to.be.within( 0, 350 );
|