QUnit: fix swapped expected/actual fields
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.byteLimit.test.js
index 596c57c..22d2af1 100644 (file)
                description: 'Pass the limit and a callback as input filter',
                $input: $( '<input type="text"/>' )
                        .byteLimit( 6, function ( val ) {
-                               // Invalid title
-                               if ( val === '' ) {
-                                       return '';
-                               }
-
+                               var title = mw.Title.newFromText( String( val ) );
                                // Return without namespace prefix
-                               return new mw.Title( String( val ) ).getMain();
+                               return title ? title.getMain() : '';
                        } ),
                sample: 'User:Sample',
                expected: 'User:Sample'
                $input: $( '<input type="text"/>' )
                        .attr( 'maxlength', '6' )
                        .byteLimit( function ( val ) {
-                               // Invalid title
-                               if ( val === '' ) {
-                                       return '';
-                               }
-
+                               var title = mw.Title.newFromText( String( val ) );
                                // Return without namespace prefix
-                               return new mw.Title( String( val ) ).getMain();
+                               return title ? title.getMain() : '';
                        } ),
                sample: 'User:Sample',
                expected: 'User:Sample'
                description: 'Pass the limit and a callback as input filter',
                $input: $( '<input type="text"/>' )
                        .byteLimit( 6, function ( val ) {
-                               // Invalid title
-                               if ( val === '' ) {
-                                       return '';
-                               }
-
+                               var title = mw.Title.newFromText( String( val ) );
                                // Return without namespace prefix
-                               return new mw.Title( String( val ) ).getMain();
+                               return title ? title.getMain() : '';
                        } ),
                sample: 'User:Example',
                // The callback alters the value to be used to calculeate