@@ -2,10 +2,11 @@ import { parseContent, updateConfig } from '../src/clipboard'
22import cloneDeep from 'lodash.clonedeep'
33import * as config from '../src/config'
44
5- describe ( 'Clipboard' , ( ) => {
6- describe ( 'parseContent()' , ( ) => {
5+ describe ( 'Clipboard' , function ( ) {
76
8- afterEach ( ( ) => {
7+ describe ( 'parseContent()' , function ( ) {
8+
9+ afterEach ( function ( ) {
910 updateConfig ( config )
1011 } )
1112
@@ -22,23 +23,23 @@ describe('Clipboard', () => {
2223 // Copy Elements
2324 // -------------
2425
25- it ( 'gets a plain text' , ( ) => {
26+ it ( 'gets a plain text' , function ( ) {
2627 expect ( extractSingleBlock ( 'a' ) ) . toEqual ( 'a' )
2728 } )
2829
29- it ( 'trims text' , ( ) => {
30+ it ( 'trims text' , function ( ) {
3031 expect ( extractSingleBlock ( ' a ' ) ) . toEqual ( 'a' )
3132 } )
3233
33- it ( 'keeps a <a> element with an href attribute with an absolute link' , ( ) => {
34+ it ( 'keeps a <a> element with an href attribute with an absolute link' , function ( ) {
3435 expect ( extractSingleBlock ( '<a href="http://link.com">a</a>' ) ) . toEqual ( '<a href="http://link.com">a</a>' )
3536 } )
3637
37- it ( 'keeps a <a> element with an href attribute with an relative link' , ( ) => {
38+ it ( 'keeps a <a> element with an href attribute with an relative link' , function ( ) {
3839 expect ( extractSingleBlock ( '<a href="/link/1337">a</a>' ) ) . toEqual ( '<a href="/link/1337">a</a>' )
3940 } )
4041
41- it ( 'keeps a <a> element with an a list of whitelisted-attributes' , ( ) => {
42+ it ( 'keeps a <a> element with an a list of whitelisted-attributes' , function ( ) {
4243 const updatedConfig = cloneDeep ( config )
4344 updatedConfig . pastedHtmlRules . allowedElements = { a : { href : true , rel : true , target : true } }
4445
@@ -50,7 +51,7 @@ describe('Clipboard', () => {
5051 ) . toEqual ( '<a target="_blank" rel="nofollow" href="/link/1337">a</a>' )
5152 } )
5253
53- it ( 'removes attributes that arent whitelisted for an <a> element ' , ( ) => {
54+ it ( 'removes attributes that arent whitelisted for an <a> element ' , function ( ) {
5455 const updatedConfig = cloneDeep ( config )
5556 updatedConfig . pastedHtmlRules . allowedElements = { a : { href : true } }
5657 updateConfig ( updatedConfig )
@@ -61,28 +62,28 @@ describe('Clipboard', () => {
6162 ) . toEqual ( '<a href="/link/1337">a</a>' )
6263 } )
6364
64- it ( 'keeps a <strong> element' , ( ) => {
65+ it ( 'keeps a <strong> element' , function ( ) {
6566 expect ( extractSingleBlock ( '<strong>a</strong>' ) ) . toEqual ( '<strong>a</strong>' )
6667 } )
6768
68- it ( 'keeps an <em> element' , ( ) => {
69+ it ( 'keeps an <em> element' , function ( ) {
6970 expect ( extractSingleBlock ( '<em>a</em>' ) ) . toEqual ( '<em>a</em>' )
7071 } )
7172
72- it ( 'keeps a <br> element' , ( ) => {
73+ it ( 'keeps a <br> element' , function ( ) {
7374 expect ( extractSingleBlock ( 'a<br>b' ) ) . toEqual ( 'a<br>b' )
7475 } )
7576
7677 // Split Blocks
7778 // ------------
7879
79- it ( 'creates two blocks from two paragraphs' , ( ) => {
80+ it ( 'creates two blocks from two paragraphs' , function ( ) {
8081 const blocks = extract ( '<p>a</p><p>b</p>' )
8182 expect ( blocks [ 0 ] ) . toEqual ( 'a' )
8283 expect ( blocks [ 1 ] ) . toEqual ( 'b' )
8384 } )
8485
85- it ( 'creates two blocks from an <h1> followed by an <h2>' , ( ) => {
86+ it ( 'creates two blocks from an <h1> followed by an <h2>' , function ( ) {
8687 const blocks = extract ( '<h1>a</h1><h2>b</h2>' )
8788 expect ( blocks [ 0 ] ) . toEqual ( 'a' )
8889 expect ( blocks [ 1 ] ) . toEqual ( 'b' )
@@ -91,74 +92,74 @@ describe('Clipboard', () => {
9192 // Clean Whitespace
9293 // ----------------
9394
94- var checkWhitespace = function ( a , b ) {
95+ function checkWhitespace ( a , b ) {
9596 expect ( escape ( extractSingleBlock ( a ) ) ) . toEqual ( escape ( b ) )
9697 }
9798
98- it ( 'replaces a single character' , ( ) => {
99+ it ( 'replaces a single character' , function ( ) {
99100 checkWhitespace ( 'a b' , 'a b' )
100101 } )
101102
102- it ( 'replaces a series of with alternating whitespace and ' , ( ) => {
103+ it ( 'replaces a series of with alternating whitespace and ' , function ( ) {
103104 checkWhitespace ( 'a b' , 'a \u00A0 \u00A0b' )
104105 } )
105106
106- it ( 'replaces a single character before a <span>' , ( ) => {
107+ it ( 'replaces a single character before a <span>' , function ( ) {
107108 checkWhitespace ( 'a <span>b</span>' , 'a b' )
108109 } )
109110
110- it ( 'collapses multiple whitespaces' , ( ) => {
111+ it ( 'collapses multiple whitespaces' , function ( ) {
111112 checkWhitespace ( 'A B C D' , 'A B C D' )
112113 } )
113114
114- it ( 'removes newlines' , ( ) => {
115+ it ( 'removes newlines' , function ( ) {
115116 checkWhitespace ( 'A\nB \n C' , 'A B C' )
116117 } )
117118
118119 // Remove Elements
119120 // ---------------
120121
121- it ( 'removes a <span> element' , ( ) => {
122+ it ( 'removes a <span> element' , function ( ) {
122123 expect ( extractSingleBlock ( '<span>a</span>' ) ) . toEqual ( 'a' )
123124 } )
124125
125- it ( 'removes an <a> element without an href attribute' , ( ) => {
126+ it ( 'removes an <a> element without an href attribute' , function ( ) {
126127 expect ( extractSingleBlock ( '<a>a</a>' ) ) . toEqual ( 'a' )
127128 } )
128129
129130
130- it ( 'removes an <a> element with an empty href attribute' , ( ) => {
131+ it ( 'removes an <a> element with an empty href attribute' , function ( ) {
131132 expect ( extractSingleBlock ( '<a href>a</a>' ) ) . toEqual ( 'a' )
132133 } )
133134
134- it ( 'removes an <a> element with an empty href attribute' , ( ) => {
135+ it ( 'removes an <a> element with an empty href attribute' , function ( ) {
135136 expect ( extractSingleBlock ( '<a href="">a</a>' ) ) . toEqual ( 'a' )
136137 } )
137138
138- it ( 'removes an empty <strong> element' , ( ) => {
139+ it ( 'removes an empty <strong> element' , function ( ) {
139140 expect ( extractSingleBlock ( '<strong></strong>' ) ) . toEqual ( undefined )
140141 } )
141142
142- it ( 'removes a <strong> element with only whitespace' , ( ) => {
143+ it ( 'removes a <strong> element with only whitespace' , function ( ) {
143144 expect ( extractSingleBlock ( '<strong> </strong>' ) ) . toEqual ( undefined )
144145 } )
145146
146- it ( 'removes an empty <strong> element but keeps its whitespace' , ( ) => {
147+ it ( 'removes an empty <strong> element but keeps its whitespace' , function ( ) {
147148 expect ( extractSingleBlock ( 'a<strong> </strong>b' ) ) . toEqual ( 'a b' )
148149 } )
149150
150- it ( 'removes an attribute from an <em> element' , ( ) => {
151+ it ( 'removes an attribute from an <em> element' , function ( ) {
151152 expect ( extractSingleBlock ( '<em data-something="x">a</em>' ) ) . toEqual ( '<em>a</em>' )
152153 } )
153154
154155 // Transform Elements
155156 // ------------------
156157
157- it ( 'transforms a <b> into a <strong>' , ( ) => {
158+ it ( 'transforms a <b> into a <strong>' , function ( ) {
158159 expect ( extractSingleBlock ( '<b>a</b>' ) ) . toEqual ( '<strong>a</strong>' )
159160 } )
160161
161- it ( 'changes absolute links to relative ones with the keepInternalRelativeLinks flag set to true' , ( ) => {
162+ it ( 'changes absolute links to relative ones with the keepInternalRelativeLinks flag set to true' , function ( ) {
162163 const updatedConfig = cloneDeep ( config )
163164 updatedConfig . pastedHtmlRules . keepInternalRelativeLinks = true
164165 updateConfig ( updatedConfig )
@@ -168,15 +169,15 @@ describe('Clipboard', () => {
168169 // Escape Content
169170 // --------------
170171
171- it ( 'escapes the string "<b>a</b>"' , ( ) => {
172+ it ( 'escapes the string "<b>a</b>"' , function ( ) {
172173 // append the string to test as text node so the browser escapes it.
173174 const div = document . createElement ( 'div' )
174175 div . appendChild ( document . createTextNode ( '<b>a</b>' ) )
175176
176177 expect ( parseContent ( div ) [ 0 ] ) . toEqual ( '<b>a</b>' )
177178 } )
178179
179- it ( 'removes blacklisted HTML elements (e.g. <style>)' , ( ) => {
180+ it ( 'removes blacklisted HTML elements (e.g. <style>)' , function ( ) {
180181 const div = document . createElement ( 'div' )
181182 div . innerHTML = `
182183 <style type="text/css">
0 commit comments