Skip to content

Commit d0508e2

Browse files
committed
test: JSON strings in data attributes, #46
1 parent 5539187 commit d0508e2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test-core.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ test('{Attrs} {String} (double quotes)', t => {
116116
t.is(render(fixture), expected);
117117
});
118118

119+
test('{Attrs} {String} (json)', t => {
120+
const fixture = {
121+
attrs: {
122+
'x-data': JSON.stringify({a: 1})
123+
}
124+
};
125+
126+
const expected = '<div x-data=\'{"a":1}\'></div>';
127+
128+
t.is(render(fixture), expected);
129+
});
130+
119131
test('{Content} {String}', t => {
120132
const fixture = {content: 'Hello world!'};
121133
const expected = '<div>Hello world!</div>';

0 commit comments

Comments
 (0)