Skip to content

Commit

Permalink
Implement test for method $.append with arrays parameters (testAppend…
Browse files Browse the repository at this point in the history
…WithArrayParams).
  • Loading branch information
caricati committed Apr 7, 2015
1 parent 1c62ed4 commit 241d49f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions test/zepto.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h1>Zepto Core unit tests</h1>
</ul>

<ul id="contentsTest">1<span>2</span><span id="contentsEmptyTest"></span></ul>

<iframe id="contentsIframeTest" src="fixtures/iframe_document.html"></iframe>

<ul id="siblingsTest">
Expand Down Expand Up @@ -290,7 +290,7 @@ <h1>Zepto Core unit tests</h1>
return html
})(node)
}

function testDocumentFragmentOrShadowRootContext($fragment, t) {
t.assertLength(1, $fragment)
t.assertEqual(Node.DOCUMENT_FRAGMENT_NODE, $fragment.get(0).nodeType)
Expand Down Expand Up @@ -947,11 +947,11 @@ <h1>Zepto Core unit tests</h1>
testDollarParseJSON: function(t) {
t.assertSame({a:'b'}, $.parseJSON('{"a":"b"}'))
},

testDollarWithDocumentFragmentContext: function(t){
testDocumentFragmentOrShadowRootContext($(document.createDocumentFragment()), t)
},

testDollarWithShadowRootContext: function(t){
if ('createShadowRoot' in document.body) {
var $subject = $('#test_dollar_with_shadow_root')
Expand Down Expand Up @@ -1251,7 +1251,7 @@ <h1>Zepto Core unit tests</h1>
t.assertLength(2, $contents.filter('span'))
t.assertLength(0, $("#contentsEmptyTest").contents())
},

testIframeContents: function(t){
var el = $("#contentsIframeTest")
t.assertEqual("Hello from iframe!", el.contents().find("b").first().text())
Expand Down Expand Up @@ -1881,12 +1881,12 @@ <h1>Zepto Core unit tests</h1>
el.removeAttr('data-name')
t.assertNull(el.attr('data-name'))
},

testRemoveMultipleAttr: function(t) {
var el = $('#attr_remove_multi')
t.assertEqual('someId1', el.attr('data-id'))
t.assertEqual('someName1', el.attr('data-name'))

el.removeAttr('data-id data-name')
t.assertNull(el.attr('data-id'))
t.assertNull(el.attr('data-name'))
Expand Down Expand Up @@ -2175,6 +2175,14 @@ <h1>Zepto Core unit tests</h1>
$.map(el.children(), function(c){ return $(c).text() }).join(' '))
},

testAppendWithArrayParams: function(t){
var node = document.createElement('b');
node.appendChild(document.createTextNode('four'))
var el = $('<div></div>')
el.append(['<b>one</b><b>two</b>', '<b>three</b>', node])
t.assertEqual('<b>one</b><b>two</b><b>three</b><b>four</b>', el.html())
},

testAppendToPrependTo: function(t){
// testing with Zepto object
function div(contents){
Expand Down

0 comments on commit 241d49f

Please sign in to comment.