describe 'jQuery'
describe 'puts()'
it 'should output selector when present'
object = { jquery: '1.3.2', selector: '.foo bar' }
puts(object).should.eql 'selector ".foo bar"'
end
it 'should output outerHTML otherwise'
puts($('
Foo
')).should.match(/
Foo<\/p>/i)
end
end
describe 'with elements'
it 'should output the outerHTML'
puts($('
Foo
').get(0)).should.match(/
Foo<\/p>/i)
end
end
describe 'with the document element'
it 'should output "jQuery(document)"'
puts($(document)).should.match(/jQuery\(document\)/i)
end
end
describe 'without parameters'
it 'should output "jQuery()"'
puts($()).should.match(/jQuery\(\)/i)
end
end
describe 'sandbox()'
before
dom = sandbox()
end
it 'should provide an empty DOM sandbox'
dom.prepend('test')
dom.should.have_text 'test'
end
end
describe 'element() / elements()'
it 'should alias jQuery'
element.should.be jQuery
elements.should.be jQuery
end
end
describe 'matchers'
before_each
html = '
\
\
test \
test \
'
elem = $(html)
end
it 'should fail with pretty print of element'
spec = mock_it(function() {
elem.should.not.have_tag 'label'
})
spec.should.have_failure_message(/