Instiki 0.16.5
Update to Rails 2.3.2 (the stable Rails 2.3 release). Add audio/speex support Update CHANGELOG Bump version number
This commit is contained in:
parent
801d307405
commit
e2ccdfd812
264 changed files with 4850 additions and 1906 deletions
|
@ -19,6 +19,30 @@ class ActiveRecordHelperTest < ActionView::TestCase
|
|||
Column = Struct.new("Column", :type, :name, :human_name)
|
||||
end
|
||||
|
||||
class DirtyPost
|
||||
class Errors
|
||||
def empty?
|
||||
false
|
||||
end
|
||||
|
||||
def count
|
||||
1
|
||||
end
|
||||
|
||||
def full_messages
|
||||
["Author name can't be <em>empty</em>"]
|
||||
end
|
||||
|
||||
def on(field)
|
||||
"can't be <em>empty</em>"
|
||||
end
|
||||
end
|
||||
|
||||
def errors
|
||||
Errors.new
|
||||
end
|
||||
end
|
||||
|
||||
def setup_post
|
||||
@post = Post.new
|
||||
def @post.errors
|
||||
|
@ -195,10 +219,20 @@ class ActiveRecordHelperTest < ActionView::TestCase
|
|||
assert_equal %(<div class="errorDeathByClass"><h1>1 error prohibited this post from being saved</h1><p>There were problems with the following fields:</p><ul><li>Author name can't be empty</li></ul></div>), error_messages_for("post", :class => "errorDeathByClass", :id => nil, :header_tag => "h1")
|
||||
end
|
||||
|
||||
def test_error_messages_for_escapes_html
|
||||
@dirty_post = DirtyPost.new
|
||||
assert_dom_equal %(<div class="errorExplanation" id="errorExplanation"><h2>1 error prohibited this dirty post from being saved</h2><p>There were problems with the following fields:</p><ul><li>Author name can't be <em>empty</em></li></ul></div>), error_messages_for("dirty_post")
|
||||
end
|
||||
|
||||
def test_error_messages_for_handles_nil
|
||||
assert_equal "", error_messages_for("notthere")
|
||||
end
|
||||
|
||||
def test_error_message_on_escapes_html
|
||||
@dirty_post = DirtyPost.new
|
||||
assert_dom_equal "<div class=\"formError\">can't be <em>empty</em></div>", error_message_on(:dirty_post, :author_name)
|
||||
end
|
||||
|
||||
def test_error_message_on_handles_nil
|
||||
assert_equal "", error_message_on("notthere", "notthere")
|
||||
end
|
||||
|
|
|
@ -266,11 +266,18 @@ class FormTagHelperTest < ActionView::TestCase
|
|||
|
||||
def test_submit_tag_with_confirmation
|
||||
assert_dom_equal(
|
||||
%(<input name='commit' type='submit' value='Save' onclick="return confirm('Are you sure?');"/>),
|
||||
%(<input name='commit' type='submit' value='Save' onclick="if (!confirm('Are you sure?')) return false; return true;"/>),
|
||||
submit_tag("Save", :confirm => "Are you sure?")
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def test_submit_tag_with_confirmation_and_with_disable_with
|
||||
assert_dom_equal(
|
||||
%(<input name="commit" type="submit" value="Save" onclick="if (!confirm('Are you sure?')) return false; if (window.hiddenCommit) { window.hiddenCommit.setAttribute('value', this.value); }else { hiddenCommit = this.cloneNode(false);hiddenCommit.setAttribute('type', 'hidden');this.form.appendChild(hiddenCommit); }this.setAttribute('originalValue', this.value);this.disabled = true;this.value='Saving...';result = (this.form.onsubmit ? (this.form.onsubmit() ? this.form.submit() : false) : this.form.submit());if (result == false) { this.value = this.getAttribute('originalValue');this.disabled = false; }return result;" />),
|
||||
submit_tag("Save", :disable_with => "Saving...", :confirm => "Are you sure?")
|
||||
)
|
||||
end
|
||||
|
||||
def test_image_submit_tag_with_confirmation
|
||||
assert_dom_equal(
|
||||
%(<input type="image" src="/images/save.gif" onclick="return confirm('Are you sure?');"/>),
|
||||
|
|
|
@ -45,11 +45,6 @@ class JavaScriptHelperTest < ActionView::TestCase
|
|||
link_to_function("Greeting", "alert('Hello world!')", :href => 'http://example.com/')
|
||||
end
|
||||
|
||||
def test_link_to_function_with_href
|
||||
assert_dom_equal %(<a href="http://example.com/" onclick="alert('Hello world!'); return false;">Greeting</a>),
|
||||
link_to_function("Greeting", "alert('Hello world!')", :href => 'http://example.com/')
|
||||
end
|
||||
|
||||
def test_button_to_function
|
||||
assert_dom_equal %(<input type="button" onclick="alert('Hello world!');" value="Greeting" />),
|
||||
button_to_function("Greeting", "alert('Hello world!')")
|
||||
|
|
|
@ -4,6 +4,7 @@ class NumberHelperTest < ActionView::TestCase
|
|||
tests ActionView::Helpers::NumberHelper
|
||||
|
||||
def test_number_to_phone
|
||||
assert_equal("555-1234", number_to_phone(5551234))
|
||||
assert_equal("800-555-1212", number_to_phone(8005551212))
|
||||
assert_equal("(800) 555-1212", number_to_phone(8005551212, {:area_code => true}))
|
||||
assert_equal("800 555 1212", number_to_phone(8005551212, {:delimiter => " "}))
|
||||
|
|
|
@ -145,6 +145,10 @@ module RenderTestCases
|
|||
assert_equal File.expand_path("#{FIXTURE_LOAD_PATH}/test/_raise.html.erb"), e.file_name
|
||||
end
|
||||
|
||||
def test_render_object
|
||||
assert_equal "Hello: david", @view.render(:partial => "test/customer", :object => Customer.new("david"))
|
||||
end
|
||||
|
||||
def test_render_partial_collection
|
||||
assert_equal "Hello: davidHello: mary", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), Customer.new("mary") ])
|
||||
end
|
||||
|
|
|
@ -375,6 +375,12 @@ class TextHelperTest < ActionView::TestCase
|
|||
assert_equal "{link: #{link3_result}}", auto_link("{link: #{link3_raw}}")
|
||||
end
|
||||
|
||||
def test_auto_link_in_tags
|
||||
link_raw = 'http://www.rubyonrails.org/images/rails.png'
|
||||
link_result = %Q(<img src="#{link_raw}" />)
|
||||
assert_equal link_result, auto_link(link_result)
|
||||
end
|
||||
|
||||
def test_auto_link_at_eol
|
||||
url1 = "http://api.rubyonrails.com/Foo.html"
|
||||
url2 = "http://www.ruby-doc.org/core/Bar.html"
|
||||
|
|
|
@ -220,7 +220,7 @@ class UrlHelperTest < ActionView::TestCase
|
|||
end
|
||||
|
||||
def test_link_tag_using_post_javascript_and_popup
|
||||
assert_raises(ActionView::ActionViewError) { link_to("Hello", "http://www.example.com", :popup => true, :method => :post, :confirm => "Are you serious?") }
|
||||
assert_raise(ActionView::ActionViewError) { link_to("Hello", "http://www.example.com", :popup => true, :method => :post, :confirm => "Are you serious?") }
|
||||
end
|
||||
|
||||
def test_link_tag_using_block_in_erb
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue