global.stub_out_jquery(); set_global('page_params', { development: true, }); var jsdom = require("jsdom"); global.document = jsdom.jsdom('

Hello world

'); var window = jsdom.jsdom().defaultView; global.$ = require('jquery')(window); zrequire('toMarkdown', 'node_modules/to-markdown/dist/to-markdown.js'); var copy_and_paste = zrequire('copy_and_paste'); (function test_paste_handler() { var input = ' love the Zulip Organization.'; assert.equal(copy_and_paste.paste_handler_converter(input), 'love the **Zulip****Organization**.'); input = 'The JSDOM constructor'; assert.equal(copy_and_paste.paste_handler_converter(input), 'The `JSDOM` constructor'); input = 'https://zulip.readthedocs.io/en/latest/subsystems/logging.html'; // TODO: for cases where one is just pasting a link, we'd prefer // that this not use markdown syntax, since that feels unnecessary. assert.equal(copy_and_paste.paste_handler_converter(input), '[https://zulip.readthedocs.io/en/latest/subsystems/logging.html](https://zulip.readthedocs.io/en/latest/subsystems/logging.html "https://zulip.readthedocs.io/en/latest/subsystems/logging.html")'); input = '
1. text'; // TODO: at minimum this should not be adding the '\\' before the '.', // and the ' \n' is a bit strange as well assert.equal(copy_and_paste.paste_handler_converter(input), ' \n1\\. text'); input = '

Zulip overview

'; assert.equal(copy_and_paste.paste_handler_converter(input), 'Zulip overview'); input = 'This text is italic'; assert.equal(copy_and_paste.paste_handler_converter(input), '*This text is italic*'); }());