11( function ( ) {
22
3- function build_form ( attrs ) {
3+ function buildForm ( attrs ) {
44 attrs = $ . extend ( { action : '/echo' , 'data-remote' : 'true' } , attrs ) ;
55
66 $ ( '#qunit-fixture' ) . append ( $ ( '<form />' , attrs ) )
@@ -17,47 +17,47 @@ function submit(fn) {
1717}
1818
1919asyncTest ( 'form method is read from "method" and not from "data-method"' , 1 , function ( ) {
20- build_form ( { method : 'post' , 'data-method' : 'get' } ) ;
20+ buildForm ( { method : 'post' , 'data-method' : 'get' } ) ;
2121
2222 submit ( function ( e , data , status , xhr ) {
23- App . assert_post_request ( data ) ;
23+ App . assertPostRequest ( data ) ;
2424 } ) ;
2525} ) ;
2626
2727asyncTest ( 'form method is not read from "data-method" attribute in case of missing "method"' , 1 , function ( ) {
28- build_form ( { 'data-method' : 'put' } ) ;
28+ buildForm ( { 'data-method' : 'put' } ) ;
2929
3030 submit ( function ( e , data , status , xhr ) {
31- App . assert_get_request ( data ) ;
31+ App . assertGetRequest ( data ) ;
3232 } ) ;
3333} ) ;
3434
3535asyncTest ( 'form default method is GET' , 1 , function ( ) {
36- build_form ( ) ;
36+ buildForm ( ) ;
3737
3838 submit ( function ( e , data , status , xhr ) {
39- App . assert_get_request ( data ) ;
39+ App . assertGetRequest ( data ) ;
4040 } ) ;
4141} ) ;
4242
4343asyncTest ( 'form url is picked up from "action"' , 1 , function ( ) {
44- build_form ( { method : 'post' } ) ;
44+ buildForm ( { method : 'post' } ) ;
4545
4646 submit ( function ( e , data , status , xhr ) {
47- App . assert_request_path ( data , '/echo' ) ;
47+ App . assertRequestPath ( data , '/echo' ) ;
4848 } ) ;
4949} ) ;
5050
5151asyncTest ( 'form url is read from "action" not "href"' , 1 , function ( ) {
52- build_form ( { method : 'post' , href : '/echo2' } ) ;
52+ buildForm ( { method : 'post' , href : '/echo2' } ) ;
5353
5454 submit ( function ( e , data , status , xhr ) {
55- App . assert_request_path ( data , '/echo' ) ;
55+ App . assertRequestPath ( data , '/echo' ) ;
5656 } ) ;
5757} ) ;
5858
5959asyncTest ( 'prefer JS, but accept any format' , 1 , function ( ) {
60- build_form ( { method : 'post' } ) ;
60+ buildForm ( { method : 'post' } ) ;
6161
6262 submit ( function ( e , data , status , xhr ) {
6363 var accept = data . HTTP_ACCEPT ;
@@ -66,7 +66,7 @@ asyncTest('prefer JS, but accept any format', 1, function() {
6666} ) ;
6767
6868asyncTest ( 'accept application/json if "data-type" is json' , 1 , function ( ) {
69- build_form ( { method : 'post' , 'data-type' : 'json' } ) ;
69+ buildForm ( { method : 'post' , 'data-type' : 'json' } ) ;
7070
7171 submit ( function ( e , data , status , xhr ) {
7272 equal ( data . HTTP_ACCEPT , 'application/json, text/javascript, */*; q=0.01' ) ;
@@ -75,7 +75,7 @@ asyncTest('accept application/json if "data-type" is json', 1, function() {
7575
7676asyncTest ( 'allow empty "data-remote" attribute' , 1 , function ( ) {
7777 var form = $ ( '#qunit-fixture' ) . append ( $ ( '<form action="/echo" data-remote />' ) ) . find ( 'form' ) ;
78-
78+
7979 submit ( function ( ) {
8080 ok ( true , 'form with empty "data-remote" attribute is also allowed' ) ;
8181 } ) ;
@@ -84,7 +84,7 @@ asyncTest('allow empty "data-remote" attribute', 1, function() {
8484asyncTest ( 'allow empty form "action"' , 1 , function ( ) {
8585 var currentLocation , ajaxLocation ;
8686
87- build_form ( { action : '' } ) ;
87+ buildForm ( { action : '' } ) ;
8888
8989 $ ( '#qunit-fixture' ) . find ( 'form' )
9090 . bind ( 'ajax:beforeSend' , function ( e , xhr , settings ) {
@@ -114,7 +114,7 @@ asyncTest('allow empty form "action"', 1, function() {
114114} ) ;
115115
116116asyncTest ( 'sends CSRF token in custom header' , 1 , function ( ) {
117- build_form ( { method : 'post' } ) ;
117+ buildForm ( { method : 'post' } ) ;
118118 $ ( '#qunit-fixture' ) . append ( '<meta name="csrf-token" content="cf50faa3fe97702ca1ae" />' ) ;
119119
120120 submit ( function ( e , data , status , xhr ) {
@@ -123,7 +123,7 @@ asyncTest('sends CSRF token in custom header', 1, function() {
123123} ) ;
124124
125125asyncTest ( 'does not send CSRF token in custom header if crossDomain' , 1 , function ( ) {
126- build_form ( { 'data-cross-domain' : 'true' } ) ;
126+ buildForm ( { 'data-cross-domain' : 'true' } ) ;
127127 $ ( '#qunit-fixture' ) . append ( '<meta name="csrf-token" content="cf50faa3fe97702ca1ae" />' ) ;
128128
129129 // Manually set request header to be XHR, since setting crossDomain: true in .ajax()
@@ -141,7 +141,7 @@ asyncTest('does not send CSRF token in custom header if crossDomain', 1, functio
141141asyncTest ( 'intelligently guesses crossDomain behavior when target URL is a different domain' , 1 , function ( e , xhr ) {
142142
143143 // Don't set data-cross-domain here, just set action to be a different domain than localhost
144- build_form ( { action : 'http://www.alfajango.com' } ) ;
144+ buildForm ( { action : 'http://www.alfajango.com' } ) ;
145145 $ ( '#qunit-fixture' ) . append ( '<meta name="csrf-token" content="cf50faa3fe97702ca1ae" />' ) ;
146146
147147 $ ( '#qunit-fixture' ) . find ( 'form' )
@@ -158,7 +158,7 @@ asyncTest('intelligently guesses crossDomain behavior when target URL is a diffe
158158} ) ;
159159
160160asyncTest ( 'does not set crossDomain if explicitly set to false on element' , 1 , function ( ) {
161- build_form ( { action : 'http://www.alfajango.com' , 'data-cross-domain' : false } ) ;
161+ buildForm ( { action : 'http://www.alfajango.com' , 'data-cross-domain' : false } ) ;
162162 $ ( '#qunit-fixture' ) . append ( '<meta name="csrf-token" content="cf50faa3fe97702ca1ae" />' ) ;
163163
164164 $ ( '#qunit-fixture' ) . find ( 'form' )
0 commit comments