Closed vincentorback closed 7 years ago
@vincentorback Thanks for the PR 😀
The output string will be the same but we can look ast tree and check the type of the value on that node.
var chai = require('chai');
var expect = chai.expect;
var postcss = require('postcss');
var cssvariables = require('postcss-css-variables');
var fs = require('fs');
var mycss = fs.readFileSync('input.css', 'utf8');
describe('postcss-css-variables', function() {
it('Should use string values for `undefined` values, see #22', function() {
return postcss([
cssvariables(/*options*/)
])
.process(mycss)
.then(function(result) {
var root = result.root;
var fooRule = root.nodes[0];
expect(fooRule.selector).to.equal('.foo');
var colorDecl = fooRule.nodes[0];
expect(colorDecl.value).to.be.a('string');
});
});
});
Updated with new undefined check + new comment! What was the extra whitespace you commented on?
@vincentorback You can expand the past dismissed comments.
Let's add in the test I mentioned earlier.
I added a test but I’m really new to mocha so take a look if I should change something.
After fixing up these last points, squash down the commits please
I think that’s it!
@vincentorback Thanks for sorting out the last bits. Will take a look soon 😀
@vincentorback This has been merged in and released in v0.6.0 and published on npm. Thanks again for the contribution :revolving_hearts:
Fix #22
This resolves the issues I was testing in #22 where an undefined variable broke other plugins by providing an
undefined
variable instead of a variable with the value of"undefined"
.Don’t really know what tests to add because the output will be the same in this plugin context. But if you have an idea I could add something! 👍