Skip to content

Commit

Permalink
fix #455
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Dec 28, 2020
1 parent 0277991 commit e30bbb1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Build Greenwood With: ', function() {
});
});

describe('Describe Nested Page', function() {
describe('Describe Page page', function() {
let dom;

beforeEach(async function() {
Expand Down Expand Up @@ -133,6 +133,41 @@ describe('Build Greenwood With: ', function() {
});
});

describe('Describe a page with index in the route filename', function() {
let pluginIndexPageDom;
let pluginHooksIndexPageDom;

beforeEach(async function() {
pluginIndexPageDom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'plugins/index.html'));
pluginHooksIndexPageDom = await JSDOM.fromFile(path.resolve(this.context.publicDir, 'plugins/index-hooks/index.html'));
});

it('should output an index.html file for the plugins index page', function() {
expect(fs.existsSync(path.join(this.context.publicDir, 'plugins', 'index.html'))).to.be.true;
});

it('should output an index.html file for the plugins page with index in the filename', function() {
expect(fs.existsSync(path.join(this.context.publicDir, 'plugins/index-hooks', 'index.html'))).to.be.true;
});

it('should have the expected content in the <body> of the plugins page index.html', function() {
const h2 = pluginIndexPageDom.window.document.querySelector('body h2');
const p = pluginIndexPageDom.window.document.querySelector('body p');

expect(h2.textContent).to.be.equal('Plugins');
expect(p.textContent).to.be.equal('Lorum Ipsum');
});

// TODO - https://github.com/ProjectEvergreen/greenwood/issues/456
xit('should have the expected content in the <body> of the plugins hook index.html with index in the route name', function() {
const h2 = pluginHooksIndexPageDom.window.document.querySelector('body h2');
const p = pluginHooksIndexPageDom.window.document.querySelector('body p');

expect(h2.textContent).to.be.equal('Index Hooks');
expect(p.textContent).to.be.equal('Some more Lorum Ipsum.');
});
});

});

after(function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Index Hooks

Some more Lorum Ipsum.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Plugins

Lorum Ipsum

0 comments on commit e30bbb1

Please sign in to comment.