@@ -6,7 +6,7 @@ var scrape = require('../../../index');
66var testDirname = __dirname + '/.tmp' ;
77var mockDirname = __dirname + '/mocks' ;
88
9- describe ( 'Functional: html entities in url ' , function ( ) {
9+ describe ( 'Functional: html entities' , function ( ) {
1010
1111 beforeEach ( function ( ) {
1212 nock . cleanAll ( ) ;
@@ -27,7 +27,9 @@ describe('Functional: html entities in url', function() {
2727 // /fonts?family=Myriad&v=2 => /fonts?family=Myriad&v=2
2828 nock ( 'http://example.com/' ) . get ( '/fonts?family=Myriad&v=2' ) . reply ( 200 , 'fonts.css' , { 'content-type' : 'text/css' } ) ;
2929 // /?a=1&style-attr.png => /?a=1&style-attr.png
30- nock ( 'http://example.com/' ) . get ( '/style-attr.png?a=1&style-attr.png' ) . reply ( 200 , 'style-attr.png' , { 'content-type' : 'text/css' } ) ;
30+ nock ( 'http://example.com/' ) . get ( '/style-attr.png?a=1&style-attr.png' ) . reply ( 200 , 'style-attr.png' ) ;
31+ // "style-attr2.png" => style-attr2.png
32+ nock ( 'http://example.com/' ) . get ( '/style-attr2.png' ) . reply ( 200 , 'style-attr2.png' ) ;
3133 // /?a=1&b=2 => /?a=1&b=2
3234 nock ( 'http://example.com/' ) . get ( '/img.png?a=1&b=2' ) . reply ( 200 , 'img.png' ) ;
3335 // /test?b=2&c=3&d=4 => /test?b=2&c=3&d=4
@@ -56,10 +58,16 @@ describe('Functional: html entities in url', function() {
5658 fs . existsSync ( testDirname + '/local/fonts.css' ) . should . be . eql ( true ) ;
5759 should ( fs . readFileSync ( testDirname + '/local/fonts.css' ) . toString ( ) ) . be . eql ( 'fonts.css' ) ;
5860
59- should ( indexHtml ) . containEql ( 'background: url(\'local/style-attr.png\')' ) ;
61+ // single quote (') replaced with ' in attribute
62+ should ( indexHtml ) . containEql ( 'background: url('local/style-attr.png')' ) ;
6063 fs . existsSync ( testDirname + '/local/style-attr.png' ) . should . be . eql ( true ) ;
6164 should ( fs . readFileSync ( testDirname + '/local/style-attr.png' ) . toString ( ) ) . be . eql ( 'style-attr.png' ) ;
6265
66+ // double quote (") replaced with " in attribute
67+ should ( indexHtml ) . containEql ( 'background: url("local/style-attr2.png")' ) ;
68+ fs . existsSync ( testDirname + '/local/style-attr2.png' ) . should . be . eql ( true ) ;
69+ should ( fs . readFileSync ( testDirname + '/local/style-attr2.png' ) . toString ( ) ) . be . eql ( 'style-attr2.png' ) ;
70+
6371 should ( indexHtml ) . containEql ( 'img src="local/img.png' ) ;
6472 fs . existsSync ( testDirname + '/local/img.png' ) . should . be . eql ( true ) ;
6573 should ( fs . readFileSync ( testDirname + '/local/img.png' ) . toString ( ) ) . be . eql ( 'img.png' ) ;
0 commit comments