Evan You 10 лет назад
Родитель
Сommit
c29177fb60
2 измененных файлов с 21 добавлено и 1 удалено
  1. 1 1
      src/deprecations.js
  2. 20 0
      test/unit/specs/element-directives/partial_spec.js

+ 1 - 1
src/deprecations.js

@@ -159,7 +159,7 @@ if (process.env.NODE_ENV !== 'production') {
     },
 
     PARTIAL_NAME: function (id) {
-      wanr(
+      warn(
         '<partial name="' + id + '">: mustache interpolations inside attributes ' +
         'will be deprecated in 1.0.0. Use bind-name="expression" instead.'
       )

+ 20 - 0
test/unit/specs/element-directives/partial_spec.js

@@ -48,6 +48,26 @@ describe('Partial', function () {
     })
   })
 
+  it('dynamic (new syntax)', function (done) {
+    var vm = new Vue({
+      el: el,
+      template: '<partial bind-name="\'test-\' + id"></partial>',
+      data: {
+        id: 'a'
+      },
+      partials: {
+        'test-a': 'a {{id}}',
+        'test-b': 'b {{id}}'
+      }
+    })
+    expect(el.textContent).toBe('a a')
+    vm.id = 'b'
+    _.nextTick(function () {
+      expect(el.textContent).toBe('b b')
+      done()
+    })
+  })
+
   it('caching', function () {
     var calls = 0
     var compile = compiler.compile