|
| 1 | +// strict: true |
| 2 | +require(__dirname).test({ |
| 3 | + xml: '<svg width=20px height=20px />', |
| 4 | + expect: [ |
| 5 | + ['opentagstart', { name: 'svg', attributes: {} }], |
| 6 | + ['error', 'Unquoted attribute value\nLine: 0\nColumn: 12\nChar: 2'], |
| 7 | + ['attribute', { name: 'width', value: '20px' }], |
| 8 | + ['error', 'Unquoted attribute value\nLine: 0\nColumn: 24\nChar: 2'], |
| 9 | + ['attribute', { name: 'height', value: '20px' }], |
| 10 | + ['opentag', { name: 'svg', attributes: { |
| 11 | + width: '20px', |
| 12 | + height: '20px' |
| 13 | + }, isSelfClosing: true }], |
| 14 | + ['closetag', 'svg'], |
| 15 | + ], |
| 16 | + strict: true |
| 17 | +}) |
| 18 | + |
| 19 | +// strict: false |
| 20 | +require(__dirname).test({ |
| 21 | + xml: '<svg width=20px height=20px />', |
| 22 | + expect: [ |
| 23 | + ['opentagstart', { name: 'SVG', attributes: {} }], |
| 24 | + ['attribute', { name: 'WIDTH', value: '20px' }], |
| 25 | + ['attribute', { name: 'HEIGHT', value: '20px' }], |
| 26 | + ['opentag', { name: 'SVG', attributes: { |
| 27 | + WIDTH: '20px', |
| 28 | + HEIGHT: '20px' |
| 29 | + }, isSelfClosing: true }], |
| 30 | + ['closetag', 'SVG'], |
| 31 | + ], |
| 32 | + strict: false |
| 33 | +}) |
| 34 | + |
| 35 | +// strict: true, opt: { unquotedAttributeValues: true } |
| 36 | +require(__dirname).test({ |
| 37 | + xml: '<svg width=20px height=20px />', |
| 38 | + expect: [ |
| 39 | + ['opentagstart', { name: 'svg', attributes: {} }], |
| 40 | + ['attribute', { name: 'width', value: '20px' }], |
| 41 | + ['attribute', { name: 'height', value: '20px' }], |
| 42 | + ['opentag', { name: 'svg', attributes: { |
| 43 | + width: '20px', |
| 44 | + height: '20px' |
| 45 | + }, isSelfClosing: true }], |
| 46 | + ['closetag', 'svg'], |
| 47 | + ], |
| 48 | + strict: true, |
| 49 | + opt: { |
| 50 | + unquotedAttributeValues: true |
| 51 | + } |
| 52 | +}) |
| 53 | + |
| 54 | +// strict: false, opt: { unquotedAttributeValues: true } |
| 55 | +require(__dirname).test({ |
| 56 | + xml: '<svg width=20px height=20px />', |
| 57 | + expect: [ |
| 58 | + ['opentagstart', { name: 'SVG', attributes: {} }], |
| 59 | + ['attribute', { name: 'WIDTH', value: '20px' }], |
| 60 | + ['attribute', { name: 'HEIGHT', value: '20px' }], |
| 61 | + ['opentag', { name: 'SVG', attributes: { |
| 62 | + WIDTH: '20px', |
| 63 | + HEIGHT: '20px' |
| 64 | + }, isSelfClosing: true }], |
| 65 | + ['closetag', 'SVG'], |
| 66 | + ], |
| 67 | + strict: false, |
| 68 | + opt: { |
| 69 | + unquotedAttributeValues: true |
| 70 | + } |
| 71 | +}) |
0 commit comments