1+ // patch inDoc
2+ require ( '../../lib/indoc_patch' )
13var _ = require ( '../../../../src/util' )
24var Vue = require ( '../../../../src/vue' )
35
@@ -7,9 +9,14 @@ if (_.inBrowser) {
79 var el
810 beforeEach ( function ( ) {
911 el = document . createElement ( 'div' )
12+ document . body . appendChild ( el )
1013 spyOn ( _ , 'warn' )
1114 } )
1215
16+ afterEach ( function ( ) {
17+ document . body . removeChild ( el )
18+ } )
19+
1320 it ( 'static' , function ( ) {
1421 var vm = new Vue ( {
1522 el : el ,
@@ -248,15 +255,6 @@ if (_.inBrowser) {
248255 var spy1 = jasmine . createSpy ( 'enter' )
249256 var spy2 = jasmine . createSpy ( 'leave' )
250257 var next
251- // === IMPORTANT ===
252- // PhantomJS always returns false when calling
253- // Element.contains() on a comment node. This causes
254- // transitions to be skipped. Monkey patching here
255- // isn't ideal but does the job...
256- var inDoc = _ . inDoc
257- _ . inDoc = function ( ) {
258- return true
259- }
260258 var vm = new Vue ( {
261259 el : el ,
262260 data : {
@@ -289,8 +287,6 @@ if (_.inBrowser) {
289287 next ( )
290288 expect ( spy2 ) . toHaveBeenCalled ( )
291289 expect ( el . textContent ) . toBe ( 'BBB' )
292- // clean up
293- _ . inDoc = inDoc
294290 done ( )
295291 } )
296292 } )
@@ -299,10 +295,6 @@ if (_.inBrowser) {
299295 var spy1 = jasmine . createSpy ( 'enter' )
300296 var spy2 = jasmine . createSpy ( 'leave' )
301297 var next
302- var inDoc = _ . inDoc
303- _ . inDoc = function ( ) {
304- return true
305- }
306298 var vm = new Vue ( {
307299 el : el ,
308300 data : {
@@ -335,8 +327,6 @@ if (_.inBrowser) {
335327 next ( )
336328 expect ( spy2 ) . toHaveBeenCalled ( )
337329 expect ( el . textContent ) . toBe ( 'BBB' )
338- // clean up
339- _ . inDoc = inDoc
340330 done ( )
341331 } )
342332 } )
0 commit comments