11const { remoteForm : _remoteForm , remoteUninstall} = window . remoteForm
22
3- describe ( 'remoteForm' , function ( ) {
3+ describe ( 'remoteForm' , function ( ) {
44 let htmlForm
55
6- beforeEach ( function ( ) {
6+ beforeEach ( function ( ) {
77 document . body . innerHTML = `
88 <form action="/ok" class="my-remote-form remote-widget" method="post" target="submit-fallback">
99 <input name="query" value="hello">
@@ -24,15 +24,15 @@ describe('remoteForm', function() {
2424 _remoteForm ( selector , fn )
2525 }
2626
27- afterEach ( function ( ) {
27+ afterEach ( function ( ) {
2828 for ( const [ selector , fn ] of installed ) {
2929 remoteUninstall ( selector , fn )
3030 }
3131 installed . length = 0
3232 } )
3333
34- it ( 'submits the form with fetch' , function ( done ) {
35- remoteForm ( '.my-remote-form' , async function ( form , wants , req ) {
34+ it ( 'submits the form with fetch' , function ( done ) {
35+ remoteForm ( '.my-remote-form' , async function ( form , wants , req ) {
3636 assert . ok ( req . url . endsWith ( '/ok' ) )
3737 assert . instanceOf ( req . body , FormData )
3838
@@ -45,10 +45,10 @@ describe('remoteForm', function() {
4545 document . querySelector ( 'button[type=submit]' ) . click ( )
4646 } )
4747
48- it ( 'server failure scenario' , function ( done ) {
48+ it ( 'server failure scenario' , function ( done ) {
4949 htmlForm . action = 'server-error'
5050
51- remoteForm ( '.my-remote-form' , async function ( form , wants ) {
51+ remoteForm ( '.my-remote-form' , async function ( form , wants ) {
5252 try {
5353 await wants . html ( )
5454 assert . ok ( false , 'should not resolve' )
@@ -62,14 +62,14 @@ describe('remoteForm', function() {
6262 document . querySelector ( 'button[type=submit]' ) . click ( )
6363 } )
6464
65- it ( 'chained handlers' , function ( done ) {
65+ it ( 'chained handlers' , function ( done ) {
6666 let previousCallbackCalled = false
67- remoteForm ( '.remote-widget' , async function ( ) {
67+ remoteForm ( '.remote-widget' , async function ( ) {
6868 await new Promise ( resolve => setTimeout ( resolve , 10 ) )
6969 previousCallbackCalled = true
7070 } )
7171
72- remoteForm ( '.my-remote-form' , async function ( ) {
72+ remoteForm ( '.my-remote-form' , async function ( ) {
7373 if ( previousCallbackCalled ) {
7474 done ( )
7575 } else {
@@ -80,12 +80,12 @@ describe('remoteForm', function() {
8080 document . querySelector ( 'button[type=submit]' ) . click ( )
8181 } )
8282
83- it ( 'exception in js handlers results in form submitting normally' , async function ( ) {
84- remoteForm ( '.remote-widget' , function ( ) {
83+ it ( 'exception in js handlers results in form submitting normally' , async function ( ) {
84+ remoteForm ( '.remote-widget' , function ( ) {
8585 throw new Error ( 'ignore me' )
8686 } )
8787
88- remoteForm ( '.my-remote-form' , async function ( form , wants ) {
88+ remoteForm ( '.my-remote-form' , async function ( form , wants ) {
8989 try {
9090 await wants . text ( )
9191 assert . ok ( false , 'should never happen' )
@@ -111,8 +111,8 @@ describe('remoteForm', function() {
111111 assert . match ( iframe . contentWindow . location . href , / \/ o k $ / )
112112 } )
113113
114- it ( 'GET form serializes data to URL' , function ( done ) {
115- remoteForm ( '.my-remote-form' , async function ( form , wants , req ) {
114+ it ( 'GET form serializes data to URL' , function ( done ) {
115+ remoteForm ( '.my-remote-form' , async function ( form , wants , req ) {
116116 assert . isNull ( req . body )
117117 await wants . html ( )
118118 done ( )
@@ -123,8 +123,8 @@ describe('remoteForm', function() {
123123 button . click ( )
124124 } )
125125
126- it ( 'GET form serializes data to URL with existing query' , function ( done ) {
127- remoteForm ( '.my-remote-form' , async function ( form , wants ) {
126+ it ( 'GET form serializes data to URL with existing query' , function ( done ) {
127+ remoteForm ( '.my-remote-form' , async function ( form , wants ) {
128128 await wants . html ( )
129129 done ( )
130130 } )
0 commit comments