1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/* bender-tags: editor */
/* bender-ckeditor-plugins: link,button,htmlwriter,toolbar */
bender.editor = {
config: {
autoParagraph: false,
forceSimpleAmpersand: true,
emailProtection: 'encode'
}
};
var protectedMailLink = '<a href=\"javascript:void(location.href=\'mailto:\'+String.fromCharCode(106,111,98,64,99,107,115,111,117,114,99,101,46,99,111,109)' +
'+\'?subject=Job%20Request&body=I\\\'m%20looking%20for%20the%20AJD%20position.\')\">AJD</a>',
protectedMailLinkWithoutParams = '<a href=\"javascript:void(location.href=\'mailto:\'+' +
'String.fromCharCode(106,111,98,64,99,107,115,111,117,114,99,101,46,99,111,109))">AJD</a>';
bender.test( {
'test created protected mail link': function() {
var bot = this.editorBot;
bot.setHtmlWithSelection( '<a href="#">[AJD]</a>' );
bot.dialog( 'link', function( dialog ) {
var linkTypeField = dialog.getContentElement( 'info', 'linkType' ),
addressField = dialog.getContentElement( 'info', 'emailAddress' ),
subjectField = dialog.getContentElement( 'info', 'emailSubject' ),
bodyField = dialog.getContentElement( 'info', 'emailBody' );
linkTypeField.setValue( 'email' );
addressField.setValue( 'job@cksource.com' );
subjectField.setValue( 'Job Request' );
bodyField.setValue( 'I\'m looking for the AJD position.' );
dialog.fire( 'ok' );
dialog.hide();
assert.areSame( protectedMailLink, bot.getData( false, true ) );
} );
},
'test read from protected mail link': function() {
var bot = this.editorBot;
bot.setHtmlWithSelection( '[' + protectedMailLink + ']' );
bot.dialog( 'link', function( dialog ) {
var linkTypeField = dialog.getContentElement( 'info', 'linkType' ),
addressField = dialog.getContentElement( 'info', 'emailAddress' ),
subjectField = dialog.getContentElement( 'info', 'emailSubject' ),
bodyField = dialog.getContentElement( 'info', 'emailBody' );
assert.areEqual( 'email', linkTypeField.getValue() );
assert.areEqual( 'job@cksource.com', addressField.getValue() );
assert.areEqual( 'Job Request', subjectField.getValue() );
assert.areEqual( 'I\'m looking for the AJD position.', bodyField.getValue() );
dialog.fire( 'ok' );
dialog.hide();
} );
},
// https://dev.ckeditor.com/ticket/9192
'test read from protected mail link without subject and body provided': function() {
var bot = this.editorBot;
bot.setHtmlWithSelection( '[' + protectedMailLinkWithoutParams + ']' );
bot.dialog( 'link', function( dialog ) {
var linkTypeField = dialog.getContentElement( 'info', 'linkType' ),
addressField = dialog.getContentElement( 'info', 'emailAddress' ),
subjectField = dialog.getContentElement( 'info', 'emailSubject' ),
bodyField = dialog.getContentElement( 'info', 'emailBody' );
assert.areEqual( 'email', linkTypeField.getValue() );
assert.areEqual( 'job@cksource.com', addressField.getValue() );
assert.areEqual( '', subjectField.getValue() );
assert.areEqual( '', bodyField.getValue() );
dialog.fire( 'ok' );
dialog.hide();
} );
}
} );
|