';
$lc = $( html ).localize().find( 'span' );
assert.strictEqual( $lc.attr( 'alt' ), 'Basic stuff', 'Attribute: alt-msg' );
// Attribute: placeholder-msg
html = '';
$lc = $( html ).localize().find( 'input' );
assert.strictEqual( $lc.attr( 'placeholder' ), 'Basic stuff', 'Attribute: placeholder-msg' );
} );
QUnit.test( 'Proper escaping', 2, function ( assert ) {
var html, $lc;
mw.messages.set( 'properfoo', '' );
// This is handled by jQuery inside $.fn.localize, just a simple sanity checked
// making sure it is actually using text() and attr() (or something with the same effect)
// Text escaping
html = '
';
$lc = $( html ).localize().find( 'span' );
assert.strictEqual( $lc.text(), mw.msg( 'properfoo' ), 'Content is inserted as text, not as html.' );
// Attribute escaping
html = '
';
$lc = $( html ).localize().find( 'span' );
assert.strictEqual( $lc.attr( 'title' ), mw.msg( 'properfoo' ), 'Attributes are not inserted raw.' );
} );
QUnit.test( 'Options', 7, function ( assert ) {
mw.messages.set( {
'foo-lorem': 'Lorem',
'foo-ipsum': 'Ipsum',
'foo-bar-title': 'Read more about bars',
'foo-bar-label': 'The Bars',
'foo-bazz-title': 'Read more about bazz at $1 (last modified: $2)',
'foo-bazz-label': 'The Bazz ($1)',
'foo-welcome': 'Welcome to $1! (last visit: $2)'
} );
var html, $lc, x, sitename = 'Wikipedia';
// Message key prefix
html = '