Skip to content

Commit

Permalink
fix unit test cleanup in IE9
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 29, 2014
1 parent cf37f7e commit 8e9cbad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions test/unit/specs/utils.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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>',
Expand Down Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/utils/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8e9cbad

Please sign in to comment.