-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes pageUrlFormat: 'file' in static build (#2569)
* Fixes pageUrlFormat: 'file' in static build * Adds a changeset
- Loading branch information
Showing
5 changed files
with
49 additions
and
2 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,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes pageUrlFormat: 'file' in the static build |
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
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/static-build-page-url-format/src/pages/one.astro
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,4 @@ | ||
<html> | ||
<head><title>One</title></head> | ||
<body><h1>Testing</h1></body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/static-build-page-url-format/src/pages/sub/page.astro
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,4 @@ | ||
<html> | ||
<head><title>Subpath</title></head> | ||
<body><h1>Testing</h1></body> | ||
</html> |
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,34 @@ | ||
import { expect } from 'chai'; | ||
import cheerio from 'cheerio'; | ||
import { loadFixture } from './test-utils.js'; | ||
|
||
function addLeadingSlash(path) { | ||
return path.startsWith('/') ? path : '/' + path; | ||
} | ||
|
||
describe('Static build - pageUrlFormat: \'file\'', () => { | ||
let fixture; | ||
|
||
before(async () => { | ||
fixture = await loadFixture({ | ||
projectRoot: './fixtures/static-build-page-url-format/', | ||
renderers: [], | ||
buildOptions: { | ||
experimentalStaticBuild: true, | ||
site: 'http://example.com/subpath/', | ||
pageUrlFormat: 'file' | ||
}, | ||
}); | ||
await fixture.build(); | ||
}); | ||
|
||
it('Builds pages in root', async () => { | ||
const html = await fixture.readFile('/subpath/one.html'); | ||
expect(html).to.be.a('string'); | ||
}); | ||
|
||
it('Builds pages in subfolders', async () => { | ||
const html = await fixture.readFile('/subpath/sub/page.html'); | ||
expect(html).to.be.a('string'); | ||
}); | ||
}); |