Skip to content

Commit

Permalink
Do not test on test-container
Browse files Browse the repository at this point in the history
Should test on child so clearing test-container removes all side effects
  • Loading branch information
jhchen committed Feb 9, 2015
1 parent 60d1eac commit 4585ecf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/lib/dom.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ class Wrapper
switch @node.nodeType
when dom.ELEMENT_NODE
@node.textContent = text
when dom.TEXT_NODE then @node.data = text
when dom.TEXT_NODE
@node.data = text
return this
else
switch @node.nodeType
Expand Down
20 changes: 4 additions & 16 deletions test/unit/lib/dom.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ describe('DOM', ->
)

describe('access', ->
beforeEach( ->
@container = $('#test-container').html('').get(0)
)

describe('child at offset', ->
beforeEach( ->
@container.innerHTML = Quill.Normalizer.stripWhitespace('
Expand Down Expand Up @@ -265,12 +261,12 @@ describe('DOM', ->

describe('get node length', ->
tests =
'element':
html: '<b>One</b>'
length: 3
'text':
html: 'One'
length: 3
'element':
html: '<b>One</b>'
length: 3
'many nodes':
html: '<i><b><i>A</i>B<u>C<s>D</s></u></i>'
length: 4
Expand Down Expand Up @@ -344,10 +340,6 @@ describe('DOM', ->
)

describe('merge', ->
beforeEach( ->
@container = $('#test-container').html('').get(0)
)

it('nodes', ->
@container.innerHTML = '<ul><li>One</li></ul><ul><li>Two</li></ul>'
dom(@container.firstChild).merge(@container.lastChild)
Expand Down Expand Up @@ -375,10 +367,6 @@ describe('DOM', ->
)

describe('split', ->
beforeEach( ->
@container = $('#test-container').html('').get(0)
)

describe('splitBefore()', ->
beforeEach( ->
@container.innerHTML = Quill.Normalizer.stripWhitespace('
Expand Down Expand Up @@ -754,4 +742,4 @@ describe('DOM', ->
expect(lineNode.id).toEqual('line-2')
)
)
)
)

0 comments on commit 4585ecf

Please sign in to comment.