Merge "dm.Surface: Initialize selection at (1,1) instead of (0,0)"

This commit is contained in:
jenkins-bot 2013-09-18 01:09:12 +00:00 committed by Gerrit Code Review
commit 17131a15e1
3 changed files with 7 additions and 7 deletions

View file

@ -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 = [];

View file

@ -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 ) {

View file

@ -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