Skip to content

Commit 8d4b2c8

Browse files
author
Hannu Pelkonen
committed
Fix issue when override mixin get replaced with the empty one. Add test case
1 parent e120b66 commit 8d4b2c8

File tree

8 files changed

+54
-12
lines changed

8 files changed

+54
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
// This file will be overwritten by styleguide:generate task if user specifies custom UI colors
22
// This file should always exists since it is importendin app.scss
3+
4+
@mixin styleguide_custom_styles {
5+
// User can re-define this mixin to create custom style overrides
6+
// This mixin is included in the end of the application stylesheet
7+
}

lib/app/sass/_styleguide_variables.scss

+1-6
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,4 @@ $header-height: 90px !default;
3636
$menu-height: 40px !default;
3737

3838
$content-max-width: 68em !default;
39-
$mobile: "screen and (max-width: 768px)" !default;
40-
41-
@mixin styleguide_custom_styles {
42-
// This mixin is included in the end of UI stylesheet
43-
// You can override any styleguide internal style here
44-
}
39+
$mobile: "screen and (max-width: 768px)" !default;

lib/app/sass/app.scss

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ $fa-font-path: '../assets/fonts';
22
@import 'components/font-awesome/font-awesome';
33
@import 'bourbon';
44

5-
@mixin styleguide_custom_styles {
6-
// User can re-define this mixin in styleguide_custom_variables to create custom style overrides
7-
// This mixin is included in the end of this file
8-
}
9-
105
@import 'styleguide_custom_variables';
116
@import 'styleguide_variables';
127
@import 'styleguide_mixins';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
var expect = require('chai').expect;
2+
3+
module.exports = (function() {
4+
5+
var file;
6+
7+
return {
8+
set: function(fileObj) {
9+
file = fileObj;
10+
},
11+
register: function() {
12+
it('should exist', function() {
13+
expect(file).to.be.an('object');
14+
});
15+
16+
it('should custom colors definition', function() {
17+
expect(file.contents.toString()).to.contain('$primary_color: #00FF00;');
18+
});
19+
}
20+
};
21+
22+
}());

test/integration/assertions.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ module.exports = {
55
atRules: require('./assert-at-rules'),
66
styleguideCss: require('./assert-styleguide-css'),
77
appCss: require('./assert-app-css'),
8-
styleguideJson: require('./assert-styleguide-json')
8+
styleguideJson: require('./assert-styleguide-json'),
9+
styleguideCustomVariables: require('./assert-styleguide-custom-variables')
910
};

test/integration/structure.test.js

+20
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,26 @@ describe('styleguide_at_rules.css', function() {
108108

109109
});
110110

111+
describe('sass/_styleguide_custom_variables.scss', function() {
112+
113+
assertions.styleguideCustomVariables.register();
114+
115+
before(function(done) {
116+
this.timeout(5000);
117+
var files = [];
118+
styleguideGenerateStream().pipe(
119+
through.obj(collector(files), function(callback) {
120+
console.log(files);
121+
var css = findFile(files, 'sass/_styleguide_custom_variables.scss');
122+
assertions.styleguideCustomVariables.set(css);
123+
callback();
124+
done();
125+
})
126+
);
127+
});
128+
129+
});
130+
111131
describe('overview.html', function() {
112132

113133
assertions.overviewHtml.register();

test/integration/test-config.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ module.exports = {
1010
],
1111
commonClass: ['custom-class-1', 'custom-class-2'],
1212
styleVariables: path.resolve(__dirname, '../projects/scss-project/source/styles/_styleguide_variables.scss'),
13+
customColors: path.resolve(__dirname, '../projects/scss-project/source/styles/custom_colors.scss'),
1314
filesConfig: []
1415
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Test custom color
2+
3+
$primary_color: #00FF00;

0 commit comments

Comments
 (0)