@@ -115,6 +115,31 @@ describe('gulp-css-base64', function () {
115
115
} ) ;
116
116
} ) ;
117
117
118
+ it ( 'should convert url() content with questionmark at end even if extensionsAllowed is passed' , function ( done ) {
119
+ // create the fake file
120
+ var fakeFile = new gutil . File ( {
121
+ contents : new Buffer ( '.button_alert{background:url(\'test/fixtures/image/very-very-small.png?awesomeQuestionmark\') no-repeat 4px 5px;padding-left:12px;font-size:12px;color:#888;text-decoration:underline}' )
122
+ } ) ;
123
+
124
+ // Create a css-base64 plugin stream
125
+ var stream = base64 ( {
126
+ extensionsAllowed : [ '.gif' , '.jpg' , '.png' ]
127
+ } ) ;
128
+
129
+ // write the fake file to it
130
+ stream . write ( fakeFile ) ;
131
+
132
+ // wait for the file to come back out
133
+ stream . once ( 'data' , function ( file ) {
134
+ // make sure it came out the same way it went in
135
+ assert ( file . isBuffer ( ) ) ;
136
+
137
+ // check the contents
138
+ assert . equal ( file . contents . toString ( 'utf8' ) , '.button_alert{background:url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANAQAAAABakNnRAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAArSURBVAjXY/j/g2H/C4b5Jxj6OxgaOEBoxgmGDg8GIACyuRoYjkowfKgAACBpDLQ2kvRRAAAAAElFTkSuQmCC\') no-repeat 4px 5px;padding-left:12px;font-size:12px;color:#888;text-decoration:underline}' ) ;
139
+ done ( ) ;
140
+ } ) ;
141
+ } ) ;
142
+
118
143
it ( 'should convert url() content with hashtag at end' , function ( done ) {
119
144
// create the fake file
120
145
var fakeFile = new gutil . File ( {
@@ -138,6 +163,31 @@ describe('gulp-css-base64', function () {
138
163
} ) ;
139
164
} ) ;
140
165
166
+ it ( 'should convert url() content with hashtag at end even if extensionsAllowed is passed' , function ( done ) {
167
+ // create the fake file
168
+ var fakeFile = new gutil . File ( {
169
+ contents : new Buffer ( '.button_alert{background:url(\'test/fixtures/image/very-very-small.png#awesomeHashtag\') no-repeat 4px 5px;padding-left:12px;font-size:12px;color:#888;text-decoration:underline}' )
170
+ } ) ;
171
+
172
+ // Create a css-base64 plugin stream
173
+ var stream = base64 ( {
174
+ extensionsAllowed : [ '.gif' , '.jpg' , '.png' ]
175
+ } ) ;
176
+
177
+ // write the fake file to it
178
+ stream . write ( fakeFile ) ;
179
+
180
+ // wait for the file to come back out
181
+ stream . once ( 'data' , function ( file ) {
182
+ // make sure it came out the same way it went in
183
+ assert ( file . isBuffer ( ) ) ;
184
+
185
+ // check the contents
186
+ assert . equal ( file . contents . toString ( 'utf8' ) , '.button_alert{background:url(\'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANAQAAAABakNnRAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAAArSURBVAjXY/j/g2H/C4b5Jxj6OxgaOEBoxgmGDg8GIACyuRoYjkowfKgAACBpDLQ2kvRRAAAAAElFTkSuQmCC\') no-repeat 4px 5px;padding-left:12px;font-size:12px;color:#888;text-decoration:underline}' ) ;
187
+ done ( ) ;
188
+ } ) ;
189
+ } ) ;
190
+
141
191
it ( 'should ignore if image weight is greater than maxWeightResource default value' , function ( done ) {
142
192
// create the fake file
143
193
var fakeFile = new gutil . File ( {
0 commit comments