@@ -6,7 +6,7 @@ var util = require('@src/lib/svg_text_utils');
6
6
describe ( 'svg+text utils' , function ( ) {
7
7
'use strict' ;
8
8
9
- describe ( 'convertToTspans should ' , function ( ) {
9
+ describe ( 'convertToTspans' , function ( ) {
10
10
11
11
function mockTextSVGElement ( txt ) {
12
12
return d3 . select ( 'body' )
@@ -60,7 +60,7 @@ describe('svg+text utils', function() {
60
60
d3 . select ( '#text' ) . remove ( ) ;
61
61
} ) ;
62
62
63
- it ( 'check for XSS attack in href' , function ( ) {
63
+ it ( 'checks for XSS attack in href' , function ( ) {
64
64
var node = mockTextSVGElement (
65
65
'<a href="javascript:alert(\'attack\')">XSS</a>'
66
66
) ;
@@ -70,7 +70,7 @@ describe('svg+text utils', function() {
70
70
assertAnchorLink ( node , null ) ;
71
71
} ) ;
72
72
73
- it ( 'check for XSS attack in href (with plenty of white spaces)' , function ( ) {
73
+ it ( 'checks for XSS attack in href (with plenty of white spaces)' , function ( ) {
74
74
var node = mockTextSVGElement (
75
75
'<a href = " javascript:alert(\'attack\')">XSS</a>'
76
76
) ;
@@ -80,7 +80,7 @@ describe('svg+text utils', function() {
80
80
assertAnchorLink ( node , null ) ;
81
81
} ) ;
82
82
83
- it ( 'whitelist relative hrefs (interpreted as http)' , function ( ) {
83
+ it ( 'whitelists relative hrefs (interpreted as http)' , function ( ) {
84
84
var node = mockTextSVGElement (
85
85
'<a href="/mylink">mylink</a>'
86
86
) ;
@@ -90,7 +90,7 @@ describe('svg+text utils', function() {
90
90
assertAnchorLink ( node , '/mylink' ) ;
91
91
} ) ;
92
92
93
- it ( 'whitelist http hrefs' , function ( ) {
93
+ it ( 'whitelists http hrefs' , function ( ) {
94
94
var node = mockTextSVGElement (
95
95
'<a href="http://bl.ocks.org/">bl.ocks.org</a>'
96
96
) ;
@@ -100,7 +100,7 @@ describe('svg+text utils', function() {
100
100
assertAnchorLink ( node , 'http://bl.ocks.org/' ) ;
101
101
} ) ;
102
102
103
- it ( 'whitelist https hrefs' , function ( ) {
103
+ it ( 'whitelists https hrefs' , function ( ) {
104
104
var node = mockTextSVGElement (
105
105
'<a href="https://plot.ly">plot.ly</a>'
106
106
) ;
@@ -110,7 +110,7 @@ describe('svg+text utils', function() {
110
110
assertAnchorLink ( node , 'https://plot.ly' ) ;
111
111
} ) ;
112
112
113
- it ( 'whitelist mailto hrefs' , function ( ) {
113
+ it ( 'whitelists mailto hrefs' , function ( ) {
114
114
var node = mockTextSVGElement (
115
115
'<a href="mailto:support@plot.ly">support</a>'
116
116
) ;
@@ -120,7 +120,7 @@ describe('svg+text utils', function() {
120
120
assertAnchorLink ( node , 'mailto:support@plot.ly' ) ;
121
121
} ) ;
122
122
123
- it ( 'wrap XSS attacks in href' , function ( ) {
123
+ it ( 'wraps XSS attacks in href' , function ( ) {
124
124
var textCases = [
125
125
'<a href="XSS\" onmouseover="alert(1)\" style="font-size:300px">Subtitle</a>' ,
126
126
'<a href="XSS" onmouseover="alert(1)" style="font-size:300px">Subtitle</a>'
@@ -135,7 +135,7 @@ describe('svg+text utils', function() {
135
135
} ) ;
136
136
} ) ;
137
137
138
- it ( 'should keep query parameters in href' , function ( ) {
138
+ it ( 'keeps query parameters in href' , function ( ) {
139
139
var textCases = [
140
140
'<a href="https://abc.com/myFeature.jsp?name=abc&pwd=def">abc.com?shared-key</a>' ,
141
141
'<a href="https://abc.com/myFeature.jsp?name=abc&pwd=def">abc.com?shared-key</a>'
@@ -150,7 +150,7 @@ describe('svg+text utils', function() {
150
150
} ) ;
151
151
} ) ;
152
152
153
- it ( 'allow basic spans' , function ( ) {
153
+ it ( 'allows basic spans' , function ( ) {
154
154
var node = mockTextSVGElement (
155
155
'<span>text</span>'
156
156
) ;
@@ -159,7 +159,7 @@ describe('svg+text utils', function() {
159
159
assertTspanStyle ( node , null ) ;
160
160
} ) ;
161
161
162
- it ( 'ignore unquoted styles in spans' , function ( ) {
162
+ it ( 'ignores unquoted styles in spans' , function ( ) {
163
163
var node = mockTextSVGElement (
164
164
'<span style=unquoted>text</span>'
165
165
) ;
@@ -168,7 +168,7 @@ describe('svg+text utils', function() {
168
168
assertTspanStyle ( node , null ) ;
169
169
} ) ;
170
170
171
- it ( 'allow quoted styles in spans' , function ( ) {
171
+ it ( 'allows quoted styles in spans' , function ( ) {
172
172
var node = mockTextSVGElement (
173
173
'<span style="quoted: yeah;">text</span>'
174
174
) ;
@@ -177,7 +177,7 @@ describe('svg+text utils', function() {
177
177
assertTspanStyle ( node , 'quoted: yeah;' ) ;
178
178
} ) ;
179
179
180
- it ( 'ignore extra stuff after span styles' , function ( ) {
180
+ it ( 'ignores extra stuff after span styles' , function ( ) {
181
181
var node = mockTextSVGElement (
182
182
'<span style="quoted: yeah;"disallowed: indeed;">text</span>'
183
183
) ;
@@ -195,7 +195,7 @@ describe('svg+text utils', function() {
195
195
assertTspanStyle ( node , 'quoted: yeah&\';;' ) ;
196
196
} ) ;
197
197
198
- it ( 'decode some HTML entities in text' , function ( ) {
198
+ it ( 'decodes some HTML entities in text' , function ( ) {
199
199
var node = mockTextSVGElement (
200
200
'100μ & < 10 > 0 ' +
201
201
'100 × 20 ± 0.5 °'
0 commit comments