mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-12 14:35:28 +00:00
cbb868577e
Change-Id: I5a553272c1faf1e83a5e8be8ecf7911a11ec27a8
40 lines
1,008 B
JavaScript
40 lines
1,008 B
JavaScript
module( 've.dm.Surface' );
|
|
|
|
ve.dm.SurfaceStub = function() {
|
|
// Inheritance
|
|
this.dm = new ve.dm.Document ( [{ 'type': 'paragraph' }, 'hi', { 'type': '/paragraph' }] );
|
|
ve.dm.Surface.call( this, this.dm );
|
|
};
|
|
|
|
// Inheritance
|
|
|
|
ve.extendClass( ve.dm.SurfaceStub, ve.dm.Surface );
|
|
|
|
// Tests
|
|
|
|
test( 'getDocument', 1, function() {
|
|
var surface = new ve.dm.SurfaceStub();
|
|
strictEqual( surface.getDocument(), surface.documentModel );
|
|
} );
|
|
|
|
test( 'getSelection', 1, function() {
|
|
var surface = new ve.dm.SurfaceStub();
|
|
strictEqual( surface.getSelection(), surface.selection );
|
|
} );
|
|
|
|
test( 'setSelection', 1, function() {
|
|
var surface = new ve.dm.SurfaceStub();
|
|
surface.on( 'select', function() {
|
|
ok( true, 'select was emitted' );
|
|
} );
|
|
surface.setSelection( new ve.Range( 1, 1 ) );
|
|
} );
|
|
|
|
test( 'transact', 1, function() {
|
|
var surface = new ve.dm.SurfaceStub();
|
|
var tx = new ve.dm.Transaction();
|
|
surface.on( 'transact', function() {
|
|
ok( true, 'transact was emitted' );
|
|
} );
|
|
surface.transact( tx );
|
|
} ); |