mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 10:59:56 +00:00
ab57bed7da
The port of mousetrap wasn't really what we needed. This is much simpler, matches the rest of our code, and does exactly what we need. Change-Id: I67f413e097fc2d4078336edb14dd9440e771f196
37 lines
794 B
JavaScript
37 lines
794 B
JavaScript
/**
|
|
* VisualEditor Command tests.
|
|
*
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.Command' );
|
|
|
|
/* Tests */
|
|
|
|
QUnit.test( 'constructor', function ( assert ) {
|
|
function event( options ) {
|
|
return jQuery.Event( 'keydown', options );
|
|
}
|
|
var i, len,
|
|
tests = [
|
|
{
|
|
'trigger': 'ctrl+b',
|
|
'event': event( { 'ctrlKey': true, 'which': 66 } )
|
|
}
|
|
];
|
|
QUnit.expect( 2 * tests.length );
|
|
for ( i = 0, len = tests.length; i < len; i++ ) {
|
|
assert.equal(
|
|
new ve.Command( tests[i].trigger ).toString(),
|
|
tests[i].trigger,
|
|
'trigger is parsed correctly'
|
|
);
|
|
assert.equal(
|
|
new ve.Command( tests[i].event ).toString(),
|
|
tests[i].trigger,
|
|
'event is parsed correctly'
|
|
);
|
|
}
|
|
} );
|