-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-conventions): support conventional css pair, support alte…
…rnative file extentions
- Loading branch information
Showing
17 changed files
with
835 additions
and
272 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,76 @@ | ||
import { preprocessOptions } from '@aurelia/plugin-conventions'; | ||
import { assert } from '@aurelia/testing'; | ||
|
||
describe('preprocessOptions', function () { | ||
it('returns default options', function() { | ||
assert.deepEqual( | ||
preprocessOptions(), | ||
{ | ||
cssExtensions: ['.css', '.less', '.sass', '.scss', '.styl'], | ||
jsExtensions: ['.coffee', '.js', '.jsx', '.ts', '.tsx'], | ||
templateExtensions: ['.haml', '.html', '.jade', '.md', '.pug', '.slim', '.slm'], | ||
stringModuleWrap: undefined | ||
} | ||
); | ||
}); | ||
|
||
it('merges optional extensions', function() { | ||
assert.deepEqual( | ||
preprocessOptions({ | ||
cssExtensions: ['.css', '.some'], | ||
jsExtensions: ['.mjs'], | ||
templateExtensions: ['.markdown'] | ||
}), | ||
{ | ||
cssExtensions: ['.css', '.less', '.sass', '.scss', '.some', '.styl'], | ||
jsExtensions: ['.coffee', '.js', '.jsx', '.mjs', '.ts', '.tsx'], | ||
templateExtensions: ['.haml', '.html', '.jade', '.markdown', '.md', '.pug', '.slim', '.slm'], | ||
stringModuleWrap: undefined | ||
} | ||
); | ||
}); | ||
|
||
it('merges optional options', function() { | ||
const wrap = (id: string) => `text!${id}`; | ||
|
||
assert.deepEqual( | ||
preprocessOptions({ | ||
defaultShadowOptions: { mode: 'closed' }, | ||
stringModuleWrap: wrap, | ||
templateExtensions: ['.markdown'], | ||
useProcessedFilePairFilename: true, | ||
useCSSModule: false | ||
}), | ||
{ | ||
defaultShadowOptions: { mode: 'closed' }, | ||
cssExtensions: ['.css', '.less', '.sass', '.scss', '.styl'], | ||
jsExtensions: ['.coffee', '.js', '.jsx', '.ts', '.tsx'], | ||
templateExtensions: ['.haml', '.html', '.jade','.markdown', '.md', '.pug', '.slim', '.slm'], | ||
stringModuleWrap: wrap, | ||
useProcessedFilePairFilename: true | ||
} | ||
); | ||
}); | ||
|
||
it('merges optional options, turn off stringModuleWrap if uses CSSModule', function() { | ||
const wrap = (id: string) => `text!${id}`; | ||
|
||
assert.deepEqual( | ||
preprocessOptions({ | ||
cssExtensions: ['.some'], | ||
defaultShadowOptions: { mode: 'open' }, | ||
stringModuleWrap: wrap, | ||
useProcessedFilePairFilename: true, | ||
useCSSModule: true | ||
}), | ||
{ | ||
defaultShadowOptions: { mode: 'open' }, | ||
cssExtensions: ['.css', '.less', '.sass', '.scss', '.some', '.styl'], | ||
jsExtensions: ['.coffee', '.js', '.jsx', '.ts', '.tsx'], | ||
templateExtensions: ['.haml', '.html', '.jade', '.md', '.pug', '.slim', '.slm'], | ||
stringModuleWrap: undefined, | ||
useProcessedFilePairFilename: true | ||
} | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.