forked from laptou/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for loading markdown pages with spaces in the name (withastro#3379)
* Fix for loading markdown pages with spaces in the name * Adds a changeset
- Loading branch information
Showing
5 changed files
with
39 additions
and
9 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
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 |
---|---|---|
@@ -1,19 +1,46 @@ | ||
import { expect } from 'chai'; | ||
import * as cheerio from 'cheerio'; | ||
import { loadFixture } from './test-utils.js'; | ||
import { loadFixture, isWindows} from './test-utils.js'; | ||
|
||
describe('Pages', () => { | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ root: './fixtures/astro-pages/' }); | ||
fixture = await loadFixture({ root: './fixtures/astro pages/' }); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Can find page with "index" at the end file name', async () => { | ||
const html = await fixture.readFile('/posts/name-with-index/index.html'); | ||
const $ = cheerio.load(html); | ||
describe('Build', () => { | ||
before(async () => { | ||
await fixture.build(); | ||
}); | ||
|
||
expect($('h1').text()).to.equal('Name with index'); | ||
it('Can find page with "index" at the end file name', async () => { | ||
const html = await fixture.readFile('/posts/name-with-index/index.html'); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('h1').text()).to.equal('Name with index'); | ||
}); | ||
}); | ||
|
||
if(isWindows) return; | ||
|
||
describe('Development', () => { | ||
let devServer; | ||
|
||
before(async () => { | ||
devServer = await fixture.startDevServer(); | ||
}); | ||
|
||
after(async () => { | ||
await devServer.stop(); | ||
}); | ||
|
||
it('Is able to load md pages', async () => { | ||
const html = await fixture.fetch('/').then((res) => res.text()); | ||
const $ = cheerio.load(html); | ||
|
||
expect($('#testing').length).to.be.greaterThan(0); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
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 @@ | ||
# Testing |
File renamed without changes.