slim 2.1.0 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -24
- data/CHANGES +8 -0
- data/Gemfile +5 -7
- data/README.jp.md +29 -31
- data/README.md +34 -34
- data/Rakefile +9 -7
- data/benchmarks/context.rb +3 -3
- data/benchmarks/run-benchmarks.rb +9 -9
- data/benchmarks/view.slim +1 -1
- data/doc/jp/logic_less.md +7 -7
- data/doc/logic_less.md +7 -7
- data/lib/slim/command.rb +6 -16
- data/lib/slim/embedded.rb +10 -13
- data/lib/slim/engine.rb +21 -23
- data/lib/slim/erb_converter.rb +2 -1
- data/lib/slim/include.rb +2 -2
- data/lib/slim/logic_less.rb +1 -2
- data/lib/slim/logic_less/filter.rb +3 -3
- data/lib/slim/parser.rb +43 -19
- data/lib/slim/smart.rb +3 -3
- data/lib/slim/smart/escaper.rb +1 -1
- data/lib/slim/smart/filter.rb +3 -3
- data/lib/slim/smart/parser.rb +6 -4
- data/lib/slim/splat/builder.rb +9 -4
- data/lib/slim/splat/filter.rb +3 -4
- data/lib/slim/template.rb +5 -5
- data/lib/slim/translator.rb +12 -13
- data/lib/slim/version.rb +1 -1
- data/slim.gemspec +3 -1
- data/test/core/helper.rb +3 -3
- data/test/core/test_code_escaping.rb +14 -14
- data/test/core/test_code_evaluation.rb +1 -1
- data/test/core/test_code_output.rb +1 -1
- data/test/core/test_embedded_engines.rb +16 -16
- data/test/core/test_encoding.rb +4 -4
- data/test/core/test_html_attributes.rb +9 -9
- data/test/core/test_html_structure.rb +20 -20
- data/test/core/test_parser_errors.rb +1 -1
- data/test/core/test_pretty.rb +4 -4
- data/test/core/test_ruby_errors.rb +5 -5
- data/test/core/test_slim_template.rb +2 -2
- data/test/core/test_tabs.rb +5 -5
- data/test/core/test_thread_options.rb +4 -4
- data/test/core/test_unicode.rb +11 -13
- data/test/include/test_include.rb +2 -2
- data/test/literate/TESTS.md +37 -8
- data/test/literate/helper.rb +2 -2
- data/test/logic_less/test_logic_less.rb +37 -37
- data/test/rails/app/controllers/slim_controller.rb +3 -3
- data/test/rails/config/initializers/session_store.rb +1 -1
- data/test/rails/config/routes.rb +4 -4
- data/test/rails/test/test_slim.rb +9 -15
- data/test/smart/test_smart_text.rb +5 -9
- data/test/translator/test_translator.rb +14 -14
- metadata +7 -7
data/test/core/test_encoding.rb
CHANGED
@@ -9,13 +9,13 @@ class TestSlimEncoding < TestSlim
|
|
9
9
|
|
10
10
|
def test_binary
|
11
11
|
source = "| \xFF\xFF"
|
12
|
-
source.force_encoding(Encoding::BINARY)
|
12
|
+
source.force_encoding(Encoding::BINARY)
|
13
13
|
|
14
14
|
result = "\xFF\xFF"
|
15
|
-
result.force_encoding(Encoding::BINARY)
|
15
|
+
result.force_encoding(Encoding::BINARY)
|
16
16
|
|
17
|
-
out = render(source, :
|
18
|
-
out.force_encoding(Encoding::BINARY)
|
17
|
+
out = render(source, default_encoding: 'binary')
|
18
|
+
out.force_encoding(Encoding::BINARY)
|
19
19
|
|
20
20
|
assert_equal result, out
|
21
21
|
end
|
@@ -42,14 +42,14 @@ p id=(false ? 'notshown' : 'shown') = output_number
|
|
42
42
|
source = %{
|
43
43
|
#alpha id="beta" Test it
|
44
44
|
}
|
45
|
-
assert_html '<div id="alpha_beta">Test it</div>', source, :
|
45
|
+
assert_html '<div id="alpha_beta">Test it</div>', source, merge_attrs: {'class' => ' ', 'id' => '_' }
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_id_attribute_merging2
|
49
49
|
source = %{
|
50
50
|
#alpha id="beta" Test it
|
51
51
|
}
|
52
|
-
assert_html '<div id="alpha-beta">Test it</div>', source, :
|
52
|
+
assert_html '<div id="alpha-beta">Test it</div>', source, merge_attrs: {'class' => ' ', 'id' => '-' }
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_boolean_attribute_false
|
@@ -110,7 +110,7 @@ option(selected class="clazz") Text
|
|
110
110
|
|
111
111
|
def test_hyphenated_attribute
|
112
112
|
source = %{
|
113
|
-
.alpha data={:
|
113
|
+
.alpha data={a: 'alpha', b: 'beta', c_d: 'gamma', c: {e: 'epsilon'}}
|
114
114
|
}
|
115
115
|
|
116
116
|
assert_html '<div class="alpha" data-a="alpha" data-b="beta" data-c-d="gamma" data-c-e="epsilon"></div>', source
|
@@ -151,7 +151,7 @@ h1 *hash class=[] This is my title
|
|
151
151
|
|
152
152
|
def test_splat_tag_name
|
153
153
|
source = %q{
|
154
|
-
*{:
|
154
|
+
*{tag: 'h1', id: 'title'} This is my title
|
155
155
|
}
|
156
156
|
|
157
157
|
assert_html '<h1 id="title">This is my title</h1>', source
|
@@ -160,7 +160,7 @@ h1 *hash class=[] This is my title
|
|
160
160
|
|
161
161
|
def test_splat_empty_tag_name
|
162
162
|
source = %q{
|
163
|
-
*{:
|
163
|
+
*{tag: '', id: 'test'} This is my title
|
164
164
|
}
|
165
165
|
|
166
166
|
assert_html '<div id="test">This is my title</div>', source
|
@@ -200,7 +200,7 @@ h1 *hash class=[] This is my title
|
|
200
200
|
|
201
201
|
def test_splat_with_class_merging
|
202
202
|
source = %q{
|
203
|
-
#myid.myclass *{:
|
203
|
+
#myid.myclass *{class: [:secondclass, %w(x y z)]} *hash This is my title
|
204
204
|
}
|
205
205
|
|
206
206
|
assert_html '<div a="The letter a" b="The letter b" class="myclass secondclass x y z" id="myid">This is my title</div>', source
|
@@ -208,7 +208,7 @@ h1 *hash class=[] This is my title
|
|
208
208
|
|
209
209
|
def test_splat_with_boolean_attribute
|
210
210
|
source = %q{
|
211
|
-
*{:
|
211
|
+
*{disabled: true, empty1: false, nonempty: '', empty2: nil} This is my title
|
212
212
|
}
|
213
213
|
|
214
214
|
assert_html '<div disabled="" nonempty="">This is my title</div>', source
|
@@ -216,7 +216,7 @@ h1 *hash class=[] This is my title
|
|
216
216
|
|
217
217
|
def test_splat_merging_with_arrays
|
218
218
|
source = %q{
|
219
|
-
*{:
|
219
|
+
*{a: 1, b: 2} *[[:c, 3], [:d, 4]] *[[:e, 5], [:f, 6]] This is my title
|
220
220
|
}
|
221
221
|
|
222
222
|
assert_html '<div a="1" b="2" c="3" d="4" e="5" f="6">This is my title</div>', source
|
@@ -233,7 +233,7 @@ h1 data-id="123" *hash This is my title
|
|
233
233
|
def test_attribute_merging
|
234
234
|
source = %q{
|
235
235
|
a class=true class=false
|
236
|
-
a class=false *{:
|
236
|
+
a class=false *{class:true}
|
237
237
|
a class=true
|
238
238
|
a class=false
|
239
239
|
}
|
@@ -48,7 +48,7 @@ doctype 1.1
|
|
48
48
|
html
|
49
49
|
}
|
50
50
|
|
51
|
-
assert_html '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html></html>', source, :
|
51
|
+
assert_html '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html></html>', source, format: :xhtml
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_doctype_new_syntax
|
@@ -57,7 +57,7 @@ doctype 5
|
|
57
57
|
html
|
58
58
|
}
|
59
59
|
|
60
|
-
assert_html '<!DOCTYPE html><html></html>', source, :
|
60
|
+
assert_html '<!DOCTYPE html><html></html>', source, format: :xhtml
|
61
61
|
end
|
62
62
|
|
63
63
|
def test_doctype_new_syntax_html5
|
@@ -66,7 +66,7 @@ doctype html
|
|
66
66
|
html
|
67
67
|
}
|
68
68
|
|
69
|
-
assert_html '<!DOCTYPE html><html></html>', source, :
|
69
|
+
assert_html '<!DOCTYPE html><html></html>', source, format: :xhtml
|
70
70
|
end
|
71
71
|
|
72
72
|
def test_render_with_shortcut_attributes
|
@@ -85,7 +85,7 @@ h1#title This is my title
|
|
85
85
|
= hello_world
|
86
86
|
}
|
87
87
|
|
88
|
-
assert_html '<section class="hello world" id="notice">Hello World from @env</section>', source, :
|
88
|
+
assert_html '<section class="hello world" id="notice">Hello World from @env</section>', source, default_tag: 'section'
|
89
89
|
end
|
90
90
|
|
91
91
|
def test_render_with_custom_shortcut
|
@@ -96,7 +96,7 @@ h1#title This is my title
|
|
96
96
|
= hello_world
|
97
97
|
}
|
98
98
|
|
99
|
-
assert_html '<div class="hello world" id="notice" role="test">Hello World from @env</div><section role="abc">Hello World from @env</section>', source, :
|
99
|
+
assert_html '<div class="hello world" id="notice" role="test">Hello World from @env</div><section role="abc">Hello World from @env</section>', source, shortcut: {'#' => {attr: 'id'}, '.' => {attr: 'class'}, '@' => {tag: 'section', attr: 'role'}}
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_render_with_text_block
|
@@ -307,7 +307,7 @@ p(id="marvin" class="martian" data-info="Illudium Q-36")= output_number
|
|
307
307
|
source = %q{
|
308
308
|
p<id="marvin" class="martian" data-info="Illudium Q-36">= output_number
|
309
309
|
}
|
310
|
-
Slim::Parser.
|
310
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
311
311
|
str = source.sub('<',k).sub('>',v)
|
312
312
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">1337</p>', str
|
313
313
|
end
|
@@ -319,8 +319,8 @@ p { foo="bar" }
|
|
319
319
|
}
|
320
320
|
|
321
321
|
assert_html '<p foo="bar"></p>', source
|
322
|
-
assert_html '<p foo="bar"></p>', source, :
|
323
|
-
assert_html '<p>{ foo="bar" }</p>', source, :
|
322
|
+
assert_html '<p foo="bar"></p>', source, attr_list_delims: {'{' => '}'}
|
323
|
+
assert_html '<p>{ foo="bar" }</p>', source, attr_list_delims: {'(' => ')', '[' => ']'}
|
324
324
|
end
|
325
325
|
|
326
326
|
def test_closed_tag
|
@@ -328,7 +328,7 @@ p { foo="bar" }
|
|
328
328
|
closed/
|
329
329
|
}
|
330
330
|
|
331
|
-
assert_html '<closed />', source, :
|
331
|
+
assert_html '<closed />', source, format: :xhtml
|
332
332
|
end
|
333
333
|
|
334
334
|
def test_custom_attr_list_delims_option
|
@@ -338,8 +338,8 @@ p < x=(1+1) > Hello
|
|
338
338
|
}
|
339
339
|
|
340
340
|
assert_html '<p foo="bar" x="2"></p><p>< x=(1+1) > Hello</p>', source
|
341
|
-
assert_html '<p foo="bar" x="2"></p><p>< x=(1+1) > Hello</p>', source, :
|
342
|
-
assert_html '<p>{ foo="bar" x=(1+1) }</p><p x="2">Hello</p>', source, :
|
341
|
+
assert_html '<p foo="bar" x="2"></p><p>< x=(1+1) > Hello</p>', source, attr_list_delims: {'{' => '}'}
|
342
|
+
assert_html '<p>{ foo="bar" x=(1+1) }</p><p x="2">Hello</p>', source, attr_list_delims: {'<' => '>'}, code_attr_delims: { '(' => ')' }
|
343
343
|
end
|
344
344
|
|
345
345
|
def test_closed_tag
|
@@ -347,7 +347,7 @@ p < x=(1+1) > Hello
|
|
347
347
|
closed/
|
348
348
|
}
|
349
349
|
|
350
|
-
assert_html '<closed />', source, :
|
350
|
+
assert_html '<closed />', source, format: :xhtml
|
351
351
|
end
|
352
352
|
|
353
353
|
def test_attributs_with_parens_and_spaces
|
@@ -370,7 +370,7 @@ closed/
|
|
370
370
|
closed id="test" /
|
371
371
|
}
|
372
372
|
|
373
|
-
assert_html '<closed id="test" />', source, :
|
373
|
+
assert_html '<closed id="test" />', source, format: :xhtml
|
374
374
|
end
|
375
375
|
|
376
376
|
def test_closed_tag_with_attributes_and_parens
|
@@ -378,7 +378,7 @@ closed id="test" /
|
|
378
378
|
closed(id="test")/
|
379
379
|
}
|
380
380
|
|
381
|
-
assert_html '<closed id="test" />', source, :
|
381
|
+
assert_html '<closed id="test" />', source, format: :xhtml
|
382
382
|
end
|
383
383
|
|
384
384
|
def test_render_with_html_comments
|
@@ -417,7 +417,7 @@ p<id="marvin"
|
|
417
417
|
class="martian"
|
418
418
|
data-info="Illudium Q-36"> = output_number
|
419
419
|
}
|
420
|
-
Slim::Parser.
|
420
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
421
421
|
str = source.sub('<',k).sub('>',v)
|
422
422
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">1337</p>', str
|
423
423
|
end
|
@@ -429,7 +429,7 @@ p<id="marvin"
|
|
429
429
|
class="martian"
|
430
430
|
data-info="Illudium Q-36"> THE space modulator
|
431
431
|
}
|
432
|
-
Slim::Parser.
|
432
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
433
433
|
str = source.sub('<',k).sub('>',v)
|
434
434
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
|
435
435
|
end
|
@@ -442,7 +442,7 @@ p<id="marvin"
|
|
442
442
|
data-info="Illudium Q-36">
|
443
443
|
| THE space modulator
|
444
444
|
}
|
445
|
-
Slim::Parser.
|
445
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
446
446
|
str = source.sub('<',k).sub('>',v)
|
447
447
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
|
448
448
|
end
|
@@ -455,7 +455,7 @@ p<id=id_helper
|
|
455
455
|
data-info="Illudium Q-36">
|
456
456
|
| THE space modulator
|
457
457
|
}
|
458
|
-
Slim::Parser.
|
458
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
459
459
|
str = source.sub('<',k).sub('>',v)
|
460
460
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="notice">THE space modulator</p>', str
|
461
461
|
end
|
@@ -469,7 +469,7 @@ p<id=id_helper
|
|
469
469
|
span.emphasis THE
|
470
470
|
| space modulator
|
471
471
|
}
|
472
|
-
Slim::Parser.
|
472
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
473
473
|
str = source.sub('<',k).sub('>',v)
|
474
474
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="notice"><span class="emphasis">THE</span> space modulator</p>', str
|
475
475
|
end
|
@@ -482,7 +482,7 @@ li< id="myid"
|
|
482
482
|
data-info="myinfo">
|
483
483
|
a href="link" My Link
|
484
484
|
}
|
485
|
-
Slim::Parser.
|
485
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
486
486
|
str = source.sub('<',k).sub('>',v)
|
487
487
|
assert_html '<li class="myclass" data-info="myinfo" id="myid"><a href="link">My Link</a></li>', str
|
488
488
|
end
|
@@ -7,7 +7,7 @@ doctype 5
|
|
7
7
|
div Invalid
|
8
8
|
}
|
9
9
|
|
10
|
-
assert_syntax_error "Unexpected indentation\n test.slim, Line 3, Column 2\n div Invalid\n ^\n", source, :
|
10
|
+
assert_syntax_error "Unexpected indentation\n test.slim, Line 3, Column 2\n div Invalid\n ^\n", source, file: 'test.slim'
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_unexpected_indentation
|
data/test/core/test_pretty.rb
CHANGED
@@ -2,11 +2,11 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class TestSlimPretty < TestSlim
|
4
4
|
def setup
|
5
|
-
Slim::Engine.
|
5
|
+
Slim::Engine.set_options pretty: true
|
6
6
|
end
|
7
7
|
|
8
8
|
def teardown
|
9
|
-
Slim::Engine.
|
9
|
+
Slim::Engine.set_options pretty: false
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_pretty
|
@@ -86,7 +86,7 @@ html
|
|
86
86
|
| content}
|
87
87
|
|
88
88
|
source = %q{html
|
89
|
-
== render body, :
|
89
|
+
== render body, scope: self, locals: { content: content }}
|
90
90
|
|
91
91
|
result = %q{<html>
|
92
92
|
<body>
|
@@ -96,7 +96,7 @@ html
|
|
96
96
|
</body>
|
97
97
|
</html>}
|
98
98
|
|
99
|
-
assert_html result, source, :
|
99
|
+
assert_html result, source, scope: self, locals: {body: body, content: content }
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_correct_line_number
|
@@ -9,7 +9,7 @@ data2-=1)
|
|
9
9
|
= unknown_ruby_method
|
10
10
|
}
|
11
11
|
|
12
|
-
assert_ruby_error NameError, "test.slim:5", source, :
|
12
|
+
assert_ruby_error NameError, "test.slim:5", source, file: 'test.slim'
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_broken_output_line
|
@@ -26,9 +26,9 @@ p = hello_world + \
|
|
26
26
|
# test = 1+\
|
27
27
|
# unknown_variable
|
28
28
|
if RUBY_PLATFORM == "java"
|
29
|
-
assert_ruby_error NameError, "test.slim:2", source, :
|
29
|
+
assert_ruby_error NameError, "test.slim:2", source, file: 'test.slim'
|
30
30
|
else
|
31
|
-
assert_ruby_error NameError, "test.slim:4", source, :
|
31
|
+
assert_ruby_error NameError, "test.slim:4", source, file: 'test.slim'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -193,13 +193,13 @@ div
|
|
193
193
|
|
194
194
|
def test_splat_multiple_id_attribute
|
195
195
|
source = %{
|
196
|
-
#alpha *{:
|
196
|
+
#alpha *{id:"beta"} Test it
|
197
197
|
}
|
198
198
|
assert_runtime_error 'Multiple id attributes specified', source
|
199
199
|
end
|
200
200
|
|
201
201
|
# def test_invalid_option
|
202
|
-
# render('', :
|
202
|
+
# render('', foobar: 42)
|
203
203
|
# raise Exception, 'ArgumentError expected'
|
204
204
|
# rescue ArgumentError => ex
|
205
205
|
# assert_equal 'Option :foobar is not supported by Slim::Engine', ex.message
|
@@ -47,7 +47,7 @@ class TestSlimTemplate < TestSlim
|
|
47
47
|
fail unless data[0] == ?h
|
48
48
|
template = Slim::Template.new('test.slim') { data }
|
49
49
|
begin
|
50
|
-
res = template.render(Object.new, :
|
50
|
+
res = template.render(Object.new, name: 'Joe', foo: 'bar')
|
51
51
|
rescue => ex
|
52
52
|
assert_kind_of MockError, ex
|
53
53
|
assert_backtrace(ex, 'test.slim:5')
|
@@ -63,7 +63,7 @@ class TestSlimTemplate < TestSlim
|
|
63
63
|
|
64
64
|
def test_passing_locals
|
65
65
|
template = Slim::Template.new { "p = 'Hey ' + name + '!'\n" }
|
66
|
-
assert_equal "<p>Hey Joe!</p>", template.render(Object.new, :
|
66
|
+
assert_equal "<p>Hey Joe!</p>", template.render(Object.new, name: 'Joe')
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
data/test/core/test_tabs.rb
CHANGED
@@ -3,12 +3,12 @@ require 'helper'
|
|
3
3
|
class TestSlimTabs < TestSlim
|
4
4
|
|
5
5
|
def teardown
|
6
|
-
Slim::Engine.
|
6
|
+
Slim::Engine.set_options tabsize: 4
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_single_tab1_expansion
|
10
10
|
|
11
|
-
Slim::Engine.
|
11
|
+
Slim::Engine.set_options tabsize: 1
|
12
12
|
|
13
13
|
source = %Q{
|
14
14
|
|
|
@@ -40,7 +40,7 @@ class TestSlimTabs < TestSlim
|
|
40
40
|
|
41
41
|
def test_single_tab4_expansion
|
42
42
|
|
43
|
-
Slim::Engine.
|
43
|
+
Slim::Engine.set_options tabsize: 4
|
44
44
|
|
45
45
|
source = %Q{
|
46
46
|
|
|
@@ -72,7 +72,7 @@ class TestSlimTabs < TestSlim
|
|
72
72
|
|
73
73
|
def test_multi_tab1_expansion
|
74
74
|
|
75
|
-
Slim::Engine.
|
75
|
+
Slim::Engine.set_options tabsize: 1
|
76
76
|
|
77
77
|
source = %Q{
|
78
78
|
|
|
@@ -120,7 +120,7 @@ class TestSlimTabs < TestSlim
|
|
120
120
|
|
121
121
|
def test_multi_tab4_expansion
|
122
122
|
|
123
|
-
Slim::Engine.
|
123
|
+
Slim::Engine.set_options tabsize: 4
|
124
124
|
|
125
125
|
source = %Q{
|
126
126
|
|
|
@@ -5,14 +5,14 @@ class TestSlimThreadOptions < TestSlim
|
|
5
5
|
source = %q{p.test}
|
6
6
|
|
7
7
|
assert_html '<p class="test"></p>', source
|
8
|
-
assert_html "<p class='test'></p>", source, :
|
8
|
+
assert_html "<p class='test'></p>", source, attr_quote: "'"
|
9
9
|
|
10
|
-
Slim::Engine.with_options(:
|
10
|
+
Slim::Engine.with_options(attr_quote: "'") do
|
11
11
|
assert_html "<p class='test'></p>", source
|
12
|
-
assert_html '<p class="test"></p>', source, :
|
12
|
+
assert_html '<p class="test"></p>', source, attr_quote: '"'
|
13
13
|
end
|
14
14
|
|
15
15
|
assert_html '<p class="test"></p>', source
|
16
|
-
assert_html "<p class='test'></p>", source, :
|
16
|
+
assert_html "<p class='test'></p>", source, attr_quote: "'"
|
17
17
|
end
|
18
18
|
end
|
data/test/core/test_unicode.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'helper'
|
2
|
+
require 'helper'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
class TestSlimUnicode < TestSlim
|
5
|
+
def test_unicode_tags
|
6
|
+
source = "Статья года"
|
7
|
+
result = "<Статья>года</Статья>"
|
8
|
+
assert_html result, source
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
11
|
+
def test_unicode_attrs
|
12
|
+
source = "Статья года=123 content"
|
13
|
+
result = "<Статья года=\"123\">content</Статья>"
|
14
|
+
assert_html result, source
|
17
15
|
end
|
18
16
|
end
|
@@ -9,7 +9,7 @@ b: include textfile
|
|
9
9
|
c: include slimfile.slim
|
10
10
|
d: include subdir/test
|
11
11
|
}
|
12
|
-
assert_html '<a>slim1recslim2</a><b>1+2=3</b><c>slim1recslim2</c><d>subdir</d>', source, :
|
12
|
+
assert_html '<a>slim1recslim2</a><b>1+2=3</b><c>slim1recslim2</c><d>subdir</d>', source, include_dirs: [File.expand_path('files', File.dirname(__FILE__))]
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_include_with_newline
|
@@ -18,6 +18,6 @@ a: include slimfile
|
|
18
18
|
|
19
19
|
.content
|
20
20
|
}
|
21
|
-
assert_html '<a>slim1recslim2</a><div class="content"></div>', source, :
|
21
|
+
assert_html '<a>slim1recslim2</a><div class="content"></div>', source, include_dirs: [File.expand_path('files', File.dirname(__FILE__))]
|
22
22
|
end
|
23
23
|
end
|