mediawiki-extensions-Visual.../tests/ve2/dm/ve.dm.Surface.test.js
Trevor Parscal cbb868577e Whitespace and syntax fixes
Change-Id: I5a553272c1faf1e83a5e8be8ecf7911a11ec27a8
2012-05-07 13:40:09 -07:00

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 );
} );