Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a test for retina.less compilation output

  • Loading branch information...
commit 843da6cee3516bfbad4ccfa5c062451ee8b16ff2 1 parent d5944fe
Casey O'Hara authored
View
3  package.json
@@ -3,7 +3,8 @@
"version": "0.0.2",
"devDependencies": {
"mocha": "*",
- "should": "*"
+ "should": "*",
+ "less": "*"
},
"main": "./src/retina",
"scripts": {
View
9 test/fixtures/desired_output.css
@@ -0,0 +1,9 @@
+body {
+ background-image: url('/path/to/image.png');
+}
+@media all and (-webkit-min-device-pixel-ratio: 1.5) {
+ body {
+ background-image: url('/path/to/image@2x.png');
+ background-size: 200px 100px;
+ }
+}
View
6 test/fixtures/test.less
@@ -0,0 +1,6 @@
+@import 'src/retina';
+
+body {
+ .at2x('/path/to/image.png', 200px, 100px);
+}
+
View
17 test/retina_less.test.js
@@ -0,0 +1,17 @@
+var fs = require('fs');
+var less = require('less');
+
+describe('retina.less', function() {
+
+ describe('.at2x()', function(){
+ it('compiles correctly', function(done){
+ var desired_output = fs.readFileSync('test/fixtures/desired_output.css', 'utf8');
+ var input = fs.readFileSync('test/fixtures/test.less', 'utf8');
+ less.render(input, function (e, actual_output) {
+ actual_output.should.equal(desired_output);
+ done();
+ });
+ });
+ });
+
+});
Please sign in to comment.
Something went wrong with that request. Please try again.