mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 20:14:39 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffd56e2a20 | ||
|
|
1e5a87cf71 | ||
|
|
281e183c61 | ||
|
|
e5d7d8ab2b | ||
|
|
d3e560325d | ||
|
|
64e5065aa5 |
@@ -1,5 +1,13 @@
|
|||||||
# sapper changelog
|
# sapper changelog
|
||||||
|
|
||||||
|
## 0.23.4
|
||||||
|
|
||||||
|
* Ignore empty anchors when exporting ([#491](https://github.com/sveltejs/sapper/pull/491))
|
||||||
|
|
||||||
|
## 0.23.3
|
||||||
|
|
||||||
|
* Clear `error` and `status` on successful render ([#477](https://github.com/sveltejs/sapper/pull/477))
|
||||||
|
|
||||||
## 0.23.2
|
## 0.23.2
|
||||||
|
|
||||||
* Fix entry point CSS ([#471](https://github.com/sveltejs/sapper/pull/471))
|
* Fix entry point CSS ([#471](https://github.com/sveltejs/sapper/pull/471))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.23.2",
|
"version": "0.23.4",
|
||||||
"description": "Military-grade apps, engineered by Svelte",
|
"description": "Military-grade apps, engineered by Svelte",
|
||||||
"bin": {
|
"bin": {
|
||||||
"sapper": "./sapper"
|
"sapper": "./sapper"
|
||||||
|
|||||||
@@ -187,6 +187,6 @@ async function _export({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_href(attrs: string) {
|
function get_href(attrs: string) {
|
||||||
const match = /href\s*=\s*(?:"(.+?)"|'(.+?)'|([^\s>]+))/.exec(attrs);
|
const match = /href\s*=\s*(?:"(.*?)"|'(.+?)'|([^\s>]+))/.exec(attrs);
|
||||||
return match[1] || match[2] || match[3];
|
return match[1] || match[2] || match[3];
|
||||||
}
|
}
|
||||||
@@ -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 = {
|
const data = {
|
||||||
path,
|
path,
|
||||||
preloading: false,
|
preloading: false,
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ export class AppRunner {
|
|||||||
start: () => this.page.evaluate(() => start()),
|
start: () => this.page.evaluate(() => start()),
|
||||||
prefetchRoutes: () => this.page.evaluate(() => prefetchRoutes()),
|
prefetchRoutes: () => this.page.evaluate(() => prefetchRoutes()),
|
||||||
prefetch: (href: string) => this.page.evaluate((href: string) => prefetch(href), href),
|
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
|
// helpers
|
||||||
let start: () => Promise<void>;
|
let start: () => Promise<void>;
|
||||||
let prefetchRoutes: () => Promise<void>;
|
let prefetchRoutes: () => Promise<void>;
|
||||||
|
let title: () => Promise<string>;
|
||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await build({ cwd: __dirname });
|
await build({ cwd: __dirname });
|
||||||
|
|
||||||
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
|
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());
|
after(() => runner.end());
|
||||||
@@ -110,4 +111,16 @@ describe('errors', function() {
|
|||||||
'oops'
|
'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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
<h1>Great success!</h1>
|
<h1>Great success!</h1>
|
||||||
|
|
||||||
<a href="blog">blog</a>
|
<a href="blog">blog</a>
|
||||||
|
<a href="">empty anchor</a>
|
||||||
Reference in New Issue
Block a user