123456789101112131415161718192021222324252627282930 |
- /**
- * Created by Estevao on 27/01/2017.
- */
- var bootstrap = require('../bootstrap.js'),
- showdown = bootstrap.showdown,
- encoder = showdown.helper.encodeEmailAddress;
- describe('encodeEmailAddress', function () {
- 'use strict';
- var email = 'foobar@example.com',
- encodedEmail = encoder(email);
- it('should encode email', function () {
- encodedEmail.should.not.equal(email);
- });
- it('should decode to original email', function () {
- var decodedEmail = encodedEmail.replace(/&#(.+?);/g, function (wm, cc) {
- if (cc.charAt(0) === 'x') {
- //hex
- return String.fromCharCode('0' + cc);
- } else {
- //dec
- return String.fromCharCode(cc);
- }
- });
- decodedEmail.should.equal(email);
- });
- });
|