Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from guardian/unit-tests
Browse files Browse the repository at this point in the history
Add unit tests using Bootcamp
  • Loading branch information
kaelig committed Feb 27, 2014
2 parents 9f1c82d + 1dc3471 commit 84f861a
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
bower_components
node_modules
results.css
.sass-cache
4 changes: 4 additions & 0 deletions 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.
49 changes: 49 additions & 0 deletions 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']);
};
14 changes: 10 additions & 4 deletions bower.json
@@ -1,8 +1,14 @@
{
"name": "guss-rem",
"version": "1.0.0",
"version": "1.1.0",
"main": "_rem.scss",
"ignore": [
"CHANGELOG.md"
]
}
"CHANGELOG.md",
"specs",
"Gruntfile.js",
"tests.scss"
],
"devDependencies": {
"bootcamp": "~1.1.4"
}
}
24 changes: 24 additions & 0 deletions 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) ) );
}
}
9 changes: 9 additions & 0 deletions 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;

0 comments on commit 84f861a

Please sign in to comment.