mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Merge "dm.Surface: Initialize selection at (1,1) instead of (0,0)"
This commit is contained in:
commit
17131a15e1
|
@ -21,7 +21,7 @@ ve.dm.Surface = function VeDmSurface( doc ) {
|
|||
// Properties
|
||||
this.documentModel = doc;
|
||||
this.metaList = new ve.dm.MetaList( this );
|
||||
this.selection = new ve.Range( 0, 0 );
|
||||
this.selection = new ve.Range( 1, 1 );
|
||||
this.selectedNodes = {};
|
||||
this.smallStack = [];
|
||||
this.bigStack = [];
|
||||
|
|
|
@ -51,11 +51,11 @@ QUnit.test( 'change', 3, function ( assert ) {
|
|||
events.change++;
|
||||
} );
|
||||
surface.change( tx );
|
||||
assert.deepEqual( events, { 'transact': 1, 'select': 0, 'change': 1 } );
|
||||
surface.change( null, new ve.Range( 1, 1 ) );
|
||||
assert.deepEqual( events, { 'transact': 1, 'select': 1, 'change': 2 } );
|
||||
surface.change( tx, new ve.Range( 2, 2 ) );
|
||||
assert.deepEqual( events, { 'transact': 2, 'select': 2, 'change': 3 } );
|
||||
assert.deepEqual( events, { 'transact': 1, 'select': 0, 'change': 1 }, 'transaction without selection' );
|
||||
surface.change( null, new ve.Range( 2, 2 ) );
|
||||
assert.deepEqual( events, { 'transact': 1, 'select': 1, 'change': 2 }, 'selection without transaction' );
|
||||
surface.change( tx, new ve.Range( 3, 3 ) );
|
||||
assert.deepEqual( events, { 'transact': 2, 'select': 2, 'change': 3 }, 'transaction and selection' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'breakpoint', 7, function ( assert ) {
|
||||
|
|
|
@ -16,7 +16,7 @@ QUnit.test( 'constructor', 8, function ( assert ) {
|
|||
// Default range and autoSelect
|
||||
assert.strictEqual( fragment.getSurface(), surface, 'surface reference is stored' );
|
||||
assert.strictEqual( fragment.getDocument(), doc, 'document reference is stored' );
|
||||
assert.deepEqual( fragment.getRange(), new ve.Range( 0, 0 ), 'range is taken from surface' );
|
||||
assert.deepEqual( fragment.getRange(), new ve.Range( 1, 1 ), 'range is taken from surface' );
|
||||
assert.strictEqual( fragment.willAutoSelect(), true, 'auto select by default' );
|
||||
assert.strictEqual( fragment.isNull(), false, 'valid fragment is not null' );
|
||||
// Invalid range and autoSelect
|
||||
|
|
Loading…
Reference in a new issue