Jforrester has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/362378 )
Change subject: build: Upgrade grunt-eslint from 19.0.0 to 20.0.0 ...................................................................... build: Upgrade grunt-eslint from 19.0.0 to 20.0.0 Lots of indent fixes (some of them a little dubious), plus a few unnecessary regex and quote character escapes. Change-Id: I18e13186f34756ca9c75a6e64d7e78baa819c629 --- M package.json M src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js M src/ce/keydownhandlers/ve.ce.LinearDeleteKeyDownHandler.js M src/ce/nodes/ve.ce.TableNode.js M src/ce/ve.ce.ResizableNode.js M src/ce/ve.ce.Surface.js M src/ce/ve.ce.TextState.js M src/dm/lineardata/ve.dm.ElementLinearData.js M src/dm/ve.dm.Converter.js M src/dm/ve.dm.IndexValueStore.js M src/dm/ve.dm.MetaList.js M src/dm/ve.dm.Scalable.js M src/dm/ve.dm.TransactionBuilder.js M src/dm/ve.dm.TransactionProcessor.js M src/dm/ve.dm.VisualDiff.js M src/init/sa/ve.init.sa.Platform.js M src/ui/actions/ve.ui.LinkAction.js M src/ui/contextitems/ve.ui.MergeCellsContextItem.js M src/ui/ve.ui.Surface.js M src/ui/widgets/ve.ui.LinkAnnotationWidget.js M src/ui/widgets/ve.ui.MediaSizeWidget.js M src/ve.Filibuster.js M tests/ce/ve.ce.Surface.test.js M tests/dm/ve.dm.RebaseServer.test.js M tests/dm/ve.dm.SurfaceFragment.test.js M tests/init/ve.init.sa.Platform.test.js M tests/ui/ve.ui.DiffElement.test.js M tests/ve.test.js M tests/ve.test.utils.js 29 files changed, 155 insertions(+), 142 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/78/362378/1 diff --git a/package.json b/package.json index 2f7edd3..cdd4d2f 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "grunt-contrib-watch": "1.0.0", "grunt-css-url-embed": "1.10.0", "grunt-cssjanus": "0.4.0", - "grunt-eslint": "19.0.0", + "grunt-eslint": "20.0.0", "grunt-jsonlint": "1.1.0", "grunt-karma": "2.0.0", "grunt-stylelint": "0.7.0", diff --git a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js index df3e3c0..26dd80a 100644 --- a/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js +++ b/src/ce/keydownhandlers/ve.ce.LinearArrowKeyDownHandler.js @@ -186,8 +186,8 @@ } newRange = ( afterDirection > 0 ? - viewNode.getOuterRange() : - viewNode.getOuterRange().flip() + viewNode.getOuterRange() : + viewNode.getOuterRange().flip() ); } else { // Check where the range has moved to diff --git a/src/ce/keydownhandlers/ve.ce.LinearDeleteKeyDownHandler.js b/src/ce/keydownhandlers/ve.ce.LinearDeleteKeyDownHandler.js index 71c9778..6a6d082 100644 --- a/src/ce/keydownhandlers/ve.ce.LinearDeleteKeyDownHandler.js +++ b/src/ce/keydownhandlers/ve.ce.LinearDeleteKeyDownHandler.js @@ -82,8 +82,8 @@ // then preventDefault if ( direction > 0 ? - skipNode.classList.contains( 've-ce-nail-pre-open' ) : - skipNode.classList.contains( 've-ce-nail-post-close' ) + skipNode.classList.contains( 've-ce-nail-pre-open' ) : + skipNode.classList.contains( 've-ce-nail-post-close' ) ) { position = ve.adjacentDomPosition( position, @@ -104,19 +104,19 @@ skipNode.classList && skipNode.classList.contains( direction > 0 ? - 've-ce-nail-pre-close' : - 've-ce-nail-post-open' + 've-ce-nail-pre-close' : + 've-ce-nail-post-open' ) && ( pairNode = ( direction > 0 ? - skipNode.previousSibling : - skipNode.nextSibling + skipNode.previousSibling : + skipNode.nextSibling ) ) && pairNode.classList && pairNode.classList.contains( direction > 0 ? - 've-ce-nail-post-open' : - 've-ce-nail-pre-close' + 've-ce-nail-post-open' : + 've-ce-nail-pre-close' ) ) { linkNode = skipNode.parentNode; @@ -142,8 +142,8 @@ // then preventDefault if ( direction > 0 ? - skipNode.classList.contains( 've-ce-nail-pre-close' ) : - skipNode.classList.contains( 've-ce-nail-post-open' ) + skipNode.classList.contains( 've-ce-nail-pre-close' ) : + skipNode.classList.contains( 've-ce-nail-post-open' ) ) { position = ve.adjacentDomPosition( position, diff --git a/src/ce/nodes/ve.ce.TableNode.js b/src/ce/nodes/ve.ce.TableNode.js index 03de669..c451f2d 100644 --- a/src/ce/nodes/ve.ce.TableNode.js +++ b/src/ce/nodes/ve.ce.TableNode.js @@ -358,7 +358,8 @@ ve.ce.TableNode.prototype.onSurfaceModelSelect = function ( selection ) { // The table is active if there is a linear selection inside a cell being edited // or a table selection matching this table. - var active = ( + var active = + ( this.editingFragment !== null && selection instanceof ve.dm.LinearSelection && this.editingFragment.getSelection().getRanges()[ 0 ].containsRange( selection.getRange() ) diff --git a/src/ce/ve.ce.ResizableNode.js b/src/ce/ve.ce.ResizableNode.js index 8510fc7..62af914 100644 --- a/src/ce/ve.ce.ResizableNode.js +++ b/src/ce/ve.ce.ResizableNode.js @@ -249,16 +249,16 @@ this.$resizeHandles .find( '.ve-ce-resizableNode-neHandle' ) - .css( { marginRight: -this.$resizable.width() } ) - .end() + .css( { marginRight: -this.$resizable.width() } ) + .end() .find( '.ve-ce-resizableNode-swHandle' ) - .css( { marginBottom: -this.$resizable.height() } ) - .end() + .css( { marginBottom: -this.$resizable.height() } ) + .end() .find( '.ve-ce-resizableNode-seHandle' ) - .css( { - marginRight: -this.$resizable.width(), - marginBottom: -this.$resizable.height() - } ); + .css( { + marginRight: -this.$resizable.width(), + marginBottom: -this.$resizable.height() + } ); this.$resizeHandles.children() .off( '.ve-ce-resizableNode' ) @@ -449,16 +449,16 @@ height: 0 } ) .find( '.ve-ce-resizableNode-neHandle' ) - .css( { marginRight: -width } ) - .end() + .css( { marginRight: -width } ) + .end() .find( '.ve-ce-resizableNode-swHandle' ) - .css( { marginBottom: -height } ) - .end() + .css( { marginBottom: -height } ) + .end() .find( '.ve-ce-resizableNode-seHandle' ) - .css( { - marginRight: -width, - marginBottom: -height - } ); + .css( { + marginRight: -width, + marginBottom: -height + } ); }; /** diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js index badfa60..fa2a687 100644 --- a/src/ce/ve.ce.Surface.js +++ b/src/ce/ve.ce.Surface.js @@ -287,16 +287,16 @@ */ ve.ce.Surface.static.cursorHolderTemplate = ( $( '<div>' ) - .addClass( 've-ce-cursorHolder' ) - .prop( 'contentEditable', 'true' ) - .append( - // The image does not need a src for Firefox in spite of cursoring - // bug https://bugzilla.mozilla.org/show_bug.cgi?id=989012 , because - // you can cursor to ce=false blocks in Firefox (see bug - // https://bugzilla.mozilla.org/show_bug.cgi?id=1155031 ) - $( '<img>' ).addClass( 've-ce-cursorHolder-img' ) - ) - .get( 0 ) + .addClass( 've-ce-cursorHolder' ) + .prop( 'contentEditable', 'true' ) + .append( + // The image does not need a src for Firefox in spite of cursoring + // bug https://bugzilla.mozilla.org/show_bug.cgi?id=989012 , because + // you can cursor to ce=false blocks in Firefox (see bug + // https://bugzilla.mozilla.org/show_bug.cgi?id=1155031 ) + $( '<img>' ).addClass( 've-ce-cursorHolder-img' ) + ) + .get( 0 ) ); /* Static methods */ @@ -311,12 +311,13 @@ */ ve.ce.Surface.static.getClipboardHash = function ( $elements, beforePasteData ) { beforePasteData = beforePasteData || {}; - return $elements.text().slice( - beforePasteData.leftText ? beforePasteData.leftText.length : 0, - beforePasteData.rightText ? -beforePasteData.rightText.length : undefined - ) - // Whitespace may be modified (e.g. ' ' to ' '), so strip it all - .replace( /\s/gm, '' ); + return $elements.text() + .slice( + beforePasteData.leftText ? beforePasteData.leftText.length : 0, + beforePasteData.rightText ? -beforePasteData.rightText.length : undefined + ) + // Whitespace may be modified (e.g. ' ' to ' '), so strip it all + .replace( /\s/gm, '' ); }; /* Methods */ @@ -648,8 +649,8 @@ // Collapsed selections can have a width of 0, so expand width: Math.max( rects[ i ].width, 1 ), height: rects[ i ].height - } - ) ).toggleClass( 've-ce-surface-deactivatedSelection-collapsed', selection.getModel().isCollapsed() ); + } ) + ).toggleClass( 've-ce-surface-deactivatedSelection-collapsed', selection.getModel().isCollapsed() ); } } } @@ -4049,9 +4050,9 @@ background: color } ).append( $( '<span>' ) - .addClass( 've-ce-surface-highlights-user-cursor-label' ) - .text( this.synchronizer.authorNames[ author ] ) - .css( { background: color } ) + .addClass( 've-ce-surface-highlights-user-cursor-label' ) + .text( this.synchronizer.authorNames[ author ] ) + .css( { background: color } ) ) ); diff --git a/src/ce/ve.ce.TextState.js b/src/ce/ve.ce.TextState.js index ea8350c..7459b31 100644 --- a/src/ce/ve.ce.TextState.js +++ b/src/ce/ve.ce.TextState.js @@ -234,7 +234,7 @@ // annotations, then matching characters at their end potentially form part of // the unchanged end region. if ( oldChunks[ oldChunks.length - 1 - change.end ].hasEqualElements( - newChunks[ newChunks.length - 1 - change.end ] + newChunks[ newChunks.length - 1 - change.end ] ) ) { oldChunk = oldChunks[ oldChunks.length - 1 - change.end ]; newChunk = newChunks[ newChunks.length - 1 - change.end ]; diff --git a/src/dm/lineardata/ve.dm.ElementLinearData.js b/src/dm/lineardata/ve.dm.ElementLinearData.js index c53355d..125beff 100644 --- a/src/dm/lineardata/ve.dm.ElementLinearData.js +++ b/src/dm/lineardata/ve.dm.ElementLinearData.js @@ -1164,10 +1164,12 @@ // Create annotation set to remove from blacklist setToRemove = allAnnotations.filter( function ( annotation ) { - return ( rules.blacklist && rules.blacklist.indexOf( annotation.name ) !== -1 ) || ( - // If original DOM element references are being removed, remove spans - annotation.name === 'textStyle/span' && rules.removeOriginalDomElements - ); + return ( + rules.blacklist && rules.blacklist.indexOf( annotation.name ) !== -1 + ) || ( + // If original DOM element references are being removed, remove spans + annotation.name === 'textStyle/span' && rules.removeOriginalDomElements + ); } ); } diff --git a/src/dm/ve.dm.Converter.js b/src/dm/ve.dm.Converter.js index 41206a0..45ca662 100644 --- a/src/dm/ve.dm.Converter.js +++ b/src/dm/ve.dm.Converter.js @@ -579,7 +579,7 @@ if ( wrappedMetaItems[ i ].internal && wrappedMetaItems[ i ].internal.whitespace ) { if ( whitespaceTreatment === 'restore' ) { ve.batchPush( toInsert, ve.dm.Converter.static.getDataContentFromText( - wrappedMetaItems[ i ].internal.whitespace[ 0 ], context.annotations + wrappedMetaItems[ i ].internal.whitespace[ 0 ], context.annotations ) ); delete wrappedMetaItems[ i ].internal; } else if ( whitespaceTreatment === 'fixup' ) { @@ -1431,7 +1431,9 @@ break; case 'empty': // 'empty' elements - first ensure they are actually empty - if ( domElement.childNodes.length === 0 && ( + if ( + domElement.childNodes.length === 0 && + ( // then check that we are the last child // before unwrapping (and therefore destroying) data[ i + 1 ] === undefined || diff --git a/src/dm/ve.dm.IndexValueStore.js b/src/dm/ve.dm.IndexValueStore.js index 08bf153..c413f46 100644 --- a/src/dm/ve.dm.IndexValueStore.js +++ b/src/dm/ve.dm.IndexValueStore.js @@ -152,7 +152,7 @@ return hash; }; - /** +/** * Replace a value's stored hash, e.g. if the value has changed and you want to discard the old one. * * @param {string} oldHash The value's previously stored hash diff --git a/src/dm/ve.dm.MetaList.js b/src/dm/ve.dm.MetaList.js index f4df02a..be8172e 100644 --- a/src/dm/ve.dm.MetaList.js +++ b/src/dm/ve.dm.MetaList.js @@ -174,9 +174,9 @@ // No metadata handling specified, which means we just have to deal with offset // adjustments, same as a retain for ( ; - itemIndex < numItems && - this.items[ itemIndex ].offset < offset + rm.length; - itemIndex++ + itemIndex < numItems && + this.items[ itemIndex ].offset < offset + rm.length; + itemIndex++ ) { newItems.push( { item: this.items[ itemIndex ], diff --git a/src/dm/ve.dm.Scalable.js b/src/dm/ve.dm.Scalable.js index 29d06e1..a48249e 100644 --- a/src/dm/ve.dm.Scalable.js +++ b/src/dm/ve.dm.Scalable.js @@ -519,10 +519,12 @@ * @return {boolean} Current dimensions are greater than maximum dimensions */ ve.dm.Scalable.prototype.isTooSmall = function () { - return !!( this.getCurrentDimensions() && this.getMinDimensions() && ( + return !!( this.getCurrentDimensions() && this.getMinDimensions() && + ( this.getCurrentDimensions().width < this.getMinDimensions().width || this.getCurrentDimensions().height < this.getMinDimensions().height - ) ); + ) + ); }; /** @@ -533,10 +535,12 @@ * @return {boolean} Current dimensions are greater than maximum dimensions */ ve.dm.Scalable.prototype.isTooLarge = function () { - return !!( this.getCurrentDimensions() && this.getMaxDimensions() && ( + return !!( this.getCurrentDimensions() && this.getMaxDimensions() && + ( this.getCurrentDimensions().width > this.getMaxDimensions().width || this.getCurrentDimensions().height > this.getMaxDimensions().height - ) ); + ) + ); }; /** diff --git a/src/dm/ve.dm.TransactionBuilder.js b/src/dm/ve.dm.TransactionBuilder.js index 03a2e7b..1b4cca6 100644 --- a/src/dm/ve.dm.TransactionBuilder.js +++ b/src/dm/ve.dm.TransactionBuilder.js @@ -970,8 +970,8 @@ mergedMetadata ).concat( ( insertMetadata === undefined || isInsertEmpty ) ? - new Array( insert.length - mergedMetadata.length ) : - insertMetadata + new Array( insert.length - mergedMetadata.length ) : + insertMetadata ), insertedDataOffset, insertedDataLength diff --git a/src/dm/ve.dm.TransactionProcessor.js b/src/dm/ve.dm.TransactionProcessor.js index 4cdfb0f..d2d893e 100644 --- a/src/dm/ve.dm.TransactionProcessor.js +++ b/src/dm/ve.dm.TransactionProcessor.js @@ -405,14 +405,14 @@ dataSplices.length === 1 && // The data it removes does not contain openings/closings !new ve.dm.FlatLinearData( - this.document.getStore(), - dataSplices[ 0 ].removedData - ).containsElementData() && + this.document.getStore(), + dataSplices[ 0 ].removedData + ).containsElementData() && // The data it inserts does not contain openings/closings !new ve.dm.FlatLinearData( - this.document.getStore(), - dataSplices[ 0 ].insert - ).containsElementData() + this.document.getStore(), + dataSplices[ 0 ].insert + ).containsElementData() ) { selection = this.document.selectNodes( new ve.Range( diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js index f7a81bf..c6e2806 100644 --- a/src/dm/ve.dm.VisualDiff.js +++ b/src/dm/ve.dm.VisualDiff.js @@ -332,11 +332,11 @@ linearDiff: null, replacement: replacement, attributeChange: !replacement && !ve.compare( oldNode.getAttributes(), newNode.getAttributes() ) ? - { - oldAttributes: oldNode.getAttributes(), - newAttributes: newNode.getAttributes() - } : - false + { + oldAttributes: oldNode.getAttributes(), + newAttributes: newNode.getAttributes() + } : + false }; continue; @@ -380,11 +380,11 @@ linearDiff: linearDiff, replacement: replacement, attributeChange: !replacement && !ve.compare( oldNode.getAttributes(), newNode.getAttributes() ) ? - { - oldAttributes: oldNode.getAttributes(), - newAttributes: newNode.getAttributes() - } : - false + { + oldAttributes: oldNode.getAttributes(), + newAttributes: newNode.getAttributes() + } : + false }; if ( linearDiff ) { diff --git a/src/init/sa/ve.init.sa.Platform.js b/src/init/sa/ve.init.sa.Platform.js index bf783bf..0f010bb 100644 --- a/src/init/sa/ve.init.sa.Platform.js +++ b/src/init/sa/ve.init.sa.Platform.js @@ -26,8 +26,8 @@ ve.init.Platform.call( this ); // Properties - this.externalLinkUrlProtocolsRegExp = /^https?\:\/\//i; - this.unanchoredExternalLinkUrlProtocolsRegExp = /https?\:\/\//i; + this.externalLinkUrlProtocolsRegExp = /^https?:\/\//i; + this.unanchoredExternalLinkUrlProtocolsRegExp = /https?:\/\//i; this.messagePaths = messagePaths || []; this.parsedMessages = {}; this.userLanguages = [ 'en' ]; diff --git a/src/ui/actions/ve.ui.LinkAction.js b/src/ui/actions/ve.ui.LinkAction.js index c8be7d9..6c829c3 100644 --- a/src/ui/actions/ve.ui.LinkAction.js +++ b/src/ui/actions/ve.ui.LinkAction.js @@ -166,7 +166,7 @@ * stripped from an autolink. */ ve.ui.LinkAction.prototype.getTrailingPunctuation = function () { - return /[,;.:!?)\]\}"'”’»]+$/; + return /[,;.:!?)\]}"'”’»]+$/; }; /** diff --git a/src/ui/contextitems/ve.ui.MergeCellsContextItem.js b/src/ui/contextitems/ve.ui.MergeCellsContextItem.js index 2fbd887..6a928e4 100644 --- a/src/ui/contextitems/ve.ui.MergeCellsContextItem.js +++ b/src/ui/contextitems/ve.ui.MergeCellsContextItem.js @@ -64,8 +64,8 @@ } else { this.editButton.setLabel( isMergeable && selection.isSingleCell() ? - ve.msg( 'visualeditor-table-merge-cells-unmerge' ) : - ve.msg( 'visualeditor-table-merge-cells-merge' ) + ve.msg( 'visualeditor-table-merge-cells-unmerge' ) : + ve.msg( 'visualeditor-table-merge-cells-merge' ) ); } }; diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js index 99ea13e..c2516e1 100644 --- a/src/ui/ve.ui.Surface.js +++ b/src/ui/ve.ui.Surface.js @@ -837,8 +837,8 @@ startOffset: nativeRange.startOffset, endContainer: ( nativeRange.startContainer === nativeRange.endContainer ? - '(=startContainer)' : - ve.serializeNodeDebug( nativeRange.endContainer ) + '(=startContainer)' : + ve.serializeNodeDebug( nativeRange.endContainer ) ), endOffset: nativeRange.endOffset } ); diff --git a/src/ui/widgets/ve.ui.LinkAnnotationWidget.js b/src/ui/widgets/ve.ui.LinkAnnotationWidget.js index 92b07a4..ac103d9 100644 --- a/src/ui/widgets/ve.ui.LinkAnnotationWidget.js +++ b/src/ui/widgets/ve.ui.LinkAnnotationWidget.js @@ -152,8 +152,8 @@ */ ve.ui.LinkAnnotationWidget.prototype.setAnnotation = function ( annotation, fromText ) { if ( ve.compare( - annotation ? annotation.getComparableObject() : {}, - this.annotation ? this.annotation.getComparableObject() : {} + annotation ? annotation.getComparableObject() : {}, + this.annotation ? this.annotation.getComparableObject() : {} ) ) { // No change return this; diff --git a/src/ui/widgets/ve.ui.MediaSizeWidget.js b/src/ui/widgets/ve.ui.MediaSizeWidget.js index 0199562..eea24ca 100644 --- a/src/ui/widgets/ve.ui.MediaSizeWidget.js +++ b/src/ui/widgets/ve.ui.MediaSizeWidget.js @@ -188,8 +188,8 @@ // to support that as well this.setSizeType( isDefault ? - 'default' : - 'custom' + 'default' : + 'custom' ); this.validateDimensions(); }; @@ -356,11 +356,7 @@ this.sizeTypeSelectWidget.getItemFromData( 'default' ).setDisabled( false ); // Call for the set size type according to default or custom settings of the scalable - this.setSizeType( - this.scalable.isDefault() ? - 'default' : - 'custom' - ); + this.setSizeType( this.scalable.isDefault() ? 'default' : 'custom' ); } this.validateDimensions(); }; diff --git a/src/ve.Filibuster.js b/src/ve.Filibuster.js index 8591e43..09064bb 100644 --- a/src/ve.Filibuster.js +++ b/src/ve.Filibuster.js @@ -503,11 +503,11 @@ } else if ( val instanceof ve.dm.Selection ) { return { 've.dm.Selection': val.getDescription() }; } else if ( val.constructor === ve.dm.AnnotationSet ) { - return { 've.dm.AnnotationSet': - val.getStore().values( val.getIndexes() ) - .map( function ( annotation ) { - return annotation.name; - } ) + return { 've.dm.AnnotationSet': val.getStore() + .values( val.getIndexes() ) + .map( function ( annotation ) { + return annotation.name; + } ) }; } else if ( val.constructor !== Object ) { // Not a plain old object diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js index cb53164..a4981a1 100644 --- a/tests/ce/ve.ce.Surface.test.js +++ b/tests/ce/ve.ce.Surface.test.js @@ -330,10 +330,12 @@ rangeOrSelection: new ve.Range( 0, 63 ), keys: [ 'BACKSPACE' ], expectedData: function ( data ) { - data.splice( 0, 61, - { type: 'paragraph' }, - { type: '/paragraph' } - ); + data.splice( + 0, + 61, + { type: 'paragraph' }, + { type: '/paragraph' } + ); }, expectedRangeOrSelection: new ve.Range( 1 ), msg: 'Backspace after select all spanning entire document creates empty paragraph' diff --git a/tests/dm/ve.dm.RebaseServer.test.js b/tests/dm/ve.dm.RebaseServer.test.js index abffd10..479b147 100644 --- a/tests/dm/ve.dm.RebaseServer.test.js +++ b/tests/dm/ve.dm.RebaseServer.test.js @@ -7,8 +7,7 @@ QUnit.module( 've.dm.RebaseServer' ); QUnit.test( 'Rebase', function ( assert ) { - var cases = [ - { + var cases = [ { name: 'Concurrent insertions', initialData: [ { type: 'paragraph' }, { type: '/paragraph' } ], clients: [ '1', '2' ], diff --git a/tests/dm/ve.dm.SurfaceFragment.test.js b/tests/dm/ve.dm.SurfaceFragment.test.js index e716dff..31a8ec3 100644 --- a/tests/dm/ve.dm.SurfaceFragment.test.js +++ b/tests/dm/ve.dm.SurfaceFragment.test.js @@ -414,10 +414,12 @@ range: new ve.Range( 0, 63 ), directionAfterRemove: -1, expectedData: function ( data ) { - data.splice( 0, 61, - { type: 'paragraph' }, - { type: '/paragraph' } - ); + data.splice( + 0, + 61, + { type: 'paragraph' }, + { type: '/paragraph' } + ); }, expectedRange: new ve.Range( 1 ), msg: 'Backspace after select all spanning entire document creates empty paragraph' @@ -427,10 +429,12 @@ range: new ve.Range( 0, 6 ), directionAfterRemove: -1, expectedData: function ( data ) { - data.splice( 0, 7, - { type: 'paragraph' }, - { type: '/paragraph' } - ); + data.splice( + 0, + 7, + { type: 'paragraph' }, + { type: '/paragraph' } + ); }, expectedRange: new ve.Range( 1 ), msg: 'Delete all when document starts with a focusable node' @@ -440,10 +444,12 @@ range: new ve.Range( 0, 9 ), directionAfterRemove: -1, expectedData: function ( data ) { - data.splice( 0, 9, - { type: 'paragraph' }, - { type: '/paragraph' } - ); + data.splice( + 0, + 9, + { type: 'paragraph' }, + { type: '/paragraph' } + ); }, expectedRange: new ve.Range( 1 ), msg: 'Delete all when document starts and ends with a focusable node' diff --git a/tests/init/ve.init.sa.Platform.test.js b/tests/init/ve.init.sa.Platform.test.js index 2553659..f9df0c3 100644 --- a/tests/init/ve.init.sa.Platform.test.js +++ b/tests/init/ve.init.sa.Platform.test.js @@ -76,7 +76,7 @@ platform.getInitializedPromise().done( function () { QUnit.start(); assert.ok( - /^<?platformtest-foo\>?$/.test( platform.getMessage( 'platformtest-foo' ) ), + /^<?platformtest-foo>?$/.test( platform.getMessage( 'platformtest-foo' ) ), 'return plain key as fallback, possibly wrapped in brackets' ); @@ -98,7 +98,7 @@ ); assert.ok( - /^<?platformtest-quux\>?$/.test( platform.getMessage( 'platformtest-quux' ) ), + /^<?platformtest-quux>?$/.test( platform.getMessage( 'platformtest-quux' ) ), 'return plain key as fallback, possibly wrapped in brackets (after set up)' ); } ); diff --git a/tests/ui/ve.ui.DiffElement.test.js b/tests/ui/ve.ui.DiffElement.test.js index 676e869..b1bdb7d 100644 --- a/tests/ui/ve.ui.DiffElement.test.js +++ b/tests/ui/ve.ui.DiffElement.test.js @@ -261,9 +261,9 @@ '<div class="ve-ui-diffElement-doc-child-change">' + '<table><tbody>' + '<tr><td>A</td>' + - '<td data-diff-action="structural-insert"><p data-diff-action=\"insert\">B</p></td></tr>' + + '<td data-diff-action="structural-insert"><p data-diff-action="insert">B</p></td></tr>' + '<tr><td>C</td>' + - '<td data-diff-action="structural-insert"><p data-diff-action=\"insert\">D</p></td></tr>' + + '<td data-diff-action="structural-insert"><p data-diff-action="insert">D</p></td></tr>' + '</tbody></table>' + '</div>' }, @@ -274,8 +274,8 @@ expected: '<div class="ve-ui-diffElement-doc-child-change">' + '<table><tbody>' + - '<tr><td>A</td><td data-diff-action="structural-remove"><p data-diff-action=\"remove\">B</p></td></tr>' + - '<tr><td>C</td><td data-diff-action="structural-remove"><p data-diff-action=\"remove\">D</p></td></tr>' + + '<tr><td>A</td><td data-diff-action="structural-remove"><p data-diff-action="remove">B</p></td></tr>' + + '<tr><td>C</td><td data-diff-action="structural-remove"><p data-diff-action="remove">D</p></td></tr>' + '</tbody></table>' + '</div>' }, @@ -295,9 +295,9 @@ '<table><tbody>' + '<tr><td>A</td><td>B</td><td><del data-diff-action="remove">C</del><ins data-diff-action="insert">X</ins></td></tr>' + '<tr data-diff-action="structural-remove">' + - '<td data-diff-action="structural-remove"><p data-diff-action=\"remove\">D</p></td>' + - '<td data-diff-action="structural-remove"><p data-diff-action=\"remove\">E</p></td>' + - '<td data-diff-action="structural-remove"><p data-diff-action=\"remove\">F</p></td>' + + '<td data-diff-action="structural-remove"><p data-diff-action="remove">D</p></td>' + + '<td data-diff-action="structural-remove"><p data-diff-action="remove">E</p></td>' + + '<td data-diff-action="structural-remove"><p data-diff-action="remove">F</p></td>' + '</tr>' + '<tr><td>G</td><td>H</td><td><del data-diff-action="remove">I</del><ins data-diff-action="insert">Y</ins></td></tr>' + '</tbody></table>' + @@ -391,7 +391,7 @@ '<div class="ve-ui-diffElement-doc-child-change">' + '<ul>' + '<li><p>foo</p></li>' + - '<li data-diff-action=\"structural-insert\"><p data-diff-action=\"insert\">bar</p></li>' + + '<li data-diff-action="structural-insert"><p data-diff-action="insert">bar</p></li>' + '<li><p>baz</p></li>' + '</ul>' + '</div>' @@ -404,7 +404,7 @@ '<div class="ve-ui-diffElement-doc-child-change">' + '<ul>' + '<li><p>foo</p></li>' + - '<li data-diff-action=\"structural-remove\"><p data-diff-action=\"remove\">bar</p></li>' + + '<li data-diff-action="structural-remove"><p data-diff-action="remove">bar</p></li>' + '<li><p>baz</p></li>' + '</ul>' + '</div>' @@ -415,8 +415,8 @@ newDoc: '<ul><li><ul><li><p>foo</p></li></ul></li></ul>', expected: '<div class="ve-ui-diffElement-doc-child-change">' + - '<ul data-diff-action=\"structural-insert\">' + - '<li data-diff-action=\"structural-insert\"><ul><li><p>foo</p></li></ul></li>' + + '<ul data-diff-action="structural-insert">' + + '<li data-diff-action="structural-insert"><ul><li><p>foo</p></li></ul></li>' + '</ul>' + '</div>' }, diff --git a/tests/ve.test.js b/tests/ve.test.js index 77958ed..05ccba4 100644 --- a/tests/ve.test.js +++ b/tests/ve.test.js @@ -1090,8 +1090,8 @@ offsetPaths, ( direction === 'backward' ? - test.expectedOffsetPaths.slice().reverse() : - test.expectedOffsetPaths + test.expectedOffsetPaths.slice().reverse() : + test.expectedOffsetPaths ), test.title + ' (' + direction + ')' ); diff --git a/tests/ve.test.utils.js b/tests/ve.test.utils.js index e0ee772..f77434c 100644 --- a/tests/ve.test.utils.js +++ b/tests/ve.test.utils.js @@ -21,8 +21,8 @@ DummyPlatform.prototype.getMessage = function () { return Array.prototype.join.call( arguments, ',' ); }; DummyPlatform.prototype.getLanguageName = function ( lang ) { return 'langname-' + lang; }; DummyPlatform.prototype.getLanguageDirection = function () { return 'ltr'; }; - DummyPlatform.prototype.getExternalLinkUrlProtocolsRegExp = function () { return /^https?\:\/\//i; }; - DummyPlatform.prototype.getUnanchoredExternalLinkUrlProtocolsRegExp = function () { return /https?\:\/\//i; }; + DummyPlatform.prototype.getExternalLinkUrlProtocolsRegExp = function () { return /^https?:\/\//i; }; + DummyPlatform.prototype.getUnanchoredExternalLinkUrlProtocolsRegExp = function () { return /https?:\/\//i; }; DummyPlatform.prototype.getUserConfig = function () { return undefined; }; DummyPlatform.prototype.setUserConfig = function () {}; @@ -376,8 +376,8 @@ */ ve.test.utils.selectionFromRangeOrSelection = function ( doc, rangeOrSelection ) { return rangeOrSelection instanceof ve.Range ? - new ve.dm.LinearSelection( doc, rangeOrSelection ) : - ve.dm.Selection.static.newFromJSON( doc, rangeOrSelection ); + new ve.dm.LinearSelection( doc, rangeOrSelection ) : + ve.dm.Selection.static.newFromJSON( doc, rangeOrSelection ); }; /** -- To view, visit https://gerrit.wikimedia.org/r/362378 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I18e13186f34756ca9c75a6e64d7e78baa819c629 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Jforrester <jforres...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits