Ticket #36263: 36263.2.diff
File 36263.2.diff, 1.7 KB (added by , 8 years ago) |
---|
-
src/wp-includes/js/shortcode.js
216 216 this.attrs = wp.shortcode.attrs( attrs ); 217 217 218 218 // Identify a correctly formatted `attrs` object. 219 } else if ( _. isEqual( _.keys( attrs ), [ 'named', 'numeric' ] )) {220 this.attrs = attrs;219 } else if ( _.difference( _.keys( attrs ), [ 'named', 'numeric' ] ).length === 0 ) { 220 this.attrs = _.defaults( attrs, { named : {}, numeric : [] } ); 221 221 222 222 // Handle a flat object of attributes. 223 223 } else { -
tests/qunit/wp-includes/js/shortcode.js
196 196 197 197 deepEqual( wp.shortcode.attrs('foo not="a blocker" bar baz'), expected, 'attr parsed numeric attributes'); 198 198 }); 199 200 test( 'string() should accept attrs in any order', function() { 201 var expected = '[short abc123 foo="bar"]'; 202 var test = { 203 tag : 'short', 204 type : 'single', 205 attrs : { 206 named : { foo : 'bar' }, 207 numeric : [ 'abc123' ] 208 } 209 } 210 deepEqual( wp.shortcode.string( test ), expected ); 211 var test = { 212 tag : 'short', 213 type : 'single', 214 attrs : { 215 numeric : [ 'abc123' ], 216 named : { foo : 'bar' } 217 } 218 } 219 deepEqual( wp.shortcode.string( test ), expected ); 220 }); 199 221 });