thin_man 0.12.2 → 0.12.3

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: 552f56c02bdcf8d239adef6664cd2a703fdfa73b
4
- data.tar.gz: b8d00fd53e59161da7aa4fcc13a9eb8413893c28
3
+ metadata.gz: 7876c85cc5ac8eba96b68d282342768f4c324fea
4
+ data.tar.gz: 5d6e382a7d82aa90622dfaf35cd9a72630f58208
5
5
  SHA512:
6
- metadata.gz: 51cfcb2548d1a243271372a54b4e1466b323545cbea3efd1070974ad5f8065928a37421fd0069563e5a6d6be6a6e96df20e7bc6d9a09e52f1a466486246b9790
7
- data.tar.gz: ce42eac38120121da97fd4ad3db5953ae0c2d71b6593ceb1668eb20631cd0446233b65d44d4df8676d7dbbb00e4db16b49ce4fabf5f7bae001bf1c6c50482b6b
6
+ metadata.gz: 9f89b005636a4a6994b1bc23f64d9ca9d45dcdcf13c2e4166f5f44d3754a3c55cee066cec6e63fda161e0b530b05cb30e9560312335d52167bb8ff99d71c3a03
7
+ data.tar.gz: 008f8123e5847514aafff0168dfb392c5c50feb633f2acf975332cb63ebc6aab09a2b16206d62cda84e6d82c39a2cbf71c1741ffcf195c520c47493f6050cccd
@@ -47,7 +47,13 @@ var initThinMan = function(){
47
47
  getTarget: function(){
48
48
  var target_selector = this.jq_obj.data('ajax-target');
49
49
  if(target_selector){
50
- this.target = $(target_selector);
50
+ if($(target_selector).length > 0){
51
+ this.target = $(target_selector);
52
+ }else{
53
+ console.log('Warning! Thin Man selector ' + target_selector + ' not found')
54
+ }
55
+ }else{
56
+ console.log('Warning! Thin Man selector not given')
51
57
  }
52
58
  },
53
59
  getErrorTarget: function(){
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.12.2"
2
+ VERSION = "0.12.3"
3
3
  end
@@ -182,5 +182,30 @@ describe("thin_man", function(){
182
182
  });
183
183
  });
184
184
 
185
+ describe("Log", function(){
186
+ beforeEach(function(){
187
+ spyOn(console, 'log');
188
+ });
189
+
190
+ it("Don't show a warning with a valid target", function(){
191
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
192
+ $target = affix('#test_dom_id');
193
+ thin = new thin_man.AjaxLinkSubmission($link);
194
+ expect(console.log).not.toHaveBeenCalled();
195
+ });
196
+
197
+ it("Show a warning when target not found", function(){
198
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#not_valid_target"]');
199
+ thin = new thin_man.AjaxLinkSubmission($link);
200
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector #not_valid_target not found');
201
+ });
202
+
203
+ it("Show a warning when target not provided", function(){
204
+ $link = affix('a[data-ajax-link="true"]');
205
+ thin = new thin_man.AjaxLinkSubmission($link);
206
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector not given');
207
+ });
208
+ });
209
+
185
210
  });
186
211
  });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Draut, Adam Bialek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails