Parcourir la source

add computed property ssr test case

Evan You il y a 10 ans
Parent
commit
6f7ec7f04d
1 fichiers modifiés avec 23 ajouts et 0 suppressions
  1. 23 0
      test/ssr/ssr-string.spec.js

+ 23 - 0
test/ssr/ssr-string.spec.js

@@ -173,6 +173,29 @@ describe('SSR: renderToString', () => {
     })
   })
 
+  it('computed properties', done => {
+    renderVmWithOptions({
+      template: '<div>{{ b }}</div>',
+      data: {
+        a: {
+          b: 1
+        }
+      },
+      computed: {
+        b () {
+          return this.a.b + 1
+        }
+      },
+      created () {
+        this.a.b = 2
+        expect(this.b).toBe(3)
+      }
+    }, result => {
+      expect(result).toContain('<div server-rendered="true">3</div>')
+      done()
+    })
+  })
+
   it('renders asynchronous component', done => {
     renderVmWithOptions({
       template: `