mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 11:35:28 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5d7d8ab2b | ||
|
|
d3e560325d | ||
|
|
64e5065aa5 |
@@ -1,5 +1,9 @@
|
||||
# sapper changelog
|
||||
|
||||
## 0.23.3
|
||||
|
||||
* Clear `error` and `status` on successful render ([#477](https://github.com/sveltejs/sapper/pull/477))
|
||||
|
||||
## 0.23.2
|
||||
|
||||
* Fix entry point CSS ([#471](https://github.com/sveltejs/sapper/pull/471))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sapper",
|
||||
"version": "0.23.2",
|
||||
"version": "0.23.3",
|
||||
"description": "Military-grade apps, engineered by Svelte",
|
||||
"bin": {
|
||||
"sapper": "./sapper"
|
||||
|
||||
@@ -310,7 +310,7 @@ export function prepare_page(target: Target): Promise<{
|
||||
};
|
||||
}
|
||||
|
||||
const props = { path, query };
|
||||
const props = { path, query, error: null, status: null };
|
||||
const data = {
|
||||
path,
|
||||
preloading: false,
|
||||
|
||||
@@ -58,7 +58,8 @@ export class AppRunner {
|
||||
start: () => this.page.evaluate(() => start()),
|
||||
prefetchRoutes: () => this.page.evaluate(() => prefetchRoutes()),
|
||||
prefetch: (href: string) => this.page.evaluate((href: string) => prefetch(href), href),
|
||||
goto: (href: string) => this.page.evaluate((href: string) => goto(href), href)
|
||||
goto: (href: string) => this.page.evaluate((href: string) => goto(href), href),
|
||||
title: () => this.page.$eval('h1', node => node.textContent)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
7
test/apps/errors/src/routes/enhance-your-calm.html
Normal file
7
test/apps/errors/src/routes/enhance-your-calm.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<script>
|
||||
export default {
|
||||
preload() {
|
||||
this.error(420, 'Enhance your calm');
|
||||
}
|
||||
};
|
||||
</script>
|
||||
3
test/apps/errors/src/routes/no-error.html
Normal file
3
test/apps/errors/src/routes/no-error.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>{error ? error.message : 'No error here'}</h1>
|
||||
|
||||
<a href="enhance-your-calm">Enhance your calm</a>
|
||||
@@ -14,13 +14,14 @@ describe('errors', function() {
|
||||
// helpers
|
||||
let start: () => Promise<void>;
|
||||
let prefetchRoutes: () => Promise<void>;
|
||||
let title: () => Promise<string>;
|
||||
|
||||
// hooks
|
||||
before(async () => {
|
||||
await build({ cwd: __dirname });
|
||||
|
||||
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
||||
({ base, page, start, prefetchRoutes } = await runner.start());
|
||||
({ base, page, start, prefetchRoutes, title } = await runner.start());
|
||||
});
|
||||
|
||||
after(() => runner.end());
|
||||
@@ -110,4 +111,16 @@ describe('errors', function() {
|
||||
'oops'
|
||||
);
|
||||
});
|
||||
|
||||
it('clears props.error on successful render', async () => {
|
||||
await page.goto(`${base}/no-error`);
|
||||
await start();
|
||||
await prefetchRoutes();
|
||||
|
||||
await page.click('[href="enhance-your-calm"]');
|
||||
assert.equal(await title(), '420');
|
||||
|
||||
await page.goBack();
|
||||
assert.equal(await title(), 'No error here');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user