bootstrap_help 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c41d4737f95ad4021d359cab30fc681d16aafb8
4
- data.tar.gz: 67f4e360dcb4512dcdb47535772f54ea8a4924a0
3
+ metadata.gz: a32fadf95b67e0575623ed3c24102eb20243ad93
4
+ data.tar.gz: cc6a822b26a711b929dd834268cadaedeccbe646
5
5
  SHA512:
6
- metadata.gz: 43d622224a3cd5007de397778bdda8395e9a689f7d14e6ecf4a75a4731e238805e3bd86c2efce4076f9f0d6dfc9aaa5971df438fbbe54f4ec238028e1778755d
7
- data.tar.gz: 97ca13598de23fb34aef8482c78ddb8960320cc906fbdfc509c761a97a281cf1d52ce576f78614b1d34382256cdf9d61415051dc6b6b41be504948eec12107d6
6
+ metadata.gz: b0c168d815e67de8bcb990b97d68cc6131be4c8202331bc33259f3eaffd9c25bac44bb220288ae27a2645d04fef5c152ff8bcd6f29f5c23d9b93e63493179320
7
+ data.tar.gz: f41ec31f99b912a2676065e94b5a99d12ca15d5ad46e34da80914eea5783bc9d53abe805baec5ff01b65e048e5cc8ea853f0426ab6f07568197546186f22f350
@@ -0,0 +1,12 @@
1
+ module BootstrapHelp
2
+ module OptionHelpers
3
+ def append_css_class(css_classes=nil, hash={})
4
+ class_string = hash[:class] || ""
5
+ if css_classes.present?
6
+ class_string = class_string + " " + css_classes
7
+ end
8
+ hash[:class] = class_string.strip
9
+ return hash
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module BootstrapHelp
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe BootstrapHelp::OptionHelpers do
4
+ let(:helpers) do
5
+ class HelpersClass
6
+ include BootstrapHelp::OptionHelpers
7
+ end
8
+ HelpersClass.new
9
+ end
10
+
11
+ let(:options_hash) {{ class: "test" }}
12
+
13
+ describe '#append_css_class' do
14
+ it "appends classes to the class value in a hash" do
15
+ new_hash = helpers.append_css_class("btn primary", options_hash)
16
+ expect(new_hash[:class]).to eq("test btn primary")
17
+ end
18
+
19
+ it "returns the same class value if there's nothing to append" do
20
+ new_hash = helpers.append_css_class(nil, options_hash)
21
+ expect(new_hash[:class]).to eq(options_hash[:class])
22
+ end
23
+
24
+ it "returns the same class value if an empty string is appended" do
25
+ new_hash = helpers.append_css_class("", options_hash)
26
+ expect(new_hash[:class]).to eq(options_hash[:class])
27
+ end
28
+
29
+ it "returns a hash with appended values if there is no hash submitted" do
30
+ new_hash = helpers.append_css_class("test")
31
+ expect(new_hash[:class]).to eq("test")
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_help
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Klina
@@ -96,11 +96,13 @@ files:
96
96
  - lib/bootstrap_help.rb
97
97
  - lib/bootstrap_help/button_helpers.rb
98
98
  - lib/bootstrap_help/nav_helpers.rb
99
+ - lib/bootstrap_help/option_helpers.rb
99
100
  - lib/bootstrap_help/railtie.rb
100
101
  - lib/bootstrap_help/table_helpers.rb
101
102
  - lib/bootstrap_help/version.rb
102
103
  - spec/bootstrap_helper/button_helper_spec.rb
103
104
  - spec/bootstrap_helper/nav_helper_spec.rb
105
+ - spec/bootstrap_helper/option_helpers_spec.rb
104
106
  - spec/bootstrap_helper/table_helper_spec.rb
105
107
  - spec/spec_helper.rb
106
108
  homepage: https://github.com/jklina/bootstrap_help
@@ -130,5 +132,6 @@ summary: Twitter Bootstrap makeup generators
130
132
  test_files:
131
133
  - spec/bootstrap_helper/button_helper_spec.rb
132
134
  - spec/bootstrap_helper/nav_helper_spec.rb
135
+ - spec/bootstrap_helper/option_helpers_spec.rb
133
136
  - spec/bootstrap_helper/table_helper_spec.rb
134
137
  - spec/spec_helper.rb