File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,5 @@ function getSourcesPaths(text) {
2929 . value ( ) ;
3030}
3131
32+ module . exports . isEmbedded = isEmbedded ;
3233module . exports . getSourcesPaths = getSourcesPaths ;
Original file line number Diff line number Diff line change 1+ var css = require ( '../lib/utils/css' ) ;
2+
3+ var should = require ( 'should' )
4+ describe ( 'Css utils' , function ( ) {
5+ describe ( '#isEmbedded(src)' , function ( ) {
6+ it ( 'should return true if src is base64-encoded' , function ( ) {
7+ var base64_1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAA \
8+ ABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeN \
9+ Ge4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC' ;
10+ var base64_2 = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D' ;
11+ css . isEmbedded ( base64_1 ) . should . be . true ;
12+ css . isEmbedded ( base64_2 ) . should . be . true ;
13+ } ) ;
14+ it ( 'should return false if src is not base64-encoded' , function ( ) {
15+ var path = 'images/px/arrow-090-small.png' ;
16+ var url = 'https://www.google.com.ua/images/srpr/logo11w.png' ;
17+ css . isEmbedded ( path ) . should . be . false ;
18+ css . isEmbedded ( url ) . should . be . false ;
19+ } ) ;
20+ } ) ;
21+
22+
23+ } ) ;
You can’t perform that action at this time.
0 commit comments