Skip to content

Commit

Permalink
fix(theme): correct path if no README in root folder
Browse files Browse the repository at this point in the history
fix #524
  • Loading branch information
vogloblinsky committed Apr 2, 2018
1 parent cd729b1 commit 78ceab3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/app/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ export class Application {
this.configuration.addPage({
name: 'index',
id: 'index',
context: 'overview'
context: 'overview',
depth: 0,
pageType: COMPODOC_DEFAULTS.PAGE_TYPES.ROOT
});
}
i++;
Expand Down
26 changes: 23 additions & 3 deletions test/src/cli/cli-generation-big-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ describe('CLI simple generation - big app', () => {

before(done => {
tmp.create(distFolder);
tmp.copy('./README.md', './README-tmp.md');
tmp.copy('./CHANGELOG.md', './CHANGELOG-tmp.md');
tmp.copy('./CONTRIBUTING.md', './CONTRIBUTING-tmp.md');

tmp.remove('./README.md');
tmp.remove('./CHANGELOG.md');
tmp.remove('./CONTRIBUTING.md');

let ls = shell('node', [
'./bin/index-cli.js',
'-p',
Expand All @@ -37,7 +45,15 @@ describe('CLI simple generation - big app', () => {
listComponentFile = read(`${distFolder}/components/ListComponent.html`);
done();
});
after(() => tmp.clean(distFolder));
after(() => {
tmp.clean(distFolder);
tmp.copy('./README-tmp.md', './README.md');
tmp.copy('./CHANGELOG-tmp.md', './CHANGELOG.md');
tmp.copy('./CONTRIBUTING-tmp.md', './CONTRIBUTING.md');
tmp.remove('./README-tmp.md');
tmp.remove('./CHANGELOG-tmp.md');
tmp.remove('./CONTRIBUTING-tmp.md');
});

it('should display generated message', () => {
expect(stdoutString).to.contain('Documentation generated');
Expand All @@ -53,8 +69,6 @@ describe('CLI simple generation - big app', () => {
expect(isIndexExists).to.be.true;
const isModulesExists = exists(distFolder + '/modules.html');
expect(isModulesExists).to.be.true;
const isOverviewExists = exists(distFolder + '/overview.html');
expect(isOverviewExists).to.be.true;
const isRoutesExists = exists(distFolder + '/routes.html');
expect(isRoutesExists).to.be.true;
});
Expand All @@ -70,6 +84,12 @@ describe('CLI simple generation - big app', () => {
expect(isFontsExists).to.be.true;
});

it('should add correct path to css', () => {
let index = read(`${distFolder}/index.html`);
expect(index).to.contain('href="./styles/style.css"');
});


/**
* Dynamic imports for metadatas
*/
Expand Down
1 change: 1 addition & 0 deletions test/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function temporaryDir() {

return {
name,
remove: remove,
copy(source, destination) {
fs.copySync(source, destination);
},
Expand Down

0 comments on commit 78ceab3

Please sign in to comment.