ie_conditional_tag 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -6
- data/lib/generators/templates/ie_conditional_tag.rb +6 -6
- data/lib/ie_conditional_tag/version.rb +3 -0
- data/test/helper.rb +5 -0
- data/test/test_condition.rb +4 -4
- data/test/test_tag_helper.rb +15 -15
- metadata +18 -35
- data/.document +0 -5
- data/.gitignore +0 -21
- data/Rakefile +0 -52
- data/VERSION +0 -1
data/README.md
CHANGED
@@ -27,11 +27,11 @@ custom class:
|
|
27
27
|
This would give you (with some prettied indentation):
|
28
28
|
|
29
29
|
<!DOCTYPE html>
|
30
|
-
<!--[if lt IE 7]><html class="ie6 some-custom-class"><![endif]-->
|
31
|
-
<!--[if IE 7]><html class="ie7 some-custom-class"><![endif]-->
|
32
|
-
<!--[if IE 8]><html class="ie8 some-custom-class"><![endif]-->
|
33
|
-
<!--[if IE 9]><html class="ie9 some-custom-class"><![endif]-->
|
34
|
-
<!--[if gt IE 9]><html class="some-custom-class"><![endif]-->
|
30
|
+
<!--[if lt IE 7]><html class="ie ie6 some-custom-class"><![endif]-->
|
31
|
+
<!--[if IE 7]><html class="ie ie7 some-custom-class"><![endif]-->
|
32
|
+
<!--[if IE 8]><html class="ie ie8 some-custom-class"><![endif]-->
|
33
|
+
<!--[if IE 9]><html class="ie ie9 some-custom-class"><![endif]-->
|
34
|
+
<!--[if gt IE 9]><html class="ie some-custom-class"><![endif]-->
|
35
35
|
<!--[if !IE]><!--><html class="some-custom-class"><!--<![endif]-->
|
36
36
|
<head>
|
37
37
|
<title>New HTML5 page</title>
|
@@ -92,7 +92,7 @@ You may want to look/tweak the settings there.
|
|
92
92
|
|
93
93
|
Note: By default, when IE 6, 7, 8, 9 are given the CSS classes 'ie6',
|
94
94
|
'ie7', 'ie8', and 'ie9' respectively. IE > 9 has no additional class
|
95
|
-
added (which may be overly optimistic). YMMV.
|
95
|
+
added besides 'ie' (which may be overly optimistic). YMMV.
|
96
96
|
|
97
97
|
Configuring
|
98
98
|
-----------
|
@@ -8,13 +8,13 @@ IEConditionalTag.configure do |config|
|
|
8
8
|
# will be prepended to any `:class` attribute given to `ie_conditional_tag`.
|
9
9
|
|
10
10
|
# Add CSS classes for IE 6 - 9
|
11
|
-
config.on 'lt IE 7', :class => 'ie6'
|
12
|
-
config.on 'IE 7', :class => 'ie7'
|
13
|
-
config.on 'IE 8', :class => 'ie8'
|
14
|
-
config.on 'IE 9', :class => 'ie9'
|
11
|
+
config.on 'lt IE 7', :class => 'ie ie6'
|
12
|
+
config.on 'IE 7', :class => 'ie ie7'
|
13
|
+
config.on 'IE 8', :class => 'ie ie8'
|
14
|
+
config.on 'IE 9', :class => 'ie ie9'
|
15
15
|
|
16
|
-
# For IE >= 9,
|
17
|
-
config.on 'gt IE 9'
|
16
|
+
# For IE >= 9, just add ie class
|
17
|
+
config.on 'gt IE 9', :class => 'ie'
|
18
18
|
|
19
19
|
# For all other browsers
|
20
20
|
# Note: Don't remove this line-- or other browsers won't get a
|
data/test/helper.rb
CHANGED
@@ -6,6 +6,11 @@ require 'action_view'
|
|
6
6
|
require 'action_controller'
|
7
7
|
require 'action_controller/test_case'
|
8
8
|
|
9
|
+
begin
|
10
|
+
require 'turn'
|
11
|
+
rescue LoadError
|
12
|
+
end
|
13
|
+
|
9
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
10
15
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
11
16
|
|
data/test/test_condition.rb
CHANGED
@@ -3,8 +3,8 @@ require 'helper'
|
|
3
3
|
class TestCondition < ActionView::TestCase
|
4
4
|
|
5
5
|
test "wrapping a tag in a protected condition without additional options" do
|
6
|
-
condition = IEConditionalTag::ProtectedCondition.new('IE 6', :class => 'ie6')
|
7
|
-
assert_equal(%Q(<!--[if IE 6]><body class="ie6"><![endif]-->\n),
|
6
|
+
condition = IEConditionalTag::ProtectedCondition.new('IE 6', :class => 'ie ie6')
|
7
|
+
assert_equal(%Q(<!--[if IE 6]><body class="ie ie6"><![endif]-->\n),
|
8
8
|
condition.wrap { |opts| tag(:body, opts, true) })
|
9
9
|
end
|
10
10
|
|
@@ -19,12 +19,12 @@ class TestCondition < ActionView::TestCase
|
|
19
19
|
end
|
20
20
|
|
21
21
|
test "wrapping a tag in a protected condition with additional options" do
|
22
|
-
condition = IEConditionalTag::ProtectedCondition.new('IE 6', :id => 'override', :class => 'ie6')
|
22
|
+
condition = IEConditionalTag::ProtectedCondition.new('IE 6', :id => 'override', :class => 'ie ie6')
|
23
23
|
result = condition.wrap(:id => 'custom', :class => 'basic') { |opts| tag(:body, opts, true) }
|
24
24
|
|
25
25
|
wrapper_pattern = Regexp.new(Regexp.quote('<!--[if IE 6]><body ') + '[^>]+' + Regexp.quote('><![endif]-->'))
|
26
26
|
assert result =~ wrapper_pattern
|
27
|
-
assert result.include?('class="ie6 basic"')
|
27
|
+
assert result.include?('class="ie ie6 basic"')
|
28
28
|
assert result.include?('id="override"')
|
29
29
|
end
|
30
30
|
|
data/test/test_tag_helper.rb
CHANGED
@@ -8,32 +8,32 @@ class TestIEConditionalTag < ActionView::TestCase
|
|
8
8
|
@response = ActionController::TestResponse.new
|
9
9
|
IEConditionalTag.config.clear
|
10
10
|
IEConditionalTag.configure do |config|
|
11
|
-
config.on 'lt IE 7', :class => 'ie6'
|
12
|
-
config.on 'IE 7', :class => 'ie7'
|
13
|
-
config.on 'IE 8', :class => 'ie8'
|
14
|
-
config.on 'IE 9', :class => 'ie9'
|
15
|
-
config.on 'gt IE 9'
|
11
|
+
config.on 'lt IE 7', :class => 'ie ie6'
|
12
|
+
config.on 'IE 7', :class => 'ie ie7'
|
13
|
+
config.on 'IE 8', :class => 'ie ie8'
|
14
|
+
config.on 'IE 9', :class => 'ie ie9'
|
15
|
+
config.on 'gt IE 9', :class => 'ie'
|
16
16
|
config.on '!IE'
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
test "browser body tag with no options and no block" do
|
21
21
|
rendered = String.new(ie_conditional_tag(:html))
|
22
|
-
assert rendered.include?('<!--[if lt IE 7]><html class="ie6"><![endif]-->'), rendered
|
23
|
-
assert rendered.include?('<!--[if IE 7]><html class="ie7"><![endif]-->'), rendered
|
24
|
-
assert rendered.include?('<!--[if IE 8]><html class="ie8"><![endif]-->'), rendered
|
25
|
-
assert rendered.include?('<!--[if IE 9]><html class="ie9"><![endif]-->'), rendered
|
26
|
-
assert rendered.include?('<!--[if gt IE 9]><html><![endif]-->'), rendered
|
22
|
+
assert rendered.include?('<!--[if lt IE 7]><html class="ie ie6"><![endif]-->'), rendered
|
23
|
+
assert rendered.include?('<!--[if IE 7]><html class="ie ie7"><![endif]-->'), rendered
|
24
|
+
assert rendered.include?('<!--[if IE 8]><html class="ie ie8"><![endif]-->'), rendered
|
25
|
+
assert rendered.include?('<!--[if IE 9]><html class="ie ie9"><![endif]-->'), rendered
|
26
|
+
assert rendered.include?('<!--[if gt IE 9]><html class="ie"><![endif]-->'), rendered
|
27
27
|
assert rendered.include?('<!--[if !IE]><!--><html><!--<![endif]-->'), rendered
|
28
28
|
end
|
29
29
|
|
30
30
|
test "browser body tag with class option and no block" do
|
31
31
|
rendered = String.new(ie_conditional_tag(:html, :class => 'custom-class'))
|
32
|
-
assert rendered.include?('<!--[if lt IE 7]><html class="ie6 custom-class"><![endif]-->'), rendered
|
33
|
-
assert rendered.include?('<!--[if IE 7]><html class="ie7 custom-class"><![endif]-->'), rendered
|
34
|
-
assert rendered.include?('<!--[if IE 8]><html class="ie8 custom-class"><![endif]-->'), rendered
|
35
|
-
assert rendered.include?('<!--[if IE 9]><html class="ie9 custom-class"><![endif]-->'), rendered
|
36
|
-
assert rendered.include?('<!--[if gt IE 9]><html class="custom-class"><![endif]-->'), rendered
|
32
|
+
assert rendered.include?('<!--[if lt IE 7]><html class="ie ie6 custom-class"><![endif]-->'), rendered
|
33
|
+
assert rendered.include?('<!--[if IE 7]><html class="ie ie7 custom-class"><![endif]-->'), rendered
|
34
|
+
assert rendered.include?('<!--[if IE 8]><html class="ie ie8 custom-class"><![endif]-->'), rendered
|
35
|
+
assert rendered.include?('<!--[if IE 9]><html class="ie ie9 custom-class"><![endif]-->'), rendered
|
36
|
+
assert rendered.include?('<!--[if gt IE 9]><html class="ie custom-class"><![endif]-->'), rendered
|
37
37
|
assert rendered.include?('<!--[if !IE]><!--><html class="custom-class"><!--<![endif]-->'), rendered
|
38
38
|
end
|
39
39
|
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ie_conditional_tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 0
|
9
|
-
version: 0.4.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.5.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Anthony Burns
|
@@ -15,7 +11,7 @@ autorequire:
|
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
13
|
|
18
|
-
date:
|
14
|
+
date: 2011-05-09 00:00:00 -07:00
|
19
15
|
default_executable:
|
20
16
|
dependencies:
|
21
17
|
- !ruby/object:Gem::Dependency
|
@@ -26,32 +22,22 @@ dependencies:
|
|
26
22
|
requirements:
|
27
23
|
- - ~>
|
28
24
|
- !ruby/object:Gem::Version
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
25
|
version: "3.0"
|
33
26
|
type: :runtime
|
34
27
|
version_requirements: *id001
|
35
28
|
description: Provides an easy-to-use helper for generating multiple tags inside IE-specific conditional comments
|
36
|
-
email:
|
29
|
+
email:
|
30
|
+
- bruce@codefluency.com
|
37
31
|
executables: []
|
38
32
|
|
39
33
|
extensions: []
|
40
34
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.md
|
35
|
+
extra_rdoc_files: []
|
36
|
+
|
44
37
|
files:
|
45
|
-
- .document
|
46
|
-
- .gitignore
|
47
|
-
- LICENSE
|
48
|
-
- README.md
|
49
|
-
- Rakefile
|
50
|
-
- VERSION
|
51
38
|
- lib/generators/ie_conditional_tag/install_generator.rb
|
52
|
-
- lib/generators/templates/README
|
53
39
|
- lib/generators/templates/ie_conditional_tag.rb
|
54
|
-
- lib/
|
40
|
+
- lib/generators/templates/README
|
55
41
|
- lib/ie_conditional_tag/condition.rb
|
56
42
|
- lib/ie_conditional_tag/configuration.rb
|
57
43
|
- lib/ie_conditional_tag/dsl.rb
|
@@ -59,17 +45,21 @@ files:
|
|
59
45
|
- lib/ie_conditional_tag/protected_condition.rb
|
60
46
|
- lib/ie_conditional_tag/railtie.rb
|
61
47
|
- lib/ie_conditional_tag/unprotected_condition.rb
|
48
|
+
- lib/ie_conditional_tag/version.rb
|
49
|
+
- lib/ie_conditional_tag.rb
|
62
50
|
- test/helper.rb
|
63
51
|
- test/test_condition.rb
|
64
52
|
- test/test_configuration.rb
|
65
53
|
- test/test_tag_helper.rb
|
54
|
+
- LICENSE
|
55
|
+
- README.md
|
66
56
|
has_rdoc: true
|
67
57
|
homepage: http://github.com/bruce/ie_conditional_tag
|
68
58
|
licenses: []
|
69
59
|
|
70
60
|
post_install_message:
|
71
|
-
rdoc_options:
|
72
|
-
|
61
|
+
rdoc_options: []
|
62
|
+
|
73
63
|
require_paths:
|
74
64
|
- lib
|
75
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -77,26 +67,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
67
|
requirements:
|
78
68
|
- - ">="
|
79
69
|
- !ruby/object:Gem::Version
|
80
|
-
segments:
|
81
|
-
- 0
|
82
70
|
version: "0"
|
83
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
72
|
none: false
|
85
73
|
requirements:
|
86
74
|
- - ">="
|
87
75
|
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: "0"
|
76
|
+
version: 1.3.6
|
91
77
|
requirements: []
|
92
78
|
|
93
79
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 1.6.2
|
95
81
|
signing_key:
|
96
82
|
specification_version: 3
|
97
83
|
summary: IE conditional comments for Rails
|
98
|
-
test_files:
|
99
|
-
|
100
|
-
- test/test_condition.rb
|
101
|
-
- test/test_configuration.rb
|
102
|
-
- test/test_tag_helper.rb
|
84
|
+
test_files: []
|
85
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "ie_conditional_tag"
|
8
|
-
gem.summary = %Q{IE conditional comments for Rails}
|
9
|
-
gem.description = %Q{Provides an easy-to-use helper for generating multiple tags inside IE-specific conditional comments}
|
10
|
-
gem.email = "bruce@codefluency.com"
|
11
|
-
gem.homepage = "http://github.com/bruce/ie_conditional_tag"
|
12
|
-
gem.authors = ["Anthony Burns", "Bruce Williams"]
|
13
|
-
gem.add_dependency 'rails', '~> 3.0'
|
14
|
-
end
|
15
|
-
Jeweler::GemcutterTasks.new
|
16
|
-
rescue LoadError
|
17
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
-
end
|
19
|
-
|
20
|
-
require 'rake/testtask'
|
21
|
-
Rake::TestTask.new(:test) do |test|
|
22
|
-
test.libs << 'lib' << 'test'
|
23
|
-
test.pattern = 'test/**/test_*.rb'
|
24
|
-
test.verbose = true
|
25
|
-
end
|
26
|
-
|
27
|
-
begin
|
28
|
-
require 'rcov/rcovtask'
|
29
|
-
Rcov::RcovTask.new do |test|
|
30
|
-
test.libs << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
rescue LoadError
|
35
|
-
task :rcov do
|
36
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
task :test => :check_dependencies
|
41
|
-
|
42
|
-
task :default => :test
|
43
|
-
|
44
|
-
require 'rake/rdoctask'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
-
|
48
|
-
rdoc.rdoc_dir = 'rdoc'
|
49
|
-
rdoc.title = "ie_conditional_tag #{version}"
|
50
|
-
rdoc.rdoc_files.include('README*')
|
51
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.0
|