mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 11:15:14 +00:00
pass server request object to preload
This commit is contained in:
9
test/app/routes/show-url.html
Normal file
9
test/app/routes/show-url.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<p>URL is {{url}}</p>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
preload({ url }) {
|
||||
return { url };
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -267,6 +267,14 @@ function run(env) {
|
||||
'About this site'
|
||||
);
|
||||
});
|
||||
|
||||
it('passes entire request object to preload', async () => {
|
||||
const html = await nightmare
|
||||
.goto(`${base}/show-url`)
|
||||
.evaluate(() => document.querySelector('p').innerHTML);
|
||||
|
||||
assert.equal(html, `URL is /show-url`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user