mediawiki-extensions-Visual.../tests/ve2/dm/ve.dm.Surface.test.js
Trevor Parscal 1d74945dfc Fixes for Roan's crazy half-baked commit
Change-Id: Ic104debc3a941e4cf8e4dca19633dcad04a0fe0a
2012-05-04 16:13:54 -07:00

40 lines
989 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 );
});