center_image_tag 0.0.10 → 0.0.11

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTFlMGY5M2E1ZTQxZWMxMjJiMjk3ZGUyMjM1NGE1MWRkZWIzNWM2Ng==
4
+ ODMwNWMyZDBlZDMxOTdjZjg5OGMzMWEyMzNlNGEwNDBmZGJiYWI2Mw==
5
5
  data.tar.gz: !binary |-
6
- NDI2ZWZhMGNhNjIxMjU3NGFkMjZhYTkyNjMxY2MyYjZhYjBlMmY2NQ==
6
+ YmY2NTY2YTM1OTY2ZWZlOTVjNWMwODRiYjczMzgxYTM0ZGUxMWFjMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjBlNWY2YzcxYTA2NmQ4NGQ4OWMwZGFkNWU5MzEzOWE5MjYxNWVjZDNjNDRi
10
- ZWFjYTg0NmU5ZWQ3NTRiMTcwNmJlODM4ZjNjZTE0OWQwN2FlMTA5ZGFiNzNh
11
- MDc0MDg0ZTBjY2ViYWVhNTBkNzQ4Yjk4N2U5ODY0MmNmNGU2NWY=
9
+ ZWVlZjg1YzM1YjE2Y2RhYzkzNjk2MGJlZjUzNjQ3M2M2OTdiMWZmOWNmMTg0
10
+ MTMyOThiOTBmZDlkMjMzZGY4NmFhOWYzNWViY2U5YzYzODIxZGJkNmFjZjdi
11
+ MzY5NWZlYTdkNjFmNjIzYWY2MmFlNGQ4NjcxZjYzMzQ3OGY5MDU=
12
12
  data.tar.gz: !binary |-
13
- MGZhOWZjNzQ4MDI4NTQzMTVmOWFmMzcyY2UxY2Q2MTA2YWM3ZTA5MjM3NTM1
14
- ZmVjMmMyNzkyOTFjMjBkZWI1MGE4ZTUzM2ZmMDM5MDZhYjc4YTMwZjRiZmE1
15
- YjQ1NmRkMmIzNzU1MDU0ZTRkNGQ0MGI1ODViMGM1NWU5MjI4NWM=
13
+ OGZkZjVhYjc2ZTU3YWQ2YWVlYmI2NTBkYmIwZWQ3ZDlmNzYwMThmNTBlZjM5
14
+ ODFiMWViN2NmOWIyOTg3MGViZDg0ZDA0ODZhN2QxNjhhMDRiZTg4NmI2ZWU0
15
+ ODAwY2ZkNzUxM2U1MDhiNmFjMWRiZmQ1MjMwYjE0OGY3NTJmZGM=
@@ -16,11 +16,12 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ["lib", "vendor"]
20
20
 
21
21
  spec.add_dependency 'actionpack', '>= 3.0'
22
+ spec.add_dependency 'railties', ">= 3.1"
22
23
 
23
- spec.add_development_dependency "rake", '>= 0.9.2'
24
+ spec.add_development_dependency 'rake', '>= 0.9.2'
24
25
  spec.add_development_dependency 'rspec', '~> 2.12'
25
26
  spec.add_development_dependency 'rspec-mocks', '>= 2.12.1'
26
27
  spec.add_development_dependency 'rspec-rails', '~> 2.12'
@@ -0,0 +1,11 @@
1
+ require 'rails/railtie'
2
+
3
+ module CenterImageTag
4
+ class Railtie < Rails::Railtie
5
+ config.after_initialize do |app|
6
+ class ActionView::Base
7
+ include CenterImageTag::ViewHelper
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module CenterImageTag
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -0,0 +1,73 @@
1
+ module CenterImageTag
2
+ module ViewHelper
3
+ include ActionView::Context
4
+ include ActionView::Helpers::TagHelper
5
+ include ActionView::Helpers::AssetTagHelper
6
+
7
+ def center_image_tag(source, options = {})
8
+ container_class = options.delete(:container_class)
9
+ if fluid_percentage = options.delete(:fluid)
10
+ return container_fluid(fluid_percentage, container_class) do
11
+ clip do
12
+ image_tag(source, options) +
13
+ tag(:span, class: "vertical-align")
14
+ end
15
+ end
16
+ else
17
+ width, height = dimension(options)
18
+ if width && height
19
+ return container_fixed(width, height, container_class) do
20
+ clip do
21
+ image_tag(source, rebuild_options(options, width, height)) +
22
+ tag(:span, class: "vertical-align")
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ image_tag(source, options)
29
+ end
30
+
31
+ private
32
+ def container_fluid(fluid_percentage, outer_class, &block)
33
+ div class: "cit-standard-thumb cit-thumb-fluid #{outer_class}" do
34
+ div class: "cit-thumb-default", style: "padding-bottom: #{fluid_percentage}", &block
35
+ end
36
+ end
37
+
38
+ def container_fixed(width, height, outer_class, &block)
39
+ div class: "cit-standard-thumb #{outer_class}", style: "width: #{width}px" do
40
+ div class: "cit-thumb-default", style: "padding-bottom: #{height}px", &block
41
+ end
42
+ end
43
+
44
+ def clip(&block)
45
+ div class: "cit-thumb-clip" do
46
+ div class: "cit-thumb-clip-inner", &block
47
+ end
48
+ end
49
+
50
+ def dimension(options)
51
+ if size = options[:size]
52
+ width, height = size.split("x") if size =~ %r{\A\d+x\d+\z}
53
+ width = height = size if size =~ %r{\A\d+\z}
54
+ else
55
+ width = options[:width]
56
+ height = options[:height]
57
+ end
58
+
59
+ [width, height]
60
+ end
61
+
62
+ def div(options = {}, &block)
63
+ content_tag :div, options, &block
64
+ end
65
+
66
+ def rebuild_options(options, width, height)
67
+ # rebuild options
68
+ options.delete(:size)
69
+ options.delete(:height)
70
+ options.merge(width: width)
71
+ end
72
+ end
73
+ end
@@ -1,77 +1,9 @@
1
1
  require "action_view"
2
2
 
3
3
  require "center_image_tag/version"
4
+ require "center_image_tag/view_helper"
5
+ require "center_image_tag/railtie"
4
6
 
5
7
  module CenterImageTag
6
- include ActionView::Context
7
- include ActionView::Helpers::TagHelper
8
- include ActionView::Helpers::AssetTagHelper
9
8
 
10
- def center_image_tag(source, options = {})
11
- container_class = options.delete(:container_class)
12
- if fluid_percentage = options.delete(:fluid)
13
- return container_fluid(fluid_percentage, container_class) do
14
- clip do
15
- image_tag(source, options) +
16
- tag(:span, class: "vertical-align")
17
- end
18
- end
19
- else
20
- width, height = dimension(options)
21
- if width && height
22
- return container_fixed(width, height, container_class) do
23
- clip do
24
- image_tag(source, rebuild_options(options, width, height)) +
25
- tag(:span, class: "vertical-align")
26
- end
27
- end
28
- end
29
- end
30
-
31
- image_tag(source, options)
32
- end
33
-
34
- private
35
- def container_fluid(fluid_percentage, outer_class, &block)
36
- div class: "cit-standard-thumb cit-thumb-fluid #{outer_class}" do
37
- div class: "cit-thumb-default", style: "padding-bottom: #{fluid_percentage}", &block
38
- end
39
- end
40
-
41
- def container_fixed(width, height, outer_class, &block)
42
- div class: "cit-standard-thumb #{outer_class}", style: "width: #{width}px" do
43
- div class: "cit-thumb-default", style: "padding-bottom: #{height}px", &block
44
- end
45
- end
46
-
47
- def clip(&block)
48
- div class: "cit-thumb-clip" do
49
- div class: "cit-thumb-clip-inner", &block
50
- end
51
- end
52
-
53
- def dimension(options)
54
- if size = options[:size]
55
- width, height = size.split("x") if size =~ %r{\A\d+x\d+\z}
56
- width = height = size if size =~ %r{\A\d+\z}
57
- else
58
- width = options[:width]
59
- height = options[:height]
60
- end
61
-
62
- [width, height]
63
- end
64
-
65
- def div(options = {}, &block)
66
- content_tag :div, options, &block
67
- end
68
-
69
- def rebuild_options(options, width, height)
70
- # rebuild options
71
- options.delete(:size)
72
- options.delete(:height)
73
- options.merge(width: width)
74
- end
75
- end
76
-
77
- ActionView::Base.send :include, CenterImageTag
9
+ end
data/spec/spec_helper.rb CHANGED
@@ -7,4 +7,4 @@ RSpec.configure do |config|
7
7
  config.order = :random
8
8
  end
9
9
 
10
- class View; include CenterImageTag; end
10
+ class View; include CenterImageTag::ViewHelper; end
@@ -0,0 +1,143 @@
1
+ require 'spec_helper'
2
+
3
+ module CenterImageTag
4
+ describe ViewHelper do
5
+ describe 'normal' do
6
+ it 'renders the image normally if it\'s not fluid or width x height set' do
7
+ output = View.new.center_image_tag 'image.png'
8
+ expected = "<img alt=\"Image\" src=\"/images/image.png\" />"
9
+ expect(output).to eq expected
10
+ end
11
+
12
+ it 'ignores container_class options' do
13
+ output = View.new.center_image_tag 'image.png', container_class: 'custom-class'
14
+ expected = "<img alt=\"Image\" src=\"/images/image.png\" />"
15
+ expect(output).to eq expected
16
+ end
17
+ end
18
+
19
+ describe 'fluid' do
20
+ it 'renders the fluid image correctly' do
21
+ output = View.new.center_image_tag 'image.png', fluid: "56.25%"
22
+ expected = "<div class=\"cit-standard-thumb cit-thumb-fluid \">" +
23
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 56.25%\">" +
24
+ "<div class=\"cit-thumb-clip\">" +
25
+ "<div class=\"cit-thumb-clip-inner\">" +
26
+ "<img alt=\"Image\" src=\"/images/image.png\" />" +
27
+ "<span class=\"vertical-align\" />" +
28
+ "</div>" +
29
+ "</div>" +
30
+ "</div>" +
31
+ "</div>"
32
+ end
33
+
34
+ it 'renders the fluid image with container class' do
35
+ output = View.new.center_image_tag 'image.png', fluid: "56.25%", container_class: 'custom-class'
36
+ expected = "<div class=\"cit-standard-thumb cit-thumb-fluid custom-class\">" +
37
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 56.25%\">" +
38
+ "<div class=\"cit-thumb-clip\">" +
39
+ "<div class=\"cit-thumb-clip-inner\">" +
40
+ "<img alt=\"Image\" src=\"/images/image.png\" />" +
41
+ "<span class=\"vertical-align\" />" +
42
+ "</div>" +
43
+ "</div>" +
44
+ "</div>" +
45
+ "</div>"
46
+ expect(output).to eq expected
47
+ end
48
+ end
49
+
50
+ describe 'fixed' do
51
+ it 'renders the fixed image correctly from size options (size = widthxheight)' do
52
+ output = View.new.center_image_tag 'image.png', size: "200x100"
53
+ expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
54
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
55
+ "<div class=\"cit-thumb-clip\">" +
56
+ "<div class=\"cit-thumb-clip-inner\">" +
57
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
58
+ "<span class=\"vertical-align\" />" +
59
+ "</div>" +
60
+ "</div>" +
61
+ "</div>" +
62
+ "</div>"
63
+ expect(output).to eq expected
64
+ end
65
+
66
+ it 'renders the fixed image correctly from size options (size = widthxheight) with container class' do
67
+ output = View.new.center_image_tag 'image.png', size: "200x100", container_class: 'custom-class'
68
+ expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
69
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
70
+ "<div class=\"cit-thumb-clip\">" +
71
+ "<div class=\"cit-thumb-clip-inner\">" +
72
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
73
+ "<span class=\"vertical-align\" />" +
74
+ "</div>" +
75
+ "</div>" +
76
+ "</div>" +
77
+ "</div>"
78
+ expect(output).to eq expected
79
+ end
80
+
81
+ it 'renders the fixed image correctly from size options (single size value)' do
82
+ output = View.new.center_image_tag 'image.png', size: "200"
83
+ expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
84
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 200px\">" +
85
+ "<div class=\"cit-thumb-clip\">" +
86
+ "<div class=\"cit-thumb-clip-inner\">" +
87
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
88
+ "<span class=\"vertical-align\" />" +
89
+ "</div>" +
90
+ "</div>" +
91
+ "</div>" +
92
+ "</div>"
93
+ expect(output).to eq expected
94
+ end
95
+
96
+ it 'renders the fixed image correctly from size options (single size value) with container class' do
97
+ output = View.new.center_image_tag 'image.png', size: "200", container_class: 'custom-class'
98
+ expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
99
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 200px\">" +
100
+ "<div class=\"cit-thumb-clip\">" +
101
+ "<div class=\"cit-thumb-clip-inner\">" +
102
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
103
+ "<span class=\"vertical-align\" />" +
104
+ "</div>" +
105
+ "</div>" +
106
+ "</div>" +
107
+ "</div>"
108
+ expect(output).to eq expected
109
+ end
110
+
111
+
112
+ it 'renders the fixed image correctly from width and height options' do
113
+ output = View.new.center_image_tag 'image.png', width: "200", height: 100
114
+ expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
115
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
116
+ "<div class=\"cit-thumb-clip\">" +
117
+ "<div class=\"cit-thumb-clip-inner\">" +
118
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
119
+ "<span class=\"vertical-align\" />" +
120
+ "</div>" +
121
+ "</div>" +
122
+ "</div>" +
123
+ "</div>"
124
+ expect(output).to eq expected
125
+ end
126
+
127
+ it 'renders the fixed image correctly from width and height options with container class' do
128
+ output = View.new.center_image_tag 'image.png', width: "200", height: 100, container_class: 'custom-class'
129
+ expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
130
+ "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
131
+ "<div class=\"cit-thumb-clip\">" +
132
+ "<div class=\"cit-thumb-clip-inner\">" +
133
+ "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
134
+ "<span class=\"vertical-align\" />" +
135
+ "</div>" +
136
+ "</div>" +
137
+ "</div>" +
138
+ "</div>"
139
+ expect(output).to eq expected
140
+ end
141
+ end
142
+ end
143
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: center_image_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anh Nguyen
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -95,9 +109,11 @@ files:
95
109
  - Rakefile
96
110
  - center_image_tag.gemspec
97
111
  - lib/center_image_tag.rb
112
+ - lib/center_image_tag/railtie.rb
98
113
  - lib/center_image_tag/version.rb
99
- - spec/center_image_tag_spec.rb
114
+ - lib/center_image_tag/view_helper.rb
100
115
  - spec/spec_helper.rb
116
+ - spec/view_helper_spec.rb
101
117
  - vendor/assets/stylesheets/center_image_tag.scss
102
118
  homepage: https://github.com/anhkind/center_image_tag
103
119
  licenses:
@@ -107,6 +123,7 @@ post_install_message:
107
123
  rdoc_options: []
108
124
  require_paths:
109
125
  - lib
126
+ - vendor
110
127
  required_ruby_version: !ruby/object:Gem::Requirement
111
128
  requirements:
112
129
  - - ! '>='
@@ -124,5 +141,5 @@ signing_key:
124
141
  specification_version: 4
125
142
  summary: Center your images without js.
126
143
  test_files:
127
- - spec/center_image_tag_spec.rb
128
144
  - spec/spec_helper.rb
145
+ - spec/view_helper_spec.rb
@@ -1,141 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module CenterImageTag
4
- describe 'normal' do
5
- it 'renders the image normally if it\'s not fluid or width x height set' do
6
- output = View.new.center_image_tag 'image.png'
7
- expected = "<img alt=\"Image\" src=\"/images/image.png\" />"
8
- expect(output).to eq expected
9
- end
10
-
11
- it 'ignores container_class options' do
12
- output = View.new.center_image_tag 'image.png', container_class: 'custom-class'
13
- expected = "<img alt=\"Image\" src=\"/images/image.png\" />"
14
- expect(output).to eq expected
15
- end
16
- end
17
-
18
- describe 'fluid' do
19
- it 'renders the fluid image correctly' do
20
- output = View.new.center_image_tag 'image.png', fluid: "56.25%"
21
- expected = "<div class=\"cit-standard-thumb cit-thumb-fluid \">" +
22
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 56.25%\">" +
23
- "<div class=\"cit-thumb-clip\">" +
24
- "<div class=\"cit-thumb-clip-inner\">" +
25
- "<img alt=\"Image\" src=\"/images/image.png\" />" +
26
- "<span class=\"vertical-align\" />" +
27
- "</div>" +
28
- "</div>" +
29
- "</div>" +
30
- "</div>"
31
- end
32
-
33
- it 'renders the fluid image with container class' do
34
- output = View.new.center_image_tag 'image.png', fluid: "56.25%", container_class: 'custom-class'
35
- expected = "<div class=\"cit-standard-thumb cit-thumb-fluid custom-class\">" +
36
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 56.25%\">" +
37
- "<div class=\"cit-thumb-clip\">" +
38
- "<div class=\"cit-thumb-clip-inner\">" +
39
- "<img alt=\"Image\" src=\"/images/image.png\" />" +
40
- "<span class=\"vertical-align\" />" +
41
- "</div>" +
42
- "</div>" +
43
- "</div>" +
44
- "</div>"
45
- expect(output).to eq expected
46
- end
47
- end
48
-
49
- describe 'fixed' do
50
- it 'renders the fixed image correctly from size options (size = widthxheight)' do
51
- output = View.new.center_image_tag 'image.png', size: "200x100"
52
- expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
53
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
54
- "<div class=\"cit-thumb-clip\">" +
55
- "<div class=\"cit-thumb-clip-inner\">" +
56
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
57
- "<span class=\"vertical-align\" />" +
58
- "</div>" +
59
- "</div>" +
60
- "</div>" +
61
- "</div>"
62
- expect(output).to eq expected
63
- end
64
-
65
- it 'renders the fixed image correctly from size options (size = widthxheight) with container class' do
66
- output = View.new.center_image_tag 'image.png', size: "200x100", container_class: 'custom-class'
67
- expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
68
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
69
- "<div class=\"cit-thumb-clip\">" +
70
- "<div class=\"cit-thumb-clip-inner\">" +
71
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
72
- "<span class=\"vertical-align\" />" +
73
- "</div>" +
74
- "</div>" +
75
- "</div>" +
76
- "</div>"
77
- expect(output).to eq expected
78
- end
79
-
80
- it 'renders the fixed image correctly from size options (single size value)' do
81
- output = View.new.center_image_tag 'image.png', size: "200"
82
- expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
83
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 200px\">" +
84
- "<div class=\"cit-thumb-clip\">" +
85
- "<div class=\"cit-thumb-clip-inner\">" +
86
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
87
- "<span class=\"vertical-align\" />" +
88
- "</div>" +
89
- "</div>" +
90
- "</div>" +
91
- "</div>"
92
- expect(output).to eq expected
93
- end
94
-
95
- it 'renders the fixed image correctly from size options (single size value) with container class' do
96
- output = View.new.center_image_tag 'image.png', size: "200", container_class: 'custom-class'
97
- expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
98
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 200px\">" +
99
- "<div class=\"cit-thumb-clip\">" +
100
- "<div class=\"cit-thumb-clip-inner\">" +
101
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
102
- "<span class=\"vertical-align\" />" +
103
- "</div>" +
104
- "</div>" +
105
- "</div>" +
106
- "</div>"
107
- expect(output).to eq expected
108
- end
109
-
110
-
111
- it 'renders the fixed image correctly from width and height options' do
112
- output = View.new.center_image_tag 'image.png', width: "200", height: 100
113
- expected = "<div class=\"cit-standard-thumb \" style=\"width: 200px\">" +
114
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
115
- "<div class=\"cit-thumb-clip\">" +
116
- "<div class=\"cit-thumb-clip-inner\">" +
117
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
118
- "<span class=\"vertical-align\" />" +
119
- "</div>" +
120
- "</div>" +
121
- "</div>" +
122
- "</div>"
123
- expect(output).to eq expected
124
- end
125
-
126
- it 'renders the fixed image correctly from width and height options with container class' do
127
- output = View.new.center_image_tag 'image.png', width: "200", height: 100, container_class: 'custom-class'
128
- expected = "<div class=\"cit-standard-thumb custom-class\" style=\"width: 200px\">" +
129
- "<div class=\"cit-thumb-default\" style=\"padding-bottom: 100px\">" +
130
- "<div class=\"cit-thumb-clip\">" +
131
- "<div class=\"cit-thumb-clip-inner\">" +
132
- "<img alt=\"Image\" src=\"/images/image.png\" width=\"200\" />" +
133
- "<span class=\"vertical-align\" />" +
134
- "</div>" +
135
- "</div>" +
136
- "</div>" +
137
- "</div>"
138
- expect(output).to eq expected
139
- end
140
- end
141
- end