thin_man 0.11.7 → 0.11.8

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f382450fb950849e9b6acefc7f7d87396b28932f
4
- data.tar.gz: ada74643ec245dc142b11d43e977748d96a5c8e8
3
+ metadata.gz: a8a5fa590943be5c0a381ad8ee14457e54925d94
4
+ data.tar.gz: 1ed6481c6f18b1be9b40edbd7ea3c4c3a6de73c3
5
5
  SHA512:
6
- metadata.gz: 5576f9e45dccb31cc47ab8fd16928df348c1e31dad2a0153035ff8a55f693d0e8c03e6bebac990e1fafb7ca54c224d4baa6ead4f208cc97487cd476a942f7e9a
7
- data.tar.gz: cb36327062637c5ec4281483c22b5e8d7abfebd3bf09783f062f7f275b94cc4a3e05a4ec35b47a0ea1ee8ec34e98030647a56d811e99163ff945a29b79e190fe
6
+ metadata.gz: ed16af073355f679dddd1e93b855deb3fc36f4e882cb4e5dfff66f905a8a9ae929942c1ac70329591100eb5763d41f1334174a304217e926bd30d6ce63f956e1
7
+ data.tar.gz: e52cd78c0e44e84ff8acb77770bcd8e425e2bae87d605e746043291d75ce782b1ea4d8359c2969e5f7e306b44df64de804086794ecad5c29875e43ce3f2708db
@@ -88,6 +88,8 @@ var initThinMan = function(){
88
88
  } else if(typeof data === 'object') {
89
89
  if(typeof data.html != 'undefined'){
90
90
  this.insertHtml(data.html)
91
+ } else {
92
+ this.target.empty()
91
93
  }
92
94
  if(typeof data.class_triggers != 'undefined'){
93
95
  $.each(data.class_triggers, function(class_name, params){
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.11.7"
2
+ VERSION = "0.11.8"
3
3
  end
@@ -32,6 +32,12 @@ describe("thin_man", function(){
32
32
  //Check if it's focused
33
33
  expect($("[type='text']").get(0)).toBe(document.activeElement);
34
34
  });
35
+
36
+ it("empties the target if there is no html in the json", function(){
37
+ $target.html('Remove me.')
38
+ thin.ajaxSuccess({flash_message: 'Successfully moved the widget.'}, 'success', TestResponses.success)
39
+ expect($target.html()).toEqual('')
40
+ })
35
41
  });
36
42
 
37
43
  describe(".ajaxComplete", function(){
@@ -67,7 +73,8 @@ describe("thin_man", function(){
67
73
  var $link, thin;
68
74
 
69
75
  beforeEach(function(){
70
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"] #test_dom_id');
76
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
77
+ $target = affix('#test_dom_id');
71
78
  thin = new thin_man.AjaxLinkSubmission($link);
72
79
  });
73
80
 
@@ -80,6 +87,13 @@ describe("thin_man", function(){
80
87
  thin.ajaxError(TestResponses.conflict);
81
88
  expect($('#test_dom_id').html()).toMatch('Required field');
82
89
  });
90
+
91
+ it("empties the target if there is no html in the json", function(){
92
+ $target.affix('#remove_me')
93
+ thin.ajaxError(TestResponses.conflictNoHtml)
94
+ expect($('#test_dom_id').children().length).toEqual(0)
95
+ })
96
+
83
97
  });
84
98
  });
85
99
 
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.11.7
4
+ version: 0.11.8
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: 2015-10-21 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails