|
|
@@ -391,7 +391,7 @@ describe('parser', () => {
|
|
|
|
|
|
it('literal attribute', () => {
|
|
|
// basic
|
|
|
- const ast1 = parse('<input type="text" name="field1" value="hello world">', baseOptions)
|
|
|
+ const ast1 = parse('<input type="text" name="field1" value="hello world" checked>', baseOptions)
|
|
|
expect(ast1.attrsList[0].name).toBe('type')
|
|
|
expect(ast1.attrsList[0].value).toBe('text')
|
|
|
expect(ast1.attrsList[1].name).toBe('name')
|
|
|
@@ -407,6 +407,13 @@ describe('parser', () => {
|
|
|
expect(ast1.attrs[1].value).toBe('"field1"')
|
|
|
expect(ast1.attrs[2].name).toBe('value')
|
|
|
expect(ast1.attrs[2].value).toBe('"hello world"')
|
|
|
+ expect(ast1.attrs[3].name).toBe('checked')
|
|
|
+ expect(ast1.attrs[3].value).toBe('""')
|
|
|
+ // also bind speicals as props
|
|
|
+ expect(ast1.props[0].name).toBe('value')
|
|
|
+ expect(ast1.props[0].value).toBe('"hello world"')
|
|
|
+ expect(ast1.props[1].name).toBe('checked')
|
|
|
+ expect(ast1.props[1].value).toBe('true')
|
|
|
// interpolation warning
|
|
|
parse('<input type="text" name="field1" value="{{msg}}">', baseOptions)
|
|
|
expect('Interpolation inside attributes has been removed').toHaveBeenWarned()
|