update tests

This commit is contained in:
Rich Harris
2018-09-30 11:32:58 -04:00
parent 2185f89669
commit 5573258a10
10 changed files with 39 additions and 40 deletions

View File

@@ -1,14 +1,12 @@
import { init, goto, prefetchRoutes } from '../../../runtime.js';
import { Store } from 'svelte/store.js';
import { manifest } from './manifest/client.js';
import * as sapper from './__sapper__/client.js';
window.init = () => {
return init({
return sapper.start({
target: document.querySelector('#sapper'),
manifest,
store: data => new Store(data)
});
};
window.prefetchRoutes = prefetchRoutes;
window.goto = goto;
window.prefetchRoutes = sapper.prefetchRoutes;
window.goto = sapper.goto;

View File

@@ -9,17 +9,9 @@
<button class='prefetch' on:click='prefetch("blog/why-the-name")'>Why the name?</button>
<script>
import { goto, prefetch } from '../../../../runtime.js';
import { prefetch } from '../__sapper__/client.js';
export default {
oncreate() {
window.goto = goto;
},
ondestroy() {
window.goto = null;
},
methods: {
prefetch
}

View File

@@ -2,9 +2,8 @@ import fs from 'fs';
import { resolve } from 'url';
import express from 'express';
import serve from 'serve-static';
import sapper from '../../../dist/middleware.js';
import { Store } from 'svelte/store.js';
import { manifest } from './manifest/server.js';
import * as sapper from './__sapper__/server.js';
let pending;
let ended;
@@ -92,8 +91,7 @@ const middlewares = [
next();
},
sapper({
manifest,
sapper.middleware({
store: (req, res) => {
return new Store({
title: `${req.hello} ${res.locals.name}`

View File

@@ -1,10 +1,10 @@
import { assets, shell, timestamp, routes } from './manifest/service-worker.js';
import { files, shell, timestamp, routes } from './__sapper__/service-worker.js';
const ASSETS = `cachetimestamp`;
// `shell` is an array of all the files generated by webpack,
// `assets` is an array of everything in the `assets` directory
const to_cache = shell.concat(assets);
const to_cache = shell.concat(files);
const cached = new Set(to_cache);
self.addEventListener('install', event => {