diff --git a/mock.js b/mock.js index 47b3765ae..ef59179c6 100644 --- a/mock.js +++ b/mock.js @@ -28,17 +28,17 @@ }, 'vcard': { 'get': function (callback, jid) { - var firstname, lastname; + var fullname; if (!jid) { jid = 'dummy@localhost'; - firstname = 'Max'; - lastname = 'Mustermann'; + fullname = 'Max Mustermann' ; } else { - var name = jid.split('@')[0].replace('.', ' ').split(' '); - firstname = name[0].charAt(0).toUpperCase()+name[0].slice(1); - lastname = name[1].charAt(0).toUpperCase()+name[1].slice(1); + var name = jid.split('@')[0].replace(/\./g, ' ').split(' '); + var last = name.length-1; + name[0] = name[0].charAt(0).toUpperCase()+name[0].slice(1); + name[last] = name[last].charAt(0).toUpperCase()+name[last].slice(1); + fullname = name.join(' '); } - var fullname = firstname+' '+lastname; var vcard = $iq().c('vCard').c('FN').t(fullname); callback(vcard.tree()); } diff --git a/spec/MainSpec.js b/spec/MainSpec.js index 4e66bc980..367fe5cdf 100644 --- a/spec/MainSpec.js +++ b/spec/MainSpec.js @@ -128,7 +128,7 @@ spyOn(this.rosterview, 'render').andCallThrough(); spyOn(this.xmppstatus, 'sendPresence'); this.roster.create({ - jid: pend_names[0].replace(' ','.').toLowerCase() + '@localhost', + jid: pend_names[0].replace(/ /g,'.').toLowerCase() + '@localhost', subscription: 'none', ask: 'subscribe', fullname: pend_names[0], @@ -173,7 +173,7 @@ for (i=0; i