From f4393a7a463d7d503bf75c72df62e18c9c4b454b Mon Sep 17 00:00:00 2001 From: zoubin Date: Thu, 18 Jun 2015 17:06:22 +0800 Subject: [PATCH] bugfix:inline fallback function does not work --- index.js | 2 +- test/fixtures/inline-fallback-function.css | 3 +++ .../fixtures/inline-fallback-function.expected.css | 3 +++ test/index.js | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/inline-fallback-function.css create mode 100644 test/fixtures/inline-fallback-function.expected.css diff --git a/index.js b/index.js index ddbf84f..a121a79 100755 --- a/index.js +++ b/index.js @@ -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": diff --git a/test/fixtures/inline-fallback-function.css b/test/fixtures/inline-fallback-function.css new file mode 100644 index 0000000..1250337 --- /dev/null +++ b/test/fixtures/inline-fallback-function.css @@ -0,0 +1,3 @@ +body { + background: url(pixel.gif); +} diff --git a/test/fixtures/inline-fallback-function.expected.css b/test/fixtures/inline-fallback-function.expected.css new file mode 100644 index 0000000..34a4479 --- /dev/null +++ b/test/fixtures/inline-fallback-function.expected.css @@ -0,0 +1,3 @@ +body { + background: url(one); +} diff --git a/test/index.js b/test/index.js index a4e7284..3cadd36 100755 --- a/test/index.js +++ b/test/index.js @@ -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() +})