sinatra-tags 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sinatra/tags.rb +2 -3
- data/sinatra-tags.gemspec +5 -5
- data/spec/sinatra/tags_spec.rb +45 -7
- metadata +4 -5
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "kematzy@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/kematzy/sinatra-tags"
|
12
12
|
gem.authors = ["kematzy"]
|
13
|
-
gem.add_dependency('sinatra', '>=1.0
|
13
|
+
gem.add_dependency('sinatra', '>=1.0')
|
14
14
|
gem.add_dependency('sinatra-outputbuffer', '>=0.1.0')
|
15
15
|
gem.add_development_dependency "sinatra-tests", ">= 0.1.6"
|
16
16
|
gem.add_development_dependency "rspec", ">= 1.3.0"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/sinatra/tags.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
|
2
|
-
require 'sinatra/base'
|
3
2
|
require 'sinatra/outputbuffer'
|
4
3
|
|
5
4
|
# :stopdoc:
|
@@ -261,7 +260,7 @@ module Sinatra
|
|
261
260
|
#
|
262
261
|
module Tags
|
263
262
|
|
264
|
-
VERSION = '0.1.
|
263
|
+
VERSION = '0.1.1' unless const_defined?(:VERSION)
|
265
264
|
|
266
265
|
##
|
267
266
|
# Returns the version string for this extension
|
@@ -286,7 +285,7 @@ module Sinatra
|
|
286
285
|
a address applet bdo big blockquote body button caption center
|
287
286
|
colgroup dd dir div dl dt fieldset form frameset head html iframe
|
288
287
|
map noframes noscript object ol optgroup pre script select small
|
289
|
-
style table tbody td
|
288
|
+
style table tbody td tfoot th thead title tr tt ul
|
290
289
|
)
|
291
290
|
|
292
291
|
##
|
data/sinatra-tags.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sinatra-tags}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kematzy"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-05-14}
|
13
13
|
s.description = %q{A Sinatra Extension that provides easy creation of flexible HTML tags.}
|
14
14
|
s.email = %q{kematzy@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -44,18 +44,18 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.specification_version = 3
|
45
45
|
|
46
46
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_runtime_dependency(%q<sinatra>, [">= 1.0
|
47
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 1.0"])
|
48
48
|
s.add_runtime_dependency(%q<sinatra-outputbuffer>, [">= 0.1.0"])
|
49
49
|
s.add_development_dependency(%q<sinatra-tests>, [">= 0.1.6"])
|
50
50
|
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
51
51
|
else
|
52
|
-
s.add_dependency(%q<sinatra>, [">= 1.0
|
52
|
+
s.add_dependency(%q<sinatra>, [">= 1.0"])
|
53
53
|
s.add_dependency(%q<sinatra-outputbuffer>, [">= 0.1.0"])
|
54
54
|
s.add_dependency(%q<sinatra-tests>, [">= 0.1.6"])
|
55
55
|
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
56
56
|
end
|
57
57
|
else
|
58
|
-
s.add_dependency(%q<sinatra>, [">= 1.0
|
58
|
+
s.add_dependency(%q<sinatra>, [">= 1.0"])
|
59
59
|
s.add_dependency(%q<sinatra-outputbuffer>, [">= 0.1.0"])
|
60
60
|
s.add_dependency(%q<sinatra-tests>, [">= 0.1.6"])
|
61
61
|
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
data/spec/sinatra/tags_spec.rb
CHANGED
@@ -85,7 +85,7 @@ describe "Sinatra" do
|
|
85
85
|
a address applet bdo big blockquote body button caption center
|
86
86
|
colgroup dd dir div dl dt fieldset form frameset head html iframe
|
87
87
|
map noframes noscript object ol optgroup pre script select small
|
88
|
-
style table tbody td
|
88
|
+
style table tbody td tfoot th thead title tr tt ul
|
89
89
|
).each do |t|
|
90
90
|
|
91
91
|
describe "like <#{t}>" do
|
@@ -126,6 +126,44 @@ describe "Sinatra" do
|
|
126
126
|
|
127
127
|
end #/ loop
|
128
128
|
|
129
|
+
describe "like <textarea>" do
|
130
|
+
|
131
|
+
it "should NOT have a '\\n' after the opening tag and before the closing tag" do
|
132
|
+
erb_app "<%= tag(:textarea,'contents') %>"
|
133
|
+
body.should == "<textarea>contents</textarea>\n"
|
134
|
+
|
135
|
+
haml_app "= tag(:textarea,'contents')"
|
136
|
+
body.should == "<textarea>contents</textarea>\n"
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should work without contents passed in" do
|
140
|
+
erb_app "<%= tag(:textarea,nil) %>"
|
141
|
+
body.should == "<textarea></textarea>\n"
|
142
|
+
|
143
|
+
haml_app "= tag(:textarea,nil)"
|
144
|
+
body.should == "<textarea></textarea>\n"
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should allow a hash of attributes to be passed" do
|
148
|
+
erb_app "<%= tag(:textarea,'contents', :id => 'tag-id', :class => 'tag-class') %>"
|
149
|
+
body.should have_tag("textarea#tag-id.tag-class","contents")
|
150
|
+
|
151
|
+
haml_app "= tag(:textarea,'contents', :id => 'tag-id', :class => 'tag-class')"
|
152
|
+
body.should have_tag("textarea#tag-id.tag-class","contents")
|
153
|
+
end
|
154
|
+
|
155
|
+
it "with ':newline => false' should NOT add '\\n' around the contents" do
|
156
|
+
erb_app "<%= tag(:textarea,'content', :id => 'tag-id', :newline => false) %>"
|
157
|
+
body.should == "<textarea id=\"tag-id\">content</textarea>\n"
|
158
|
+
|
159
|
+
haml_app "= tag(:textarea,'content', :id => 'tag-id', :newline => false)"
|
160
|
+
body.should == "<textarea id=\"tag-id\">content</textarea>\n"
|
161
|
+
end
|
162
|
+
|
163
|
+
end #/ like #textarea
|
164
|
+
|
165
|
+
|
166
|
+
|
129
167
|
end #/ multi line tags
|
130
168
|
|
131
169
|
describe "self-closing tags " do
|
@@ -311,7 +349,7 @@ block = %Q[
|
|
311
349
|
# body.should have_tag(:debug)
|
312
350
|
body.should have_tag('div#comments')
|
313
351
|
body.should have_tag('div#comments > fieldset > legend', 'Comments')
|
314
|
-
body.should have_tag('div#comments > fieldset > textarea#field-comments', "
|
352
|
+
body.should have_tag('div#comments > fieldset > textarea#field-comments', "test")
|
315
353
|
body.should have_tag('div#comments > fieldset > span', "Some description")
|
316
354
|
#
|
317
355
|
body.should have_tag('div#comments > fieldset#form-details')
|
@@ -338,7 +376,7 @@ block = %Q[
|
|
338
376
|
# body.should have_tag(:debug)
|
339
377
|
body.should have_tag('div#comments')
|
340
378
|
body.should have_tag('div#comments > fieldset > legend', 'Comments')
|
341
|
-
body.should have_tag('div#comments > fieldset > textarea#field-comments', "
|
379
|
+
body.should have_tag('div#comments > fieldset > textarea#field-comments', "test")
|
342
380
|
body.should have_tag('div#comments > fieldset > span', "Some description")
|
343
381
|
#
|
344
382
|
body.should have_tag('div#comments > fieldset#form-details')
|
@@ -369,7 +407,7 @@ block = %Q[
|
|
369
407
|
body.should have_tag('div#comments > p', 'Just plain HTML content')
|
370
408
|
body.should have_tag('div#comments > fieldset > legend', 'Comments')
|
371
409
|
body.should have_tag('div#comments > fieldset > p', 'Even more plain HTML content')
|
372
|
-
body.should have_tag('div#comments > fieldset > textarea#field-comments', "
|
410
|
+
body.should have_tag('div#comments > fieldset > textarea#field-comments', "test")
|
373
411
|
body.should have_tag('div#comments > fieldset > span', "Some description")
|
374
412
|
body.should have_tag('div#comments > p', 'Loads of plain HTML content')
|
375
413
|
#
|
@@ -399,7 +437,7 @@ block = %Q[
|
|
399
437
|
body.should have_tag('div#comments > p', 'Just plain HTML content')
|
400
438
|
body.should have_tag('div#comments > fieldset > legend', 'Comments')
|
401
439
|
body.should have_tag('div#comments > fieldset > p', 'Even more plain HTML content')
|
402
|
-
body.should have_tag('div#comments > fieldset > textarea#field-comments', "
|
440
|
+
body.should have_tag('div#comments > fieldset > textarea#field-comments', "test")
|
403
441
|
body.should have_tag('div#comments > fieldset > span', "Some description")
|
404
442
|
body.should have_tag('div#comments > p', 'Loads of plain HTML content')
|
405
443
|
#
|
@@ -419,7 +457,7 @@ block = %Q[
|
|
419
457
|
erb_app block
|
420
458
|
body.should_not have_tag('div', /tag-content/)
|
421
459
|
body.should have_tag('label[@for=comments]', 'Comments:')
|
422
|
-
body.should have_tag('textarea[@id=comments]',"
|
460
|
+
body.should have_tag('textarea[@id=comments]',"This works")
|
423
461
|
|
424
462
|
block = %Q[
|
425
463
|
- tag(:div, 'tag-content') do
|
@@ -429,7 +467,7 @@ block = %Q[
|
|
429
467
|
haml_app block
|
430
468
|
body.should_not have_tag('div', /tag-content/)
|
431
469
|
body.should have_tag('label[@for=comments]', 'Comments:')
|
432
|
-
body.should have_tag('textarea[@id=comments]',"
|
470
|
+
body.should have_tag('textarea[@id=comments]',"This works")
|
433
471
|
end
|
434
472
|
|
435
473
|
end #/ with Blocks
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- kematzy
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-05-14 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,7 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 1
|
29
29
|
- 0
|
30
|
-
|
31
|
-
version: 1.0.a
|
30
|
+
version: "1.0"
|
32
31
|
type: :runtime
|
33
32
|
version_requirements: *id001
|
34
33
|
- !ruby/object:Gem::Dependency
|