123456789101112131415161718192021222324252627282930313233343536373839 |
- $ = jQuery = require('jquery');
- require('jquery-ui-1-11-4');
- global.checkLocalStorage = () => {};
- global.iterateRecursiveReplaceHtmlSpecialChars = () => {};
- global.document.execCommand = function execCommandMock(text1, bool, text2) {
- document.body.innerText = text2;
- };
- const qvitter = require('./qvitter');
- const miscFunctions = require('./misc-functions');
- const stripHtmlFromPaste = qvitter.__get__('stripHtmlFromPaste');
- global.replaceHtmlSpecialChars = miscFunctions.__get__('replaceHtmlSpecialChars');
- describe('stripHtmlFromPaste', () => {
-
- class ClipboardEventMock {
- constructor(data) {
- class DataTransfer {
- constructor(data) {
- }
- getData(mimeType) {
- return data;
- }
- }
- this.clipboardData = new DataTransfer(data);
- }
- preventDefault() {}
- }
- it('has empty background-image URL.', () => {
- const e = new ClipboardEventMock(' hello ');
- stripHtmlFromPaste(e);
- expect(document.body.innerText).toBe(' hello ');
- });
- });
|