@@ -29,6 +29,27 @@ describe("loader", function() {
29
29
'module.exports = "Text <script src=\\"" + require("./script.js") + "\\"><img src=\\"" + require("./image.png") + "\\">";'
30
30
) ;
31
31
} ) ;
32
+ it ( "should handle srcset-attrubute by default" , function ( )
33
+ {
34
+ loader . call ( {
35
+ } , 'Text <img srcset="image.png 1x">' ) . should . be . eql (
36
+ 'module.exports = "Text <img srcset=\\"" + require("./image.png") + " 1x\\">";'
37
+ )
38
+ } ) ;
39
+ it ( "should handle srcset-attrubute with comma seperated list" , function ( )
40
+ {
41
+ loader . call ( {
42
+ } , 'Text <img srcset="image.png 1x,image@2x.png 2x">' ) . should . be . eql (
43
+ 'module.exports = "Text <img srcset=\\"" + require("./image.png") + " 1x,\" + require("./image@2x.png") + " 2x\\">";'
44
+ )
45
+ } ) ;
46
+ it ( "should handle srcset-attrubute with comma seperated list, independend of spaces in list" , function ( )
47
+ {
48
+ loader . call ( {
49
+ } , 'Text <img srcset="image.png 1x, image@2x.png 2x">' ) . should . be . eql (
50
+ 'module.exports = "Text <img srcset=\\"" + require("./image.png") + " 1x,\" + require("./image@2x.png") + " 2x\\">";'
51
+ )
52
+ } ) ;
32
53
it ( "should not make bad things with templates" , function ( ) {
33
54
loader . call ( { } , '<h3>#{number} {customer}</h3>\n<p> {title} </p>' ) . should . be . eql (
34
55
'module.exports = "<h3>#{number} {customer}</h3>\\n<p> {title} </p>";'
@@ -38,31 +59,31 @@ describe("loader", function() {
38
59
loader . call ( {
39
60
minimize : true
40
61
} , '<!-- comment --><h3 customAttr="">#{number} {customer}</h3>\n<p> {title} </p>\n\t <!-- comment --> <img src="image.png" />' ) . should . be . eql (
41
- 'module.exports = "<h3 customattr=\\"\\">#{number} {customer}</h3> <p> {title} </p> <img src=\\"\" + require("./image.png") + "\\\" />";'
62
+ 'module.exports = "<h3 customattr=\\"\\">#{number} {customer}</h3> <p> {title} </p> <img src=\" + require("./image.png") + \" />";'
42
63
) ;
43
64
} ) ;
44
65
// https://github.com/webpack/webpack/issues/752
45
66
it ( "should not remove attributes by default" , function ( ) {
46
67
loader . call ( {
47
68
minimize : true
48
69
} , '<input type="text" />' ) . should . be . eql (
49
- 'module.exports = "<input type=\\" text\\" />";'
70
+ 'module.exports = "<input type=text />";'
50
71
) ;
51
72
} ) ;
52
73
it ( "should preserve comments" , function ( ) {
53
74
loader . call ( {
54
75
minimize : true ,
55
76
query : "?-removeComments"
56
77
} , '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src="image.png" />' ) . should . be . eql (
57
- 'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=\\"\" + require("./image.png") + "\\\" />";'
78
+ 'module.exports = "<!-- comment --><h3 customattr=\\"\\">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src=\" + require("./image.png") + \" />";'
58
79
) ;
59
80
} ) ;
60
81
it ( "should treat attributes as case sensitive" , function ( ) {
61
82
loader . call ( {
62
83
minimize : true ,
63
84
query : "?caseSensitive"
64
85
} , '<!-- comment --><h3 customAttr="">#{number} {customer}</h3><p>{title}</p><!-- comment --><img src="image.png" />' ) . should . be . eql (
65
- 'module.exports = "<h3 customAttr=\\"\\">#{number} {customer}</h3><p>{title}</p><img src=\\"\" + require("./image.png") + "\\\" />";'
86
+ 'module.exports = "<h3 customAttr=\\"\\">#{number} {customer}</h3><p>{title}</p><img src=\" + require("./image.png") + \" />";'
66
87
) ;
67
88
} ) ;
68
89
it ( "should accept complex options via a webpack config property" , function ( ) {
0 commit comments