Skip to content

Commit 7a4de5f

Browse files
committed
enteredView/leftView -> attached/detached
1 parent 11e1a25 commit 7a4de5f

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

src/compiler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var Emitter = require('./emitter'),
2020
hooks = [
2121
'created', 'ready',
2222
'beforeDestroy', 'afterDestroy',
23-
'enteredView', 'leftView'
23+
'attached', 'detached'
2424
]
2525

2626
/**

src/transition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var transition = module.exports = function (el, stage, cb, compiler) {
2323

2424
var changeState = function () {
2525
cb()
26-
compiler.execHook(stage > 0 ? 'enteredView' : 'leftView')
26+
compiler.execHook(stage > 0 ? 'attached' : 'detached')
2727
}
2828

2929
if (compiler.init) {

test/unit/specs/api.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,17 +788,17 @@ describe('UNIT: API', function () {
788788

789789
})
790790

791-
describe('enteredView', function () {
791+
describe('attached', function () {
792792

793793
it('should be called after enter view', function () {
794794
var called1 = false, called2 = false,
795795
test = new Vue({
796-
enteredView: function () {
796+
attached: function () {
797797
assert.strictEqual(this.$el.parentNode, document.getElementById('test'))
798798
called1 = true
799799
}
800800
})
801-
test.$on('hook:enteredView', function () {
801+
test.$on('hook:attached', function () {
802802
called2 = true
803803
})
804804
test.$appendTo('#test')
@@ -808,17 +808,17 @@ describe('UNIT: API', function () {
808808

809809
})
810810

811-
describe('leftView', function () {
811+
describe('detached', function () {
812812

813813
it('should be called after left view', function () {
814814
var called1 = false, called2 = false,
815815
test = new Vue({
816-
leftView: function () {
816+
detached: function () {
817817
assert.strictEqual(this.$el.parentNode, null)
818818
called1 = true
819819
}
820820
})
821-
test.$on('hook:leftView', function () {
821+
test.$on('hook:detached', function () {
822822
called2 = true
823823
})
824824
document.getElementById('test').appendChild(test.$el)

test/unit/specs/transition.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('UNIT: Transition', function () {
1616
var code = transition(null, 1, c.change, compiler)
1717
assert.ok(c.called)
1818
assert.strictEqual(code, codes.INIT)
19-
assert.ok(compiler.enteredView)
19+
assert.ok(compiler.attached)
2020
})
2121

2222
it('should skip if no transition is found on the node', function () {
@@ -25,7 +25,7 @@ describe('UNIT: Transition', function () {
2525
code = transition(mockEl(), 1, c.change, compiler)
2626
assert.ok(c.called)
2727
assert.strictEqual(code, codes.SKIP)
28-
assert.ok(compiler.enteredView)
28+
assert.ok(compiler.attached)
2929
})
3030

3131
})
@@ -40,7 +40,7 @@ describe('UNIT: Transition', function () {
4040
code = transition(mockEl('css'), 1, c.change, compiler)
4141
assert.ok(c.called)
4242
assert.strictEqual(code, codes.CSS_SKIP)
43-
assert.ok(compiler.enteredView)
43+
assert.ok(compiler.attached)
4444
})
4545

4646
// skip the rest
@@ -83,8 +83,8 @@ describe('UNIT: Transition', function () {
8383
assert.strictEqual(code, codes.CSS_E)
8484
})
8585

86-
it('should have called enteredView hook', function () {
87-
assert.ok(compiler.enteredView)
86+
it('should have called attached hook', function () {
87+
assert.ok(compiler.attached)
8888
})
8989

9090
})
@@ -125,8 +125,8 @@ describe('UNIT: Transition', function () {
125125
assert.strictEqual(code, codes.CSS_L)
126126
})
127127

128-
it('should have called leftView hook', function () {
129-
assert.ok(compiler.leftView)
128+
it('should have called detached hook', function () {
129+
assert.ok(compiler.detached)
130130
})
131131

132132
})
@@ -141,7 +141,7 @@ describe('UNIT: Transition', function () {
141141
code = transition(mockEl('js'), 1, c.change, compiler)
142142
assert.ok(c.called)
143143
assert.strictEqual(code, codes.JS_SKIP)
144-
assert.ok(compiler.enteredView)
144+
assert.ok(compiler.attached)
145145
})
146146

147147
it('should skip if the option is given but the enter/leave func is not defined', function () {
@@ -150,14 +150,14 @@ describe('UNIT: Transition', function () {
150150
code = transition(mockEl('js'), 1, c.change, compiler)
151151
assert.ok(c.called)
152152
assert.strictEqual(code, codes.JS_SKIP_E)
153-
assert.ok(compiler.enteredView)
153+
assert.ok(compiler.attached)
154154

155155
c = mockChange()
156156
compiler = mockCompiler({})
157157
code = transition(mockEl('js'), -1, c.change, compiler)
158158
assert.ok(c.called)
159159
assert.strictEqual(code, codes.JS_SKIP_L)
160-
assert.ok(compiler.leftView)
160+
assert.ok(compiler.detached)
161161
})
162162

163163
describe('enter', function () {
@@ -182,8 +182,8 @@ describe('UNIT: Transition', function () {
182182
assert.strictEqual(code, codes.JS_E)
183183
})
184184

185-
it('should have called enteredView hook', function () {
186-
assert.ok(compiler.enteredView)
185+
it('should have called attached hook', function () {
186+
assert.ok(compiler.attached)
187187
})
188188

189189
})
@@ -210,8 +210,8 @@ describe('UNIT: Transition', function () {
210210
assert.strictEqual(code, codes.JS_L)
211211
})
212212

213-
it('should have called leftView hook', function () {
214-
assert.ok(compiler.leftView)
213+
it('should have called detached hook', function () {
214+
assert.ok(compiler.detached)
215215
})
216216

217217
})

0 commit comments

Comments
 (0)