From 69a55f92ddb691d4897a20c755b85e91928336b2 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Wed, 26 Feb 2014 22:08:26 +0000 Subject: [PATCH 1/3] Add unit tests with Bootcamp --- .gitignore | 4 ++++ Gruntfile.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ bower.json | 7 +++++-- specs/rem.scss | 24 ++++++++++++++++++++++++ tests.scss | 9 +++++++++ 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 Gruntfile.js create mode 100644 specs/rem.scss create mode 100644 tests.scss 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/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..825fb1b 100644 --- a/bower.json +++ b/bower.json @@ -4,5 +4,8 @@ "main": "_rem.scss", "ignore": [ "CHANGELOG.md" - ] -} \ No newline at end of file + ], + "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 From cfdbc181e008257df0ebcc8940301aabd09fe25d Mon Sep 17 00:00:00 2001 From: Kaelig Date: Wed, 26 Feb 2014 22:26:32 +0000 Subject: [PATCH 2/3] Ignore test files in bower installs --- bower.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 825fb1b..52f67f2 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,10 @@ "version": "1.0.0", "main": "_rem.scss", "ignore": [ - "CHANGELOG.md" + "CHANGELOG.md", + "specs", + "Gruntfile.js", + "tests.scss" ], "devDependencies": { "bootcamp": "~1.1.4" From 1dc34719f9685162d0a8926cc2cd39d7621d4113 Mon Sep 17 00:00:00 2001 From: Kaelig Date: Wed, 26 Feb 2014 22:26:44 +0000 Subject: [PATCH 3/3] Bump version up --- CHANGELOG.md | 4 ++++ bower.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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/bower.json b/bower.json index 52f67f2..321b2a6 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "guss-rem", - "version": "1.0.0", + "version": "1.1.0", "main": "_rem.scss", "ignore": [ "CHANGELOG.md",