From: Eduardo San Martin Morote Date: Mon, 8 Mar 2021 13:01:31 +0000 (+0100) Subject: chore: remove old files X-Git-Tag: v2.0.0-alpha.8~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79a19d09867593426ccaf5edddf6615896ee8d96;p=thirdparty%2Fvuejs%2Fpinia.git chore: remove old files --- diff --git a/old test ssr/app.spec.ts b/old test ssr/app.spec.ts deleted file mode 100644 index feeff500..00000000 --- a/old test ssr/app.spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -import renderApp from './app/entry-server' -import { createRenderer } from 'vue-server-renderer' - -const renderer = createRenderer() - -// FIXME: add when ssr is available in vue 3 -describe.skip('classic vue app', () => { - it('renders using the store', async () => { - const context = { - rendered: () => {}, - } - const app = await renderApp(context) - - // @ts-ignore - const html = await renderer.renderToString(app) - expect(html).toMatchInlineSnapshot( - `"

Hi anon

Count: 1 x 2 = 2

"` - ) - }) - - it('resets the store', async () => { - const context = { - rendered: () => {}, - } - let app = await renderApp(context) - - // @ts-ignore - let html = await renderer.renderToString(app) - expect(html).toMatchInlineSnapshot( - `"

Hi anon

Count: 1 x 2 = 2

"` - ) - - // render again - app = await renderApp(context) - - // @ts-ignore - html = await renderer.renderToString(app) - expect(html).toMatchInlineSnapshot( - `"

Hi anon

Count: 1 x 2 = 2

"` - ) - }) -}) diff --git a/old test ssr/app/App.ts b/old test ssr/app/App.ts deleted file mode 100644 index 7900fe7b..00000000 --- a/old test ssr/app/App.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { defineComponent, computed } from 'vue' -import { useStore } from './store' - -export default defineComponent({ - setup() { - const store = useStore() - - const doubleCount = computed(() => store.state.counter * 2) - function increment() { - store.state.counter++ - } - - return { - doubleCount, - increment, - state: store.state, - } - }, - - template: ` -
-

Hi {{ state.name }}

-

Count: {{ state.counter }} x 2 = {{ doubleCount }}

- -
- `, -}) diff --git a/old test ssr/app/entry-server.ts b/old test ssr/app/entry-server.ts deleted file mode 100644 index 71190c17..00000000 --- a/old test ssr/app/entry-server.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { createApp } from './main' - -export default function(context: any) { - return new Promise(resolve => { - const { app, store } = createApp() - - // This `rendered` hook is called when the app has finished rendering - context.rendered = () => { - // After the app is rendered, our store is now - // filled with the state from our components. - // When we attach the state to the context, and the `template` option - // is used for the renderer, the state will automatically be - // serialized and injected into the HTML as `window.__INITIAL_STATE__`. - context.state = store.state - } - - resolve(app) - }) -} diff --git a/old test ssr/app/main.ts b/old test ssr/app/main.ts deleted file mode 100644 index dab1f199..00000000 --- a/old test ssr/app/main.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Vue from 'vue' -// import VueCompositionApi from '@vue/composition-api' -import App from './App' -import { useStore } from './store' -import { setActiveReq } from '../../../src' -import { createPinia } from '../../src' - -// Done in setup.ts -// Vue.use(VueCompositionApi) - -export function createApp() { - // create router and store instances - setActiveReq(createPinia()) - const store = useStore() - - store.state.counter++ - - // create the app instance, injecting both the router and the store - const app = new Vue({ - render: (h) => h(App), - }) - - // expose the app, the router and the store. - return { app, store } -} diff --git a/old test ssr/app/store.ts b/old test ssr/app/store.ts deleted file mode 100644 index 17fb95ab..00000000 --- a/old test ssr/app/store.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createStore } from '../../src' - -export const useStore = createStore({ - id: 'main', - state: () => ({ - counter: 0, - name: 'anon', - }), -})