Skip to content

Commit

Permalink
Merge pull request #33 from zoubin/patch-fix-inline-fallback-function
Browse files Browse the repository at this point in the history
bugfix:inline fallback function does not work
  • Loading branch information
MoOx committed Jun 18, 2015
2 parents ecf6c90 + f4393a7 commit a068127
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function processInline(from, dirname, urlMeta, to, options, decl) {

function processFallback() {
if (typeof fallback === "function") {
return processCustom(urlMeta, fallback, decl)
return processCustom(fallback, from, dirname, urlMeta, to, options, decl)
}
switch (fallback) {
case "copy":
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/inline-fallback-function.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: url(pixel.gif);
}
3 changes: 3 additions & 0 deletions test/fixtures/inline-fallback-function.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background: url(one);
}
14 changes: 14 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,17 @@ test("copy-when-inline-fallback", function(t) {

testCopy(t, opts, postcssOpts)
})

test("function-when-inline-fallback", function(t) {
var opts = {
url: "inline",
maxSize: 0,
fallback: function () {
return "one"
},
}

compareFixtures(t, "inline-fallback-function", "should respect the fallback function", opts, { from: "test/fixtures/index.css" })

t.end()
})

0 comments on commit a068127

Please sign in to comment.