From: Jakub Pawlowicz Date: Tue, 18 Aug 2015 06:11:35 +0000 (+0100) Subject: Adds a test for inlining content with protocol-less URLs. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=96ef2654325a2949af7f376ba552caa3f8a31af4;p=clean-css.git Adds a test for inlining content with protocol-less URLs. This refers to #632, but just confirms we do the right thing. --- diff --git a/test/protocol-imports-test.js b/test/protocol-imports-test.js index 64e1854d..d20cf959 100644 --- a/test/protocol-imports-test.js +++ b/test/protocol-imports-test.js @@ -352,6 +352,25 @@ vows.describe('protocol imports').addBatch({ nock.cleanAll(); } }, + 'of a resource with a protocol and absolute URL without a protocol': { + topic: function () { + this.reqMocks = nock('http://127.0.0.1') + .get('/no-protocol.css') + .reply(200, 'a{background:url(//127.0.0.1/image.png)}'); + + new CleanCSS().minify('@import url(http://127.0.0.1/no-protocol.css);', this.callback); + }, + 'should not raise errors': function (errors, minified) { + assert.isNull(errors); + }, + 'should process @import': function (errors, minified) { + assert.equal(minified.styles, 'a{background:url(//127.0.0.1/image.png)}'); + }, + teardown: function () { + assert.isTrue(this.reqMocks.isDone()); + nock.cleanAll(); + } + }, 'of a resource without protocol with rebase to another domain': { topic: function () { this.reqMocks = nock('http://127.0.0.1')