Changeset 6861
- Timestamp:
- 05/26/07 17:29:23 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/assertions/selector_assertions.rb (modified) (5 diffs)
- trunk/actionpack/test/controller/assert_select_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6860 r6861 1 1 *SVN* 2 3 * Add support for assert_select_rjs with :show and :hide. #7780 [dchelimsky] 2 4 3 5 * Make assert_select's failure messages clearer about what failed. #7779 [dchelimsky] trunk/actionpack/lib/action_controller/assertions/selector_assertions.rb
r6860 r6861 326 326 # 327 327 # Use the first argument to narrow down assertions to only statements 328 # of that type. Possible values are +:replace+, +:replace_html+, +: remove+ and329 # +: insert_html+.328 # of that type. Possible values are +:replace+, +:replace_html+, +:show+, 329 # +:hide+, +:toggle+, +:remove+ and +:insert_html+. 330 330 # 331 331 # Use the argument +:insert+ followed by an insertion position to narrow … … 415 415 when :chained_replace, :chained_replace_html 416 416 Regexp.new("\\$\\(\"#{id}\"\\)#{statement}\\(#{RJS_PATTERN_HTML}\\)", Regexp::MULTILINE) 417 when :remove 417 when :remove, :show, :hide, :toggle 418 418 Regexp.new("#{statement}\\(\"#{id}\"\\)") 419 419 else … … 424 424 matches = nil 425 425 case rjs_type 426 when :remove 426 when :remove, :show, :hide, :toggle 427 427 matches = @response.body.match(pattern) 428 428 else … … 435 435 end 436 436 if matches 437 if block_given? && rjs_type != :remove437 if block_given? && !([:remove, :show, :hide, :toggle].include? rjs_type) 438 438 begin 439 439 in_scope, @selected = @selected, matches … … 542 542 :chained_replace_html => /\.update/, 543 543 :remove => /Element\.remove/, 544 :show => /Element\.show/, 545 :hide => /Element\.hide/, 546 :toggle => /Element\.toggle/ 544 547 } 545 548 RJS_INSERTIONS = [:top, :bottom, :before, :after] trunk/actionpack/test/controller/assert_select_test.rb
r6860 r6861 453 453 end 454 454 455 # Simple show 456 def test_assert_select_rjs_for_show 457 render_rjs do |page| 458 page.show "test1" 459 end 460 461 assert_select_rjs :show, "test1" 462 end 463 464 def test_assert_select_rjs_for_show_ignores_block 465 render_rjs do |page| 466 page.show "test1" 467 end 468 469 assert_nothing_raised do 470 assert_select_rjs :show, "test1" do 471 assert_select "p" 472 end 473 end 474 end 475 476 # Simple hide 477 def test_assert_select_rjs_for_hide 478 render_rjs do |page| 479 page.hide "test1" 480 end 481 482 assert_select_rjs :hide, "test1" 483 end 484 485 def test_assert_select_rjs_for_hide_ignores_block 486 render_rjs do |page| 487 page.hide "test1" 488 end 489 490 assert_nothing_raised do 491 assert_select_rjs :hide, "test1" do 492 assert_select "p" 493 end 494 end 495 end 496 497 # Simple toggle 498 def test_assert_select_rjs_for_toggle 499 render_rjs do |page| 500 page.toggle "test1" 501 end 502 503 assert_select_rjs :toggle, "test1" 504 end 505 506 def test_assert_select_rjs_for_toggle_ignores_block 507 render_rjs do |page| 508 page.toggle "test1" 509 end 510 511 assert_nothing_raised do 512 assert_select_rjs :toggle, "test1" do 513 assert_select "p" 514 end 515 end 516 end 517 455 518 # Non-positioned insert. 456 519 def test_assert_select_rjs_for_nonpositioned_insert … … 499 562 end 500 563 end 501 502 564 503 565 # Simple selection from a single result. 504 566 def test_nested_assert_select_rjs_with_single_result