Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
fix(theme-builder): theme builder should include core theme. (#26) (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusTG authored and devversion committed Feb 28, 2017
1 parent c3f98a9 commit cbfcb1e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
9 changes: 5 additions & 4 deletions lib/resolvers/LocalResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class LocalResolver {
this.resolveExtension(modules, 'js', jsModules),
this.resolveExtension(modules, 'css', jsModules, false),
this.resolveThemes(modules, sourceComponents),
this.resolveThemes(modules, sourceRoot),
this.resolvePattern('/*.+(layouts|layout-attributes).css', layoutModules, false),
this.resolveSCSS(modules, sourceRoot),
this.resolvePattern('/LICENSE', _package.module, false)
Expand All @@ -76,10 +77,10 @@ export class LocalResolver {
root: _package.root,
js: results[0],
css: results[1],
themes: results[2],
layout: results[3],
scss: results[4],
license: results[5][0]
themes: results[2].concat(results[3]),
layout: results[4],
scss: results[5],
license: results[6][0]
};
});
}
Expand Down
23 changes: 17 additions & 6 deletions tests/LocalResolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const merge = require('merge');

describe('Local Resolver', () => {

const tooltip = ['tooltip'];
const components = ['tooltip', 'core'];
const root = path.resolve('./tests/fixtures/local-resolver/');
const versionData = {
root: root,
Expand All @@ -15,7 +15,7 @@ describe('Local Resolver', () => {
};

it('should resolve the JS and CSS files', done => {
LocalResolver.resolve(tooltip, versionData).then(files => {
LocalResolver.resolve(components, versionData).then(files => {
reduceToFilenames(files);

expect(files.js).toContain('tooltip.js');
Expand All @@ -26,7 +26,7 @@ describe('Local Resolver', () => {
});

it('should not include themes in the CSS', done => {
LocalResolver.resolve(tooltip, versionData).then(files => {
LocalResolver.resolve(components, versionData).then(files => {
reduceToFilenames(files);

expect(files.css).not.toContain('tooltip-default-theme.css');
Expand All @@ -35,8 +35,9 @@ describe('Local Resolver', () => {
}, done.fail);
});


it('should have the themes separately', done => {
LocalResolver.resolve(tooltip, versionData).then(files => {
LocalResolver.resolve(components, versionData).then(files => {
reduceToFilenames(files);

expect(files.themes).toContain('tooltip-default-theme.scss');
Expand All @@ -45,8 +46,18 @@ describe('Local Resolver', () => {
}, done.fail);
});


it('should have core theme file', done => {
LocalResolver.resolve(components, versionData).then(files => {
reduceToFilenames(files);
expect(files.themes).toContain('core-theme.scss');

done();
}, done.fail);
});

it('should not pick up the minified files', done => {
LocalResolver.resolve(tooltip, versionData).then(files => {
LocalResolver.resolve(components, versionData).then(files => {
reduceToFilenames(files);

expect(files.js).not.toContain('tooltip.min.js');
Expand All @@ -59,7 +70,7 @@ describe('Local Resolver', () => {
it('should reject for an invalid file path', done => {
let versionDataCopy = merge({}, versionData, { module: './some/random/path/' });

LocalResolver.resolve(tooltip, versionDataCopy)
LocalResolver.resolve(components, versionDataCopy)
.then(() => done.fail(), done);
});

Expand Down
Empty file.

0 comments on commit cbfcb1e

Please sign in to comment.