This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from guardian/unit-tests
Add unit tests using Bootcamp
- Loading branch information
Showing
6 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bower_components | ||
node_modules | ||
results.css | ||
.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) ) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |