From 82aa13e46232caf39ea8b27f554fd6c667b101cd Mon Sep 17 00:00:00 2001 From: Jayson Harshbarger Date: Tue, 4 Sep 2018 13:51:07 -0600 Subject: Fix braces parsing in quotes --- __tests__/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to '__tests__') diff --git a/__tests__/index.js b/__tests__/index.js index 56158bb..1be433c 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -546,3 +546,17 @@ test('defaultValue name', t => { t.is(r.eaten, 'visible'); }); +test('braces in attr', t => { + const toParse = `{ data-json='{"a": 1, "b": 2}' }`; + const r = parse(toParse); + t.is(r.prop['data-json'], '{"a": 1, "b": 2}'); + t.is(r.eaten, toParse); +}); + +test('nested braces in attr', t => { + const toParse = `{ data-json='{"a": 1, "b": { "c": 4 }}' }`; + const r = parse(toParse); + t.is(r.prop['data-json'], '{"a": 1, "b": { "c": 4 }}'); + t.is(r.eaten, toParse); +}); + -- cgit v1.2.3