mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
294db5e3ef
Objective: Simplify the registration and use of triggers Changes: * Renamed ve.Command to ve.Trigger * Renamed command demo to trigger demo * Removed language prefixing of triggers * Generating trigger tooltips rather than hard-coding them in i18n * Added documentation to clarify that only 'mac' and 'pc' are supported platforms, and how the default is chosen * Simplified trigger registry's register command * Updated trigger registrations Change-Id: Ibab6ad5b5c86f24707f064967dc2119a81125392
37 lines
794 B
JavaScript
37 lines
794 B
JavaScript
/*!
|
|
* VisualEditor Trigger tests.
|
|
*
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
QUnit.module( 've.Trigger' );
|
|
|
|
/* 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.Trigger( tests[i].trigger ).toString(),
|
|
tests[i].trigger,
|
|
'trigger is parsed correctly'
|
|
);
|
|
assert.equal(
|
|
new ve.Trigger( tests[i].event ).toString(),
|
|
tests[i].trigger,
|
|
'event is parsed correctly'
|
|
);
|
|
}
|
|
} );
|