]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
chore: remove old files
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 Mar 2021 13:01:31 +0000 (14:01 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 8 Mar 2021 13:01:31 +0000 (14:01 +0100)
old test ssr/app.spec.ts [deleted file]
old test ssr/app/App.ts [deleted file]
old test ssr/app/entry-server.ts [deleted file]
old test ssr/app/main.ts [deleted file]
old test ssr/app/store.ts [deleted file]

diff --git a/old test ssr/app.spec.ts b/old test ssr/app.spec.ts
deleted file mode 100644 (file)
index feeff50..0000000
+++ /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(
-      `"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
-    )
-  })
-
-  it('resets the store', async () => {
-    const context = {
-      rendered: () => {},
-    }
-    let app = await renderApp(context)
-
-    // @ts-ignore
-    let html = await renderer.renderToString(app)
-    expect(html).toMatchInlineSnapshot(
-      `"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
-    )
-
-    // render again
-    app = await renderApp(context)
-
-    // @ts-ignore
-    html = await renderer.renderToString(app)
-    expect(html).toMatchInlineSnapshot(
-      `"<div data-server-rendered=\\"true\\"><h2>Hi anon</h2> <p>Count: 1 x 2 = 2</p> <button>Increment</button></div>"`
-    )
-  })
-})
diff --git a/old test ssr/app/App.ts b/old test ssr/app/App.ts
deleted file mode 100644 (file)
index 7900fe7..0000000
+++ /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: `
-  <div>
-    <h2>Hi {{ state.name }}</h2>
-    <p>Count: {{ state.counter }} x 2 = {{ doubleCount }}</p>
-    <button @click="increment">Increment</button>
-  </div>
-  `,
-})
diff --git a/old test ssr/app/entry-server.ts b/old test ssr/app/entry-server.ts
deleted file mode 100644 (file)
index 71190c1..0000000
+++ /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 (file)
index dab1f19..0000000
+++ /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 (file)
index 17fb95a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createStore } from '../../src'
-
-export const useStore = createStore({
-  id: 'main',
-  state: () => ({
-    counter: 0,
-    name: 'anon',
-  }),
-})