hooch 0.1.0 → 0.2.0
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 +4 -4
- data/app/assets/javascripts/hooch.js +15 -4
- data/jasmine/spec/hoochSpec.js +15 -1
- data/lib/hooch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c983987b651132cb265c5856ff3ed79cef4351f5
|
|
4
|
+
data.tar.gz: 0ff1c5e46583ba88c61675033aa444ff4e815933
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9d97d3f6c920289ce956a45a9158a39e43ee5a5c42533d40abda87d5f0881b99349a27838797eb4f5d90ee2cbcb4a3511a2f0d2623f9a224c4a03abbc62124f
|
|
7
|
+
data.tar.gz: 242c54f8d9e76a2d2c32b14a6884bd4e8c5b9d5c54ec2986a999067474c33daf51841ccd89f588479daeccf6f38c69dc5f503f33427438f6271e4643943e792a
|
|
@@ -177,6 +177,7 @@ var initHooch = function(){
|
|
|
177
177
|
this.$expander = $expander;
|
|
178
178
|
this.target = target;
|
|
179
179
|
this.expand_class = $expander.data('expand-class')
|
|
180
|
+
this.collapse_class = $expander.data('collapse-class')
|
|
180
181
|
if($expander.data('fake-dropdown')){
|
|
181
182
|
target.$expandable.on('click',function(){
|
|
182
183
|
target.toggle();
|
|
@@ -190,15 +191,25 @@ var initHooch = function(){
|
|
|
190
191
|
})
|
|
191
192
|
},
|
|
192
193
|
hide: function(){
|
|
193
|
-
if(this.expand_class){
|
|
194
|
-
|
|
194
|
+
if(this.expand_class || this.collapse_class){
|
|
195
|
+
if(this.expand_class){
|
|
196
|
+
this.$expander.addClass(this.expand_class)
|
|
197
|
+
}
|
|
198
|
+
if(this.collapse_class){
|
|
199
|
+
this.$expander.removeClass(this.collapse_class)
|
|
200
|
+
}
|
|
195
201
|
} else if(this.target.collapsers.length > 0) {
|
|
196
202
|
this.$expander.hide();
|
|
197
203
|
}
|
|
198
204
|
},
|
|
199
205
|
show: function(){
|
|
200
|
-
if(this.expand_class){
|
|
201
|
-
|
|
206
|
+
if(this.expand_class || this.collapse_class){
|
|
207
|
+
if(this.expand_class){
|
|
208
|
+
this.$expander.removeClass(this.expand_class)
|
|
209
|
+
}
|
|
210
|
+
if(this.collapse_class){
|
|
211
|
+
this.$expander.addClass(this.collapse_class)
|
|
212
|
+
}
|
|
202
213
|
} else if(this.target.collapsers.length > 0) {
|
|
203
214
|
this.$expander.show();
|
|
204
215
|
}
|
data/jasmine/spec/hoochSpec.js
CHANGED
|
@@ -34,7 +34,7 @@ describe("hooch", function() {
|
|
|
34
34
|
expect($('[data-expand-state]').css('display')).toEqual('none');
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
it('expands an element with a class and modifies trigger with
|
|
37
|
+
it('expands an element with a class and modifies trigger with an expand class', function(){
|
|
38
38
|
var expander = affix('[data-expander="true"][data-expand-id="my_expander"][data-expand-class="test-class-trigger"]')
|
|
39
39
|
var expandable = affix('[data-expand-state="collapsed"][data-expand-id="my_expander"][data-expand-class="test-class-content"]')
|
|
40
40
|
$('[data-expand-state]').each(function(){new hooch.Expandable($(this))});
|
|
@@ -48,6 +48,20 @@ describe("hooch", function() {
|
|
|
48
48
|
expect($('[data-expander]').hasClass("test-class-trigger")).toBe(false);
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
+
it('expands an element with a class and modifies trigger with a collapse class', function(){
|
|
52
|
+
var expander = affix('[data-expander="true"][data-expand-id="my_expander"][data-collapse-class="test-class-trigger"]')
|
|
53
|
+
var expandable = affix('[data-expand-state="collapsed"][data-expand-id="my_expander"][data-expand-class="test-class-content"]')
|
|
54
|
+
$('[data-expand-state]').each(function(){new hooch.Expandable($(this))});
|
|
55
|
+
expect($('[data-expand-state]').hasClass("test-class-content")).toBe(false);
|
|
56
|
+
expect($('[data-expander]').hasClass("test-class-trigger")).toBe(true);
|
|
57
|
+
$('[data-expander]').click()
|
|
58
|
+
expect($('[data-expand-state]').hasClass("test-class-content")).toBe(true);
|
|
59
|
+
expect($('[data-expander]').hasClass("test-class-trigger")).toBe(false);
|
|
60
|
+
$('[data-expander]').click()
|
|
61
|
+
expect($('[data-expand-state]').hasClass("test-class-content")).toBe(false);
|
|
62
|
+
expect($('[data-expander]').hasClass("test-class-trigger")).toBe(true);
|
|
63
|
+
})
|
|
64
|
+
|
|
51
65
|
it('expands and collapses an element with separate triggers', function(){
|
|
52
66
|
var expander = affix('[data-expander="true"][data-expand-id="my_expander"]')
|
|
53
67
|
var collapser = affix('[data-collapser="true"][data-expand-id="my_expander"]')
|
data/lib/hooch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hooch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Draut
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-06-
|
|
11
|
+
date: 2015-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|