thin_man 0.19.5 → 0.19.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ThinMan
2
- VERSION = "0.19.5"
2
+ VERSION = "0.19.6"
3
3
  end
@@ -2,70 +2,75 @@
2
2
  // Generated on Thu Sep 10 2015 16:43:39 GMT-0500 (COT)
3
3
 
4
4
  module.exports = function(config) {
5
- config.set({
5
+ config.set({
6
6
 
7
- // base path that will be used to resolve all patterns (eg. files, exclude)
8
- basePath: '',
7
+ // base path that will be used to resolve all patterns (eg. files, exclude)
8
+ basePath: '',
9
9
 
10
10
 
11
- // frameworks to use
12
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13
- frameworks: ['jasmine-ajax', 'jasmine', 'requirejs'],
11
+ // frameworks to use
12
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13
+ frameworks: ['jasmine-ajax', 'jasmine', 'requirejs'],
14
14
 
15
15
 
16
- // list of files / patterns to load in the browser
17
- files: [
18
- 'test-main.js',
19
- {pattern: 'jquery.js'},
20
- {pattern: 'jasmine-fixture.js'},
21
- {pattern: '../../app/assets/javascripts/thin_man.js'},
22
- {pattern: '../../app/assets/javascripts/debug_logger.js'},
23
- {pattern: 'spec/helpers/*.js'},
24
- {pattern: 'spec/**/*Spec.js', included: false}
25
- ],
16
+ // list of files / patterns to load in the browser
17
+ files: [
18
+ 'test-main.js',
19
+ { pattern: 'jquery.js' },
20
+ { pattern: 'jasmine-fixture.js' },
21
+ { pattern: '../../app/assets/javascripts/thin_man.js' },
22
+ { pattern: '../../app/assets/javascripts/debug_logger.js' },
23
+ { pattern: 'spec/helpers/*.js' },
24
+ { pattern: 'spec/**/*Spec.js', included: false }
25
+ ],
26
26
 
27
27
 
28
- // list of files to exclude
29
- exclude: [
30
- ],
28
+ // list of files to exclude
29
+ exclude: [],
31
30
 
32
31
 
33
- // preprocess matching files before serving them to the browser
34
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
35
- preprocessors: {
36
- },
32
+ // preprocess matching files before serving them to the browser
33
+ // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
34
+ preprocessors: {},
37
35
 
38
36
 
39
- // test results reporter to use
40
- // possible values: 'dots', 'progress'
41
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
42
- reporters: ['spec'],
37
+ // test results reporter to use
38
+ // possible values: 'dots', 'progress'
39
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
40
+ reporters: ['spec'],
43
41
 
44
42
 
45
- // web server port
46
- port: 9876,
43
+ // web server port
44
+ port: 9876,
47
45
 
48
46
 
49
- // enable / disable colors in the output (reporters and logs)
50
- colors: true,
47
+ // enable / disable colors in the output (reporters and logs)
48
+ colors: true,
51
49
 
52
50
 
53
- // level of logging
54
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
55
- logLevel: config.LOG_INFO,
51
+ // level of logging
52
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
53
+ logLevel: config.LOG_INFO,
56
54
 
57
55
 
58
- // enable / disable watching file and executing tests whenever any file changes
59
- autoWatch: false,
56
+ // enable / disable watching file and executing tests whenever any file changes
57
+ autoWatch: false,
60
58
 
61
59
 
62
- // start these browsers
63
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
64
- browsers: ['PhantomJS'],
60
+ // start these browsers
61
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
62
+ browsers: ['PhantomJS'],
63
+ // customLaunchers: {
64
+ // 'PhantomJS_custom': {
65
+ // base: 'PhantomJS',
66
+ // debug: true,
67
+ // },
68
+ // },
69
+ // browsers: ['Chrome'],
65
70
 
66
71
 
67
- // Continuous Integration mode
68
- // if true, Karma captures browsers, runs the tests and exits
69
- singleRun: true
70
- })
71
- }
72
+ // Continuous Integration mode
73
+ // if true, Karma captures browsers, runs the tests and exits
74
+ singleRun: true
75
+ })
76
+ }
@@ -1,232 +1,272 @@
1
- describe("thin_man", function(){
1
+ describe("thin_man", function() {
2
2
 
3
- function getAjaxArg(arg_name){
4
- return $.ajax.calls.argsFor(0)[0][arg_name];
5
- }
3
+ function getAjaxArg(arg_name) {
4
+ return $.ajax.calls.argsFor(0)[0][arg_name];
5
+ }
6
6
 
7
- describe("Base class", function(){
8
- beforeAll(function(){
9
- jasmine.Ajax.install();
10
- jasmine.clock().install();
11
- });
12
-
13
- describe(".ajaxSuccess", function(){
14
- var $link, $target, thin;
15
-
16
- beforeEach(function(){
17
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
18
- $target = affix('#test_dom_id');
19
- thin = new thin_man.AjaxLinkSubmission($link);
20
- });
21
-
22
- it("Add result to the target", function(){
23
- thin.ajaxSuccess({ html: "Hello" }, 'success', TestResponses.success)
24
- expect($target.html()).toEqual("Hello")
25
- });
26
-
27
- it("focus on first element", function(){
28
- var form = '<form><input type="text"><textarea>dummy</textarea></form>'
29
- thin.ajaxSuccess(form, 'success', TestResponses.success)
30
- expect($target.html()).toEqual(form);
31
- expect($("[type='text']").length).toEqual(1);
32
- //Check if it's focused
33
- expect($("[type='text']").get(0)).toBe(document.activeElement);
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
- })
41
-
42
- it("handles success with no target", function(){
43
- $no_target_link = affix('a[data-ajax-link="true"][data-ajax-target=""]');
44
- thin = new thin_man.AjaxLinkSubmission($no_target_link);
45
- thin.ajaxSuccess({flash_message: 'Success'},'success', TestResponses.success)
46
- })
47
- });
48
-
49
- describe(".ajaxComplete", function(){
50
- var $link, thin;
51
-
52
- beforeEach(function(){
53
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"] #test_dom_id');
54
- affix('[data-thin-man-flash-template] [data-thin-man-flash-content]');
55
- thin = new thin_man.AjaxLinkSubmission($link);
56
- });
7
+ describe("Base class", function() {
8
+ beforeAll(function() {
9
+ jasmine.Ajax.install();
10
+ jasmine.clock().install();
11
+ });
57
12
 
58
- describe("Display flash message", function(){
59
- it("successfully response", function(){
60
- thin.ajaxComplete(TestResponses.success);
61
- expect(thin.flash.flash_content.text()).toMatch('successfully response');
13
+ describe(".ajaxSuccess", function() {
14
+ var $link, $target, thin;
15
+
16
+ beforeEach(function() {
17
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
18
+ $target = affix('#test_dom_id');
19
+ thin = new thin_man.AjaxLinkSubmission($link);
20
+ });
21
+
22
+ it("Add result to the target", function() {
23
+ thin.ajaxSuccess({ html: "Hello" }, 'success', TestResponses.success)
24
+ expect($target.html()).toEqual("Hello")
25
+ });
26
+
27
+ it("focus on first element", function() {
28
+ var form = '<form><input type="text"><textarea>dummy</textarea></form>'
29
+ thin.ajaxSuccess(form, 'success', TestResponses.success)
30
+ expect($target.html()).toEqual(form);
31
+ expect($("[type='text']").length).toEqual(1);
32
+ //Check if it's focused
33
+ expect($("[type='text']").get(0)).toBe(document.activeElement);
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
+ })
41
+
42
+ it("handles success with no target", function() {
43
+ $no_target_link = affix('a[data-ajax-link="true"][data-ajax-target=""]');
44
+ thin = new thin_man.AjaxLinkSubmission($no_target_link);
45
+ thin.ajaxSuccess({ flash_message: 'Success' }, 'success', TestResponses.success)
46
+ })
62
47
  });
63
48
 
64
- it("error response", function(){
65
- thin.ajaxComplete(TestResponses.error);
66
- expect(thin.flash.flash_content.text()).toMatch('error response');
49
+ describe(".ajaxComplete", function() {
50
+ var $link, thin;
51
+
52
+ beforeEach(function() {
53
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"] #test_dom_id');
54
+ affix('[data-thin-man-flash-template] [data-thin-man-flash-content]');
55
+ thin = new thin_man.AjaxLinkSubmission($link);
56
+ });
57
+
58
+ describe("Display flash message", function() {
59
+ it("successfully response", function() {
60
+ thin.ajaxComplete(TestResponses.success);
61
+ expect(thin.flash.flash_content.text()).toMatch('successfully response');
62
+ });
63
+
64
+ it("error response", function() {
65
+ thin.ajaxComplete(TestResponses.error);
66
+ expect(thin.flash.flash_content.text()).toMatch('error response');
67
+ });
68
+ });
69
+
70
+ it("fade out if flash_persist is false", function() {
71
+ spyOn($.fn, 'fadeOut');
72
+ thin.ajaxComplete(TestResponses.success);
73
+ jasmine.clock().tick(2000);
74
+ expect($.fn.fadeOut).toHaveBeenCalled();
75
+ });
67
76
  });
68
- });
69
-
70
- it("fade out if flash_persist is false", function(){
71
- spyOn($.fn, 'fadeOut');
72
- thin.ajaxComplete(TestResponses.success);
73
- jasmine.clock().tick(2000);
74
- expect($.fn.fadeOut).toHaveBeenCalled();
75
- });
76
- });
77
77
 
78
- describe(".ajaxError", function(){
79
- var $link, thin;
78
+ describe(".ajaxError", function() {
79
+ var $link, thin;
80
80
 
81
- beforeEach(function(){
82
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
83
- $target = affix('#test_dom_id');
84
- thin = new thin_man.AjaxLinkSubmission($link);
85
- });
81
+ beforeEach(function() {
82
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
83
+ $target = affix('#test_dom_id');
84
+ thin = new thin_man.AjaxLinkSubmission($link);
85
+ });
86
86
 
87
- it('as a string', function(){
88
- thin.ajaxError(TestResponses.conflictString);
89
- expect($('#test_dom_id').html()).toMatch('conflict string response');
90
- });
87
+ it('as a string', function() {
88
+ thin.ajaxError(TestResponses.conflictString);
89
+ expect($('#test_dom_id').html()).toMatch('conflict string response');
90
+ });
91
91
 
92
- it('as an object', function(){
93
- thin.ajaxError(TestResponses.conflict);
94
- expect($('#test_dom_id').html()).toMatch('Required field');
95
- });
92
+ it('as an object', function() {
93
+ thin.ajaxError(TestResponses.conflict);
94
+ expect($('#test_dom_id').html()).toMatch('Required field');
95
+ });
96
96
 
97
+ });
97
98
  });
98
- });
99
-
100
- describe("AjaxLinkSubmission", function(){
101
- it("submits an ajax call with options", function(){
102
- var $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-return-type="json"]');
103
- thin_man.AjaxLinkSubmission($link)
104
- spyOn($, 'ajax');
105
- $link.click();
106
- expect($.ajax).toHaveBeenCalled();
107
- expect(getAjaxArg("url")).toMatch("/url");
108
- expect(getAjaxArg("type")).toMatch("PATCH");
109
- expect(getAjaxArg("datatype")).toMatch("json");
110
- expect(thin_man.hasOwnProperty('link_groups')).toEqual(false)
99
+
100
+ describe("AjaxLinkSubmission", function() {
101
+ it("submits an ajax call with options", function() {
102
+ var $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-return-type="json"]');
103
+ thin_man.AjaxLinkSubmission($link)
104
+ spyOn($, 'ajax');
105
+ $link.click();
106
+ expect($.ajax).toHaveBeenCalled();
107
+ expect(getAjaxArg("url")).toMatch("/url");
108
+ expect(getAjaxArg("type")).toMatch("PATCH");
109
+ expect(getAjaxArg("datatype")).toMatch("json");
110
+ expect(thin_man.hasOwnProperty('link_groups')).toEqual(false)
111
+ });
112
+ it("fires grouped links in sequence", function() {
113
+ var $link_zero = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="0"]');
114
+ var $link_one = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="1"]');
115
+ var $link_two = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="2"]');
116
+ zero = new thin_man.AjaxLinkSubmission($link_zero)
117
+ one = new thin_man.AjaxLinkSubmission($link_one)
118
+ two = new thin_man.AjaxLinkSubmission($link_two)
119
+ expect(thin_man.hasOwnProperty('link_groups')).toEqual(true)
120
+ spyOn(one, 'fire')
121
+ spyOn(two, 'fire')
122
+ zero.ajaxComplete()
123
+ expect(one.fire).toHaveBeenCalled();
124
+ expect(two.fire).not.toHaveBeenCalled();
125
+ one.ajaxComplete()
126
+ expect(one.fire.calls.count()).toEqual(1);
127
+ expect(two.fire).toHaveBeenCalled();
128
+ })
111
129
  });
112
- it("fires grouped links in sequence", function(){
113
- var $link_zero = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="0"]');
114
- var $link_one = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="1"]');
115
- var $link_two = affix('a[data-ajax-link-now="true"][data-ajax-target="#test_dom_id"][href="/url"][data-ajax-method="PATCH"][data-sequence-group="test_group"][data-sequence-number="2"]');
116
- zero = new thin_man.AjaxLinkSubmission($link_zero)
117
- one = new thin_man.AjaxLinkSubmission($link_one)
118
- two = new thin_man.AjaxLinkSubmission($link_two)
119
- expect(thin_man.hasOwnProperty('link_groups')).toEqual(true)
120
- spyOn(one,'fire')
121
- spyOn(two,'fire')
122
- zero.ajaxComplete()
123
- expect(one.fire).toHaveBeenCalled();
124
- expect(two.fire).not.toHaveBeenCalled();
125
- one.ajaxComplete()
126
- expect(one.fire.calls.count()).toEqual(1);
127
- expect(two.fire).toHaveBeenCalled();
128
- })
129
- });
130
- describe("DeleteLink", function(){
131
- it("submits an ajax delete call with options", function(){
132
- var $link = affix('a[data-ajax-delete="true"][data-ajax-target="#test_dom_id"][href="/url"]');
133
- var delete_link = new thin_man.DeleteLink($link)
134
- spyOn($, 'ajax');
135
- $link.click();
136
- expect($.ajax).toHaveBeenCalled();
137
- expect(delete_link.getAjaxType()).toEqual('DELETE')
138
- expect(delete_link.getAjaxUrl()).toEqual('/url')
139
- expect(delete_link.trigger).toEqual($link)
140
- })
141
- });
142
- describe("AjaxFormSubmission", function(){
143
- it("submits an ajax call with options", function(){
144
- var $form = affix('form[data-ajax-form="true"][method="PATCH"][action="/url"]');
145
- $form.affix('input[type="text"][name="name"][value="Jon Snow"]')
146
- thin_man.AjaxFormSubmission($form)
147
- spyOn($, 'ajax');
148
- $form.submit();
149
- expect($.ajax).toHaveBeenCalled();
150
- expect(getAjaxArg("url")).toMatch("/url");
151
- expect(getAjaxArg("type")).toMatch("PATCH");
152
- expect(getAjaxArg("datatype")).toMatch("html");
130
+ describe("DeleteLink", function() {
131
+ it("submits an ajax delete call with options", function() {
132
+ var $link = affix('a[data-ajax-delete="true"][data-ajax-target="#test_dom_id"][href="/url"]');
133
+ var delete_link = new thin_man.DeleteLink($link)
134
+ spyOn($, 'ajax');
135
+ $link.click();
136
+ expect($.ajax).toHaveBeenCalled();
137
+ expect(delete_link.getAjaxType()).toEqual('DELETE')
138
+ expect(delete_link.getAjaxUrl()).toEqual('/url')
139
+ expect(delete_link.trigger).toEqual($link)
140
+ })
141
+ it("removes target after delete", function() {
142
+ var $link = affix('a#test_dom_id[data-ajax-delete="true"][data-ajax-target="#test_dom_id"][href="/url"]');
143
+ var data = "";
144
+ var textStatus = "success";
145
+ var jqXHR = new XMLHttpRequest();
146
+ var delete_link = new thin_man.DeleteLink($link)
147
+
148
+ delete_link.ajaxSuccess(data, textStatus, jqXHR)
149
+
150
+ expect($('#test_dom_id').length).toEqual(0)
151
+ })
152
+ it("replaces response after target after delete", function() {
153
+ var $div = affix('div#test_dom_id')
154
+ var $link = $div.affix('a[data-ajax-delete="true"][data-ajax-target="#test_dom_id"][href="/url"]');
155
+ var data = "I'm The Replacement Data";
156
+ var textStatus = "success";
157
+ var jqXHR = new XMLHttpRequest();
158
+ var delete_link = new thin_man.DeleteLink($link)
159
+
160
+ delete_link.ajaxSuccess(data, textStatus, jqXHR)
161
+
162
+ expect($('#test_dom_id').html()).toEqual(data)
163
+ })
164
+ it("replaces response after target after delete and renders flash message", function() {
165
+ var $div = affix('div#test_dom_id')
166
+ var $link = $div.affix('a[data-ajax-delete="true"][data-ajax-target="#test_dom_id"][href="/url"]');
167
+ var $flash = affix('div[data-thin-man-flash-template]');
168
+ var $content = $flash.affix('div[data-thin-man-flash-content]')
169
+
170
+ var data = { html: "I'm Barry Allen", flash_message: "I'm the flash" }
171
+ var textStatus = "success";
172
+ var jqXHR = { responseText: JSON.stringify(data) }
173
+ var delete_link = new thin_man.DeleteLink($link)
174
+
175
+ delete_link.ajaxSuccess(data, textStatus, jqXHR)
176
+ delete_link.ajaxComplete(jqXHR)
177
+
178
+ expect($('#test_dom_id').html()).toEqual(data.html)
179
+ expect($('body').html()).toContain(data.flash_message)
180
+ })
153
181
  });
182
+ describe("AjaxFormSubmission", function() {
183
+ it("submits an ajax call with options", function() {
184
+ var $form = affix('form[data-ajax-form="true"][method="PATCH"][action="/url"]');
185
+ $form.affix('input[type="text"][name="name"][value="Jon Snow"]')
186
+ thin_man.AjaxFormSubmission($form)
187
+ spyOn($, 'ajax');
188
+ $form.submit();
189
+ expect($.ajax).toHaveBeenCalled();
190
+ expect(getAjaxArg("url")).toMatch("/url");
191
+ expect(getAjaxArg("type")).toMatch("PATCH");
192
+ expect(getAjaxArg("datatype")).toMatch("html");
193
+ });
154
194
 
155
- describe("GET request", function(){
156
- var $form;
157
-
158
- beforeEach(function() {
159
- $form = affix('form[data-ajax-form="true"][action="/url"][method="GET"]');
160
- });
161
-
162
- it("serialize data", function(){
163
- $form.affix('input[type="text"][name="name"][value="Jon Snow"]');
164
- var thin = new thin_man.AjaxFormSubmission($form);
165
- spyOn($, 'ajax');
166
- $form.submit();
167
- expect($.ajax).toHaveBeenCalled();
168
- expect(thin.ajax_options.data).toEqual([{ name: 'name', value: 'Jon Snow' },{name: 'thin_man_submitter', value: 'link_now'}]);
169
- });
170
-
171
- it(".getProcessData", function(){
172
- var thin = new thin_man.AjaxFormSubmission($form)
173
- expect(thin.getProcessData()).toBe(true);
174
- });
175
-
176
- it(".sendContentType", function(){
177
- var thin = new thin_man.AjaxFormSubmission($form)
178
- expect(thin.sendContentType()).toBe(true);
179
- });
180
- });
195
+ describe("GET request", function() {
196
+ var $form;
197
+
198
+ beforeEach(function() {
199
+ $form = affix('form[data-ajax-form="true"][action="/url"][method="GET"]');
200
+ });
201
+
202
+ it("serialize data", function() {
203
+ $form.affix('input[type="text"][name="name"][value="Jon Snow"]');
204
+ var thin = new thin_man.AjaxFormSubmission($form);
205
+ spyOn($, 'ajax');
206
+ $form.submit();
207
+ expect($.ajax).toHaveBeenCalled();
208
+ expect(thin.ajax_options.data).toEqual([{ name: 'name', value: 'Jon Snow' }, { name: 'thin_man_submitter', value: 'link_now' }]);
209
+ });
210
+
211
+ it(".getProcessData", function() {
212
+ var thin = new thin_man.AjaxFormSubmission($form)
213
+ expect(thin.getProcessData()).toBe(true);
214
+ });
215
+
216
+ it(".sendContentType", function() {
217
+ var thin = new thin_man.AjaxFormSubmission($form)
218
+ expect(thin.sendContentType()).toBe(true);
219
+ });
220
+ });
181
221
 
182
- describe("POST/PATCH/DELETE request", function(){
183
- var $form;
184
- beforeEach(function(){
185
- $form = affix('form[data-ajax-form="true"][action="/url"]');
186
- });
187
-
188
- it("Set data in a FormData object", function(){
189
- thin_man.AjaxFormSubmission($form)
190
- spyOn($, 'ajax');
191
- $form.submit();
192
- expect(getAjaxArg("data")).toEqual(jasmine.any(FormData));
193
- });
194
-
195
- it(".getProcessData", function(){
196
- var thin = new thin_man.AjaxFormSubmission($form)
197
- expect(thin.getProcessData()).toBe(false);
198
- });
199
-
200
- it(".sendContentType", function(){
201
- var thin = new thin_man.AjaxFormSubmission($form)
202
- expect(thin.sendContentType()).toBe(false);
203
- });
204
- });
222
+ describe("POST/PATCH/DELETE request", function() {
223
+ var $form;
224
+ beforeEach(function() {
225
+ $form = affix('form[data-ajax-form="true"][action="/url"]');
226
+ });
227
+
228
+ it("Set data in a FormData object", function() {
229
+ thin_man.AjaxFormSubmission($form)
230
+ spyOn($, 'ajax');
231
+ $form.submit();
232
+ expect(getAjaxArg("data")).toEqual(jasmine.any(FormData));
233
+ });
234
+
235
+ it(".getProcessData", function() {
236
+ var thin = new thin_man.AjaxFormSubmission($form)
237
+ expect(thin.getProcessData()).toBe(false);
238
+ });
239
+
240
+ it(".sendContentType", function() {
241
+ var thin = new thin_man.AjaxFormSubmission($form)
242
+ expect(thin.sendContentType()).toBe(false);
243
+ });
244
+ });
205
245
 
206
- describe("Log", function(){
207
- beforeEach(function(){
208
- spyOn(console, 'log');
209
- });
210
-
211
- it("Don't show a warning with a valid target", function(){
212
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
213
- $target = affix('#test_dom_id');
214
- thin = new thin_man.AjaxLinkSubmission($link);
215
- expect(console.log).not.toHaveBeenCalled();
216
- });
217
-
218
- it("Show a warning when target not found", function(){
219
- $link = affix('a[data-ajax-link="true"][data-ajax-target="#not_valid_target"]');
220
- thin = new thin_man.AjaxLinkSubmission($link);
221
- expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector #not_valid_target not found');
222
- });
223
-
224
- it("Show a warning when target not provided", function(){
225
- $link = affix('a[data-ajax-link="true"]');
226
- thin = new thin_man.AjaxLinkSubmission($link);
227
- expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector not given');
228
- });
229
- });
246
+ describe("Log", function() {
247
+ beforeEach(function() {
248
+ spyOn(console, 'log');
249
+ });
250
+
251
+ it("Don't show a warning with a valid target", function() {
252
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#test_dom_id"]');
253
+ $target = affix('#test_dom_id');
254
+ thin = new thin_man.AjaxLinkSubmission($link);
255
+ expect(console.log).not.toHaveBeenCalled();
256
+ });
257
+
258
+ it("Show a warning when target not found", function() {
259
+ $link = affix('a[data-ajax-link="true"][data-ajax-target="#not_valid_target"]');
260
+ thin = new thin_man.AjaxLinkSubmission($link);
261
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector #not_valid_target not found');
262
+ });
263
+
264
+ it("Show a warning when target not provided", function() {
265
+ $link = affix('a[data-ajax-link="true"]');
266
+ thin = new thin_man.AjaxLinkSubmission($link);
267
+ expect(console.log).toHaveBeenCalledWith('Warning! Thin Man selector not given');
268
+ });
269
+ });
230
270
 
231
- });
232
- });
271
+ });
272
+ });