| 141 | |
| 142 | test( 'attrs() should return named attributes created with single, double, and no quotes', function() { |
| 143 | var expected = { |
| 144 | 'named': { |
| 145 | 'param': 'foo', |
| 146 | 'another': 'bar', |
| 147 | 'andagain': 'baz' |
| 148 | }, 'numeric' : [] |
| 149 | }; |
| 150 | |
| 151 | deepEqual( wp.shortcode.attrs('param="foo" another=\'bar\' andagain=baz'), expected, 'attr parsed all three named types'); |
| 152 | }); |
| 153 | |
| 154 | test( 'attrs() should return numeric attributes in the order they are used', function() { |
| 155 | var expected = { |
| 156 | 'named': {}, 'numeric' : ['foo', 'bar', 'baz'] |
| 157 | }; |
| 158 | |
| 159 | deepEqual( wp.shortcode.attrs('foo bar baz'), expected, 'attr parsed numeric attributes'); |
| 160 | }); |
| 161 | |
| 162 | test( 'attrs() should return numeric attributes in the order they are used when they have named attributes in between', function() { |
| 163 | var expected = { |
| 164 | 'named': { 'not': 'a blocker' }, 'numeric' : ['foo', 'bar', 'baz'] |
| 165 | }; |
| 166 | |
| 167 | deepEqual( wp.shortcode.attrs('foo not="a blocker" bar baz'), expected, 'attr parsed numeric attributes'); |
| 168 | }); |