Преглед на файлове

deprecate mustaches in partial name

Evan You преди 10 години
родител
ревизия
2c235d6518
променени са 3 файла, в които са добавени 3 реда и са изтрити 39 реда
  1. 0 7
      src/deprecations.js
  2. 2 11
      src/directives/element/partial.js
  3. 1 21
      test/unit/specs/directives/element/partial_spec.js

+ 0 - 7
src/deprecations.js

@@ -21,13 +21,6 @@ if (process.env.NODE_ENV !== 'production') {
         'Directives will no longer support multiple clause syntax in 1.0.0.' +
         newBindingSyntaxLink
       )
-    },
-
-    PARTIAL_NAME: function (id) {
-      warn(
-        '<partial name="' + id + '">: mustache interpolations inside attributes ' +
-        'will be deprecated in 1.0.0. Use bind-name="expression" instead.'
-      )
     }
 
   }

+ 2 - 11
src/directives/element/partial.js

@@ -13,17 +13,8 @@ module.exports = {
     _.replace(el, this.anchor)
     var id = el.getAttribute('name')
     if (id != null) {
-      var tokens = textParser.parse(id)
-      if (tokens) {
-        // dynamic partial
-        this.setupDynamic(textParser.tokensToExp(tokens))
-        if (process.env.NODE_ENV !== 'production') {
-          _.deprecation.PARTIAL_NAME(id)
-        }
-      } else {
-        // static partial
-        this.insert(id)
-      }
+      // static partial
+      this.insert(id)
     } else {
       id = el.getAttribute('bind-name')
       if (id) {

+ 1 - 21
test/unit/specs/directives/element/partial_spec.js

@@ -29,26 +29,6 @@ describe('Partial', function () {
   })
 
   it('dynamic', function (done) {
-    var vm = new Vue({
-      el: el,
-      template: '<partial 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('dynamic (new syntax)', function (done) {
     var vm = new Vue({
       el: el,
       template: '<partial bind-name="\'test-\' + id"></partial>',
@@ -100,7 +80,7 @@ describe('Partial', function () {
   it('teardown', function () {
     var vm = new Vue({
       el: el,
-      template: '<partial name="test-{{id}}"></partial>',
+      template: '<partial bind-name="\'test-\' + id"></partial>',
       data: {
         id: 'a'
       },