Skip to content

Commit 7b2501f

Browse files
committed
tidying up
1 parent d2b89a1 commit 7b2501f

File tree

9 files changed

+28
-27
lines changed

9 files changed

+28
-27
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ export default class Core {
2727
Core.localByDefault = localByDefault
2828
Core.extractImports = extractImports
2929
Core.scope = scope
30-
Core.defaultPlugins = [wip, css => console.log(css.toResult().css), localByDefault, extractImports, scope]
30+
Core.defaultPlugins = [wip, localByDefault, extractImports, scope]

src/wip.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ export default css => {
5353
}
5454
})
5555

56-
console.log(translations)
56+
/* If we have no translations, don't continue */
57+
if (!Object.keys(translations).length) return
58+
5759
/* Perform replacements */
5860
replaceSymbols(css, translations)
5961

test/test-cases.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Object.keys( pipelines ).forEach( dirname => {
1818
describe( dirname, () => {
1919
let testDir = path.join( __dirname, dirname )
2020
fs.readdirSync( testDir ).forEach( testCase => {
21-
if (testCase !== 'aliases') return
2221
if ( fs.existsSync( path.join( testDir, testCase, "source.css" ) ) ) {
2322
it( "should " + testCase.replace( /-/g, " " ), done => {
2423
let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
@@ -35,22 +34,22 @@ Object.keys( pipelines ).forEach( dirname => {
3534
} )
3635

3736
// special case for testing multiple sources
38-
//describe( 'multiple sources', () => {
39-
// let testDir = path.join( __dirname, 'test-cases' )
40-
// let testCase = 'multiple-sources';
41-
// let dirname = 'test-cases';
42-
// if ( fs.existsSync( path.join( testDir, testCase, "source1.css" ) ) ) {
43-
// it( "should " + testCase.replace( /-/g, " " ), done => {
44-
// let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
45-
// let loader = new FileSystemLoader( testDir, pipelines[dirname] )
46-
// let expectedTokens = JSON.parse( fs.readFileSync( path.join( testDir, testCase, "expected.json" ), "utf-8" ) )
47-
// loader.fetch( `${testCase}/source1.css`, "/" ).then( tokens1 => {
48-
// loader.fetch( `${testCase}/source2.css`, "/" ).then( tokens2 => {
49-
// assert.equal( loader.finalSource, expected )
50-
// const tokens = Object.assign({}, tokens1, tokens2);
51-
// assert.equal( JSON.stringify( tokens ), JSON.stringify( expectedTokens ) )
52-
// } ).then( done, done )
53-
// })
54-
// } );
55-
// }
56-
//} );
37+
describe( 'multiple sources', () => {
38+
let testDir = path.join( __dirname, 'test-cases' )
39+
let testCase = 'multiple-sources';
40+
let dirname = 'test-cases';
41+
if ( fs.existsSync( path.join( testDir, testCase, "source1.css" ) ) ) {
42+
it( "should " + testCase.replace( /-/g, " " ), done => {
43+
let expected = normalize( fs.readFileSync( path.join( testDir, testCase, "expected.css" ), "utf-8" ) )
44+
let loader = new FileSystemLoader( testDir, pipelines[dirname] )
45+
let expectedTokens = JSON.parse( fs.readFileSync( path.join( testDir, testCase, "expected.json" ), "utf-8" ) )
46+
loader.fetch( `${testCase}/source1.css`, "/" ).then( tokens1 => {
47+
loader.fetch( `${testCase}/source2.css`, "/" ).then( tokens2 => {
48+
assert.equal( loader.finalSource, expected )
49+
const tokens = Object.assign({}, tokens1, tokens2);
50+
assert.equal( JSON.stringify( tokens ), JSON.stringify( expectedTokens ) )
51+
} ).then( done, done )
52+
})
53+
} );
54+
}
55+
} );
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
._aliases_borders__dashed {
1+
._constants_borders__dashed {
22
border: 4px dashed;
33
}
44

55

6-
._aliases_source__foo {
6+
._constants_source__foo {
77
background: aquamarine;
88
border-color: red;
99
}
1010

1111
@media (max-width: 599px) {
12-
._aliases_source__foo {
12+
._constants_source__foo {
1313
background: white;
1414
}
1515
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"borders": "\"./borders.css\"",
33
"breakpoints": "\"./breakpoints.css\"",
4-
"foo": "_aliases_source__foo _aliases_borders__dashed"
4+
"foo": "_constants_source__foo _constants_borders__dashed"
55
}

test/test-cases/aliases/source.css renamed to test/test-cases/constants/source.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@let borders: "./borders.css", breakpoints: "./breakpoints.css";
2-
@import small from breakpoints;
2+
@-import small from breakpoints;
33
@import secondary, primary as blue from "./colors.css";
44

55
.foo {

0 commit comments

Comments
 (0)