JMVCTest = { APPLICATION_NAME : 'EJS', TEST_DESCRIPTION : 'This tests templating', perform_test : function() { new Test.Unit.Runner({ setup: function() { this.view = new EJS.Helpers({}); this.animals = ['sloth', 'bear', 'monkey']; }, teardown: function() { }, test_link_to: function() { with(this) { assertEqual( "hello world", this.view.link_to('hello world', '/something/here' ) ) var compiled = new EJS({text: "<%= link_to('hello world', '/something/here' ) %>"}).render({}) ; assertEqual("hello world", compiled) }}, test_date_tag: function() { with(this) { var date = new Date(2007,10,20,1,1,1,1) assertEqual( "", this.view.date_tag('Installation[date]', date) ) }}, test_form_tag: function() { with(this) { assertEqual( "
", this.view.form_tag('/myaction') ) }}, test_end_form_tag: function() { with(this) { assertEqual( "
", this.view.form_tag_end() ) }}, test_hidden_field_tag: function() { with(this) { assertEqual( "", this.view.hidden_field_tag('something[interesting]', 5) ) }}, test_input_field_tag: function() { with(this) { assertEqual( "", this.view.input_field_tag('something[interesting]', 5) ) }}, test_current_page : function(){with (this){ assert( this.view.is_current_page(window.location.href) ); assert( this.view.is_current_page(window.location.pathname) ); assertEqual(false, this.view.is_current_page('juptierit.com') ); }}, test_submit_link_to : function(){with (this){ assertEqual( "", this.view.submit_link_to('holla', '/new/location') ) }}, test_link_to_unless : function(){with (this){ assertEqual( "Reply", this.view.link_to_unless(false, 'Reply', '/reply' ) ) assertEqual( "Reply", this.view.link_to_unless(true, 'Reply', '/reply' ) ) }}, test_link_to_if : function(){with (this){ assertEqual( "Reply", this.view.link_to_if(true, 'Reply', '/reply' ) ) assertEqual( "Reply", this.view.link_to_if(false, 'Reply', '/reply' ) ) }}, test_link_to_unless_current : function(){with (this){ assertEqual( "Reply", this.view.link_to_unless_current('Reply', '/reply' ) ) assertEqual( "Reply", this.view.link_to_unless_current('Reply', window.location.pathname ) ) }}, test_password_field_tag : function(){with (this){ assertEqual( "", this.view.password_field_tag('something[interesting]', 5) ) }}, test_password_field_tag : function(){with (this){ assertEqual( "", this.view.password_field_tag('something[interesting]', 5) ) }}, test_select_tag : function(){with (this){ var choices = [ {value: 1, text: 'First Choice' }, {value: 2, text: 'Second Choice'}, {value: '3', text: 'Third Choice'} ] assertEqual( "", this.view.select_tag('mySelectElement', 2, choices) ) }}, test_text_area_tag : function(){with (this){ assertEqual( "", this.view.text_area_tag('task[description]', 'Here is some text.\nA new line.') ) }}, test_text_field_tag : function(){with (this){ assertEqual( "", this.view.text_field_tag('something[interesting]', 5) ) }}, test_text_img_tag : function(){with (this){ assertEqual( "something", this.view.img_tag('/some.png', 'something') ) }}, test_submit_tag : function(){with (this){ assertEqual( "", this.view.submit_tag('Submit') ) }} //error }, "testlog"); } }