Quellcode durchsuchen

fix unit test cleanup in IE9

Evan You vor 11 Jahren
Ursprung
Commit
8e9cbad2c3
2 geänderte Dateien mit 10 neuen und 9 gelöschten Zeilen
  1. 8 7
      test/unit/specs/utils.js
  2. 2 2
      test/unit/utils/prepare.js

+ 8 - 7
test/unit/specs/utils.js

@@ -1,7 +1,6 @@
-/* global cleanupMocks, appendMock */
+/* global cleanupMock, appendMock */
 
 describe('Utils', function () {
-    afterEach(cleanupMocks)
 
     var utils = require('vue/src/utils'),
         config = require('vue/src/config')
@@ -242,8 +241,6 @@ describe('Utils', function () {
     })
 
     describe('parseTemplateOption', function () {
-        
-        afterEach(cleanupMocks)
 
         it('should convert a string template to a documentFragment', function () {
             var template = '<div class="a">hi</div><p>ha</p>',
@@ -328,16 +325,20 @@ describe('Utils', function () {
 
     describe('processOptions', function () {
         
+        var el
+
         beforeEach(function() {
             var id = 'utils-template-to-fragment',
-                template = '<div class="a">hi</div><p>ha</p>',
-                el = document.createElement('template')
+                template = '<div class="a">hi</div><p>ha</p>'
+            el = document.createElement('template')
             el.id = id
             el.innerHTML = template
             appendMock(el)
         })
 
-        afterEach(cleanupMocks)
+        afterEach(function () {
+            cleanupMock(el)
+        })
 
         var options = {
             partials: {

+ 2 - 2
test/unit/utils/prepare.js

@@ -15,8 +15,8 @@ function appendMock(el) {
     document.getElementById('test').appendChild(el)
 }
 
-function cleanupMocks() {
-    document.getElementById('test').innerHTML = ''
+function cleanupMock(el) {
+    document.getElementById('test').removeChild(el)
 }
 
 function mockHTMLEvent (type) {