|
| 1 | +# coding: utf-8 |
| 2 | + |
1 | 3 | require 'abstract_unit'
|
2 | 4 |
|
3 | 5 | class AssertSelectTest < ActionController::TestCase
|
@@ -47,7 +49,7 @@ def test_assert_select_from_rjs_with_single_result
|
47 | 49 | assert_select "#2"
|
48 | 50 | end
|
49 | 51 | end
|
50 |
| - |
| 52 | + |
51 | 53 | # With multiple results.
|
52 | 54 | def test_assert_select_from_rjs_with_multiple_results
|
53 | 55 | render_rjs do |page|
|
@@ -121,19 +123,22 @@ def test_assert_select_rjs_fails_if_nothing_to_pick
|
121 | 123 |
|
122 | 124 | def test_assert_select_rjs_with_unicode
|
123 | 125 | # Test that non-ascii characters (which are converted into \uXXXX in RJS) are decoded correctly.
|
| 126 | + |
| 127 | + unicode = "\343\203\201\343\202\261\343\203\203\343\203\210" |
124 | 128 | render_rjs do |page|
|
125 |
| - page.replace "test", "<div id=\"1\">\343\203\201\343\202\261\343\203\203\343\203\210</div>" |
| 129 | + page.replace "test", %(<div id="1">#{unicode}</div>) |
126 | 130 | end
|
| 131 | + |
127 | 132 | assert_select_rjs do
|
128 | 133 | str = "#1"
|
129 |
| - assert_select str, :text => "\343\203\201\343\202\261\343\203\203\343\203\210" |
130 |
| - assert_select str, "\343\203\201\343\202\261\343\203\203\343\203\210" |
| 134 | + assert_select str, :text => unicode |
| 135 | + assert_select str, unicode |
131 | 136 | if str.respond_to?(:force_encoding)
|
132 | 137 | assert_select str, /\343\203\201..\343\203\210/u
|
133 | 138 | assert_raise(Assertion) { assert_select str, /\343\203\201.\343\203\210/u }
|
134 | 139 | else
|
135 |
| - assert_select str, Regexp.new("\343\203\201..\343\203\210",0,'U') |
136 |
| - assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210",0,'U') } |
| 140 | + assert_select str, Regexp.new("\343\203\201..\343\203\210", 0, 'U') |
| 141 | + assert_raise(Assertion) { assert_select str, Regexp.new("\343\203\201.\343\203\210", 0, 'U') } |
137 | 142 | end
|
138 | 143 | end
|
139 | 144 | end
|
|
0 commit comments