Skip to content

Commit

Permalink
add few missing tests for collection returning self
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Nov 25, 2012
1 parent 4c67d17 commit be161c9
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions test/zepto.html
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ <h1>Zepto DOM unit tests</h1>
testOffset: function(t){
// TODO
t.assertNull($('#doesnotexist').offset())
var el = $('#some_element')
t.assertIdentical(el, el.offset({}))
},

testWidth: function(t){
Expand Down Expand Up @@ -1412,7 +1414,7 @@ <h1>Zepto DOM unit tests</h1>

testHtml: function(t){
var div = $('div.htmltest')
div.html('yowza')
t.assertIdentical(div, div.html('yowza'))

t.assertEqual('yowza', document.getElementById('htmltest1').innerHTML)
t.assertEqual('yowza', document.getElementById('htmltest2').innerHTML)
Expand Down Expand Up @@ -1944,31 +1946,12 @@ <h1>Zepto DOM unit tests</h1>
}
},

testRemove: function (t) {
var newElement1 = $('<div id="some_new_element_1" />')

newElement1
.appendTo('body')
.remove()

t.assertEqual( $('#some_new_element_1').length, 0 )

//

var newElement2 = $('<div id="some_new_element_2" />'),
errorRaised = false

newElement2.appendTo('body')

$('#some_new_element_2').remove()

try {
newElement2.remove()
} catch (e) {
errorRaised = true
}

t.assert(!errorRaised)
testRemove: function(t) {
var el = $('<div>').appendTo(document.body)
t.assertLength(1, el.parent())
t.assertIdentical(el, el.remove())
t.assertLength(0, el.parent())
t.assertIdentical(el, el.remove()) //=> ensure an error isn't raised
},

testAddRemoveClass: function(t){
Expand Down

0 comments on commit be161c9

Please sign in to comment.