Skip to content

Commit

Permalink
Add unit tests for the two functions used in the exports mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
gakimball committed Dec 19, 2014
1 parent 191fbc2 commit 9aada67
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ bower_components/*
node_modules/
npm-debug.log
/dist/*
/.sass-cache/*
.sass-cache/
/build/*
/tests/unit/scss/*.css*
3 changes: 0 additions & 3 deletions scss/helpers/_functions.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<<<<<<< HEAD
// Foundation for Apps ALPHA
// by ZURB
// foundation.zurb.com
Expand Down Expand Up @@ -46,10 +45,8 @@ $modules: () !default;
@mixin exports($name) {
// Check if the module has already been imported
@if not imported($name) {
@debug "#{$name} has not yet been imported.";
// Check if the module should be used
@if using($name) {
@debug "#{$name} is being used.";
$modules: append($modules, $name) !global;
@content;
}
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/scss/tests.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@

@include runner-start;

@include describe("Using") {
@include it("should check if a module is in use") {
$include-css: (
one: true,
two: false,
) !global;

@include should(expect(using(one)), to(be(true)));
@include should(expect(using(two)), to(be(false)));
}
}

@include describe("Imported") {
@include it("should check if a module has already been imported") {
$modules: () !global;

@include exports(test) {}

@include should(expect(imported(test)), to(be(true)));
@include should(expect(imported(testTwo)), to(be(false)));
}
}

@include describe("Map Serialize") {
@include it("should convert a Sass map into a JSON string") {
$input: (
Expand Down

0 comments on commit 9aada67

Please sign in to comment.