Skip to content

Commit 20def90

Browse files
author
Evan You
committed
remove v-style and v-visible
1 parent 2e33033 commit 20def90

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

src/directives/index.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ module.exports = {
2121
this.el.innerHTML = utils.toText(value)
2222
},
2323

24-
visible: function (value) {
25-
this.el.style.visibility = value ? '' : 'hidden'
26-
},
27-
2824
show: function (value) {
2925
var el = this.el,
3026
target = value ? '' : 'none',
@@ -46,25 +42,6 @@ module.exports = {
4642
this.lastVal = value
4743
}
4844
}
49-
},
50-
51-
style: {
52-
bind: function () {
53-
this.arg = convertCSSProperty(this.arg)
54-
},
55-
update: function (value) {
56-
this.el.style[this.arg] = value
57-
}
5845
}
59-
}
6046

61-
/**
62-
* convert hyphen style CSS property to Camel style
63-
*/
64-
var CONVERT_RE = /-(.)/g
65-
function convertCSSProperty (prop) {
66-
if (prop.charAt(0) === '-') prop = prop.slice(1)
67-
return prop.replace(CONVERT_RE, function (m, char) {
68-
return char.toUpperCase()
69-
})
7047
}

test/unit/specs/directives.js

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,6 @@ describe('UNIT: Directives', function () {
7878

7979
})
8080

81-
describe('style', function () {
82-
83-
var dir = mockDirective('style')
84-
85-
it('should convert the arg from dash style to camel case', function () {
86-
dir.arg = 'font-family'
87-
dir.bind()
88-
assert.strictEqual(dir.arg, 'fontFamily')
89-
dir.arg = '-webkit-transform'
90-
dir.bind()
91-
assert.strictEqual(dir.arg, 'webkitTransform')
92-
})
93-
94-
it('should update the element style', function () {
95-
dir.update('rotate(20deg)')
96-
assert.strictEqual(dir.el.style.webkitTransform, 'rotate(20deg)')
97-
})
98-
99-
})
100-
10181
describe('show', function () {
10282

10383
var dir = mockDirective('show')
@@ -130,38 +110,6 @@ describe('UNIT: Directives', function () {
130110

131111
})
132112

133-
describe('visible', function () {
134-
135-
var dir = mockDirective('visible')
136-
137-
it('should be default value when value is truthy', function () {
138-
dir.update(1)
139-
assert.strictEqual(dir.el.style.visibility, '')
140-
dir.update('hi!')
141-
assert.strictEqual(dir.el.style.visibility, '')
142-
dir.update(true)
143-
assert.strictEqual(dir.el.style.visibility, '')
144-
dir.update({})
145-
assert.strictEqual(dir.el.style.visibility, '')
146-
dir.update(function () {})
147-
assert.strictEqual(dir.el.style.visibility, '')
148-
})
149-
150-
it('should be hidden when value is falsy', function () {
151-
dir.update(0)
152-
assert.strictEqual(dir.el.style.visibility, 'hidden')
153-
dir.update('')
154-
assert.strictEqual(dir.el.style.visibility, 'hidden')
155-
dir.update(false)
156-
assert.strictEqual(dir.el.style.visibility, 'hidden')
157-
dir.update(null)
158-
assert.strictEqual(dir.el.style.visibility, 'hidden')
159-
dir.update(undefined)
160-
assert.strictEqual(dir.el.style.visibility, 'hidden')
161-
})
162-
163-
})
164-
165113
describe('class', function () {
166114

167115
it('should set class to the value if it has no arg', function () {

0 commit comments

Comments
 (0)