Template for Testing with Jasmine

Drop in your code, drop in your Jasmine specs, and away you go! - includes jasmine jquery 2.0.5

by sidouglas

HTML

<script src="http://jasmine.simondouglas.com/jasmine.package.min.js"></script>

CSS

input, textarea{
    display:block;
}
div {
    white-space:pre;
}
body { overflow-y: scroll; }

.jasmine_html-reporter { background-color: #eeeeee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
.jasmine_html-reporter a { text-decoration: none; }
.jasmine_html-reporter a:hover { text-decoration: underline; }
.jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; }
.jasmine_html-reporter .banner, .jasmine_html-reporter .symbol-summary, .jasmine_html-reporter .summary, .jasmine_html-reporter .result-message, .jasmine_html-reporter .spec .description, .jasmine_html-reporter .spec-detail .description, .jasmine_html-reporter .alert .bar, .jasmine_html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; }
.jasmine_html-reporter .banner { position: relative; }
.jasmine_html-reporter .banner .title { background:...

JavaScript

//--- CODE --------------------------
var foo = 'bar';





//--- SPECS -------------------------
describe("foo", function() {

    var $input = $('<input type="text" name="testfield" value="10" id="testInput">');
	var $textArea = $('<textarea name="textarea" id="testTextArea">10</textarea>');
	console.log( 'typeof: $input.get(0)' + ' ' + typeof $input.get(0) );
    console.log( 'typeof: $input[0]' + ' ' + typeof $input[0] );
    console.log( 'typeof: $input[0].toString()' + ' ' + typeof $input[0].toString() );
    
	beforeEach(function(){
		var html =  $input[0] + $textArea[0];
        var ghtml =  $input[0] + $textArea[0];
        $('body').append(html);
        $('body').append(ghtml); 
        $('body').append(ghtml + html );
        $('body').append( $input[0] );
        $('body').append( $textArea[0] );
        $('body').append( $input[0] + '' + $textArea[0]);
        $('body').append( $input[0] + $textArea[0]);
        $('body').append( $input.get(0) + $textArea.get(0) );
        $('body').append( $input.get(0) + ' ' + $textArea.get(0) );
        $('body').append( $input.html() + $textArea.html() );
        $('body').append( $input[0].toString() + $textArea[0].toString() );
        $('body').append( ($input[0].toString()) + ($textArea[0].toString()) );
        $('body').append( ($input.get(0).toString()) + ($textArea.get(0).toString()) );
        $('body').append( ($input.get(0).toString()) + ' ' + ($textArea.get(0).toString()) );
      
        
		setFixtures( html );
	});  
    
  it("has a value of bar", function() {
    expect(foo).toBe('bar');
  });
});