Evan You 12 лет назад
Родитель
Сommit
20def90219
2 измененных файлов с 0 добавлено и 75 удалено
  1. 0 23
      src/directives/index.js
  2. 0 52
      test/unit/specs/directives.js

+ 0 - 23
src/directives/index.js

@@ -21,10 +21,6 @@ module.exports = {
         this.el.innerHTML = utils.toText(value)
     },
 
-    visible: function (value) {
-        this.el.style.visibility = value ? '' : 'hidden'
-    },
-
     show: function (value) {
         var el = this.el,
             target = value ? '' : 'none',
@@ -46,25 +42,6 @@ module.exports = {
                 this.lastVal = value
             }
         }
-    },
-
-    style: {
-        bind: function () {
-            this.arg = convertCSSProperty(this.arg)
-        },
-        update: function (value) {
-            this.el.style[this.arg] = value
-        }
     }
-}
 
-/**
- *  convert hyphen style CSS property to Camel style
- */
-var CONVERT_RE = /-(.)/g
-function convertCSSProperty (prop) {
-    if (prop.charAt(0) === '-') prop = prop.slice(1)
-    return prop.replace(CONVERT_RE, function (m, char) {
-        return char.toUpperCase()
-    })
 }

+ 0 - 52
test/unit/specs/directives.js

@@ -78,26 +78,6 @@ describe('UNIT: Directives', function () {
 
     })
 
-    describe('style', function () {
-        
-        var dir = mockDirective('style')
-
-        it('should convert the arg from dash style to camel case', function () {
-            dir.arg = 'font-family'
-            dir.bind()
-            assert.strictEqual(dir.arg, 'fontFamily')
-            dir.arg = '-webkit-transform'
-            dir.bind()
-            assert.strictEqual(dir.arg, 'webkitTransform')
-        })
-
-        it('should update the element style', function () {
-            dir.update('rotate(20deg)')
-            assert.strictEqual(dir.el.style.webkitTransform, 'rotate(20deg)')
-        })
-
-    })
-
     describe('show', function () {
         
         var dir = mockDirective('show')
@@ -130,38 +110,6 @@ describe('UNIT: Directives', function () {
 
     })
 
-    describe('visible', function () {
-        
-        var dir = mockDirective('visible')
-
-        it('should be default value when value is truthy', function () {
-            dir.update(1)
-            assert.strictEqual(dir.el.style.visibility, '')
-            dir.update('hi!')
-            assert.strictEqual(dir.el.style.visibility, '')
-            dir.update(true)
-            assert.strictEqual(dir.el.style.visibility, '')
-            dir.update({})
-            assert.strictEqual(dir.el.style.visibility, '')
-            dir.update(function () {})
-            assert.strictEqual(dir.el.style.visibility, '')
-        })
-
-        it('should be hidden when value is falsy', function () {
-            dir.update(0)
-            assert.strictEqual(dir.el.style.visibility, 'hidden')
-            dir.update('')
-            assert.strictEqual(dir.el.style.visibility, 'hidden')
-            dir.update(false)
-            assert.strictEqual(dir.el.style.visibility, 'hidden')
-            dir.update(null)
-            assert.strictEqual(dir.el.style.visibility, 'hidden')
-            dir.update(undefined)
-            assert.strictEqual(dir.el.style.visibility, 'hidden')
-        })
-
-    })
-
     describe('class', function () {
 
         it('should set class to the value if it has no arg', function () {