diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..053e45e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +bower_components +node_modules +results.css +.sass-cache \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c2edefd..0d78209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.1.0 (2014-02-26) + +- Unit testing with [Bootcamp](https://github.com/thejameskyle/bootcamp) + ## 1.0.0 (2013-12-13) Public release. diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..a53e0db --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,49 @@ +module.exports = function(grunt) { + + // Modules + grunt.loadNpmTasks('grunt-init'); + grunt.loadNpmTasks('grunt-contrib-sass'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('bootcamp'); + + // Grunt Tasks + grunt.initConfig({ + meta: { + version: '0.0.3' + }, + + // Sass + sass: { + test: { + options: { + style: 'expanded', + loadPath: './node_modules/bootcamp/dist' + }, + files: { + './results.css': './tests.scss' + } + } + }, + + // Bootcamp + bootcamp: { + test: { + files: { + src: ['./results.css'] + } + } + }, + + // Watch + watch: { + dist: { + files: ['./**/*.scss'], + tasks: ['sass', 'bootcamp'] + } + } + }); + + // Tasks + grunt.registerTask('default', ['sass', 'bootcamp', 'watch']); + grunt.registerTask('test', ['sass', 'bootcamp']); +}; diff --git a/bower.json b/bower.json index f82368d..321b2a6 100644 --- a/bower.json +++ b/bower.json @@ -1,8 +1,14 @@ { "name": "guss-rem", - "version": "1.0.0", + "version": "1.1.0", "main": "_rem.scss", "ignore": [ - "CHANGELOG.md" - ] -} \ No newline at end of file + "CHANGELOG.md", + "specs", + "Gruntfile.js", + "tests.scss" + ], + "devDependencies": { + "bootcamp": "~1.1.4" + } +} diff --git a/specs/rem.scss b/specs/rem.scss new file mode 100644 index 0000000..0e7b182 --- /dev/null +++ b/specs/rem.scss @@ -0,0 +1,24 @@ +@include describe("Remify") { + @include it("should convert pixel values into rems") { + @include should( expect( rem(10px) ), to( equal(1rem) ) ); + } + @include it("should keep non-pixel values as they are") { + @include should( expect( rem(10vh) ), to( equal(10vh) ) ); + } + @include it("should simplify values that do not need a unit") { + @include should( expect( rem(0px) ), to( equal(0) ) ); + } + @include it("should convert multiple values") { + @include should( expect( rem(10px 20px 0 0px 3vh 55px) ), to( equal(1rem 2rem 0 0 3vh 5.5rem) ) ); + } + @include it("should keep keywords in the output") { + @include should( expect( rem(10px solid white) ), to( equal(1rem solid white) ) ); + } + @include it("should honour important declarations") { + @include should( expect( rem(10px !important) ), to( contain("!important") ) ); + } + @include it("should honour a different rem scale") { + $guss-rem-baseline: 20px !global; + @include should( expect( rem(10px) ), to( equal(.5rem) ) ); + } +} diff --git a/tests.scss b/tests.scss new file mode 100644 index 0000000..29c4425 --- /dev/null +++ b/tests.scss @@ -0,0 +1,9 @@ +@import "rem"; + +@import "bootcamp"; +$bc-setting-verbose: false; +$bc-setting-warnings: false; + +@include runner-start; +@import "specs/rem"; +@include runner-end; \ No newline at end of file