diff options
Diffstat (limited to 'packages/markdown/remark/test/strictness.test.js')
-rw-r--r-- | packages/markdown/remark/test/strictness.test.js | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/packages/markdown/remark/test/strictness.test.js b/packages/markdown/remark/test/strictness.test.js index 314af09af..178d48f74 100644 --- a/packages/markdown/remark/test/strictness.test.js +++ b/packages/markdown/remark/test/strictness.test.js @@ -15,4 +15,126 @@ describe('strictness', () => { `<img src="hi.jpg" /></p>` ); }); + + it('should allow attribute names starting with ":" after element names', async () => { + const { code } = await renderMarkdown( + `<div :class="open ? '' : 'hidden'">Test</div>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<div :class="open ? '' : 'hidden'">Test</div>`); + }); + + it('should allow attribute names starting with ":" after local element names', async () => { + const { code } = await renderMarkdown( + `<div.abc :class="open ? '' : 'hidden'">x</div.abc>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<div.abc :class="open ? '' : 'hidden'">x</div.abc>`); + }); + + it('should allow attribute names starting with ":" after attribute names', async () => { + const { code } = await renderMarkdown( + `<input type="text" disabled :placeholder="hi">`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<input type="text" disabled :placeholder="hi" />`); + }); + + it('should allow attribute names starting with ":" after local attribute names', async () => { + const { code } = await renderMarkdown( + `<input type="text" x-test:disabled :placeholder="hi">`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<input type="text" x-test:disabled :placeholder="hi" />`); + }); + + it('should allow attribute names starting with ":" after attribute values', async () => { + const { code } = await renderMarkdown( + `<input type="text" :placeholder="placeholder">`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<input type="text" :placeholder="placeholder" />`); + }); + + it('should allow attribute names starting with "@" after element names', async () => { + const { code } = await renderMarkdown( + `<button @click="handleClick">Test</button>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<button @click="handleClick">Test</button>`); + }); + + it('should allow attribute names starting with "@" after local element names', async () => { + const { code } = await renderMarkdown( + `<button.local @click="handleClick">Test</button.local>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<button.local @click="handleClick">Test</button.local>`); + }); + + it('should allow attribute names starting with "@" after attribute names', async () => { + const { code } = await renderMarkdown( + `<button disabled @click="handleClick">Test</button>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<button disabled @click="handleClick">Test</button>`); + }); + + it('should allow attribute names starting with "@" after local attribute names', async () => { + const { code } = await renderMarkdown( + `<button x-test:disabled @click="handleClick">Test</button>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<button x-test:disabled @click="handleClick">Test</button>`); + }); + + it('should allow attribute names starting with "@" after attribute values', async () => { + const { code } = await renderMarkdown( + `<button type="submit" @click="handleClick">Test</button>`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<button type="submit" @click="handleClick">Test</button>`); + }); + + it('should allow attribute names containing dots', async () => { + const { code } = await renderMarkdown( + `<input x-on:input.debounce.500ms="fetchResults">`, + {} + ); + + chai + .expect(code.trim()) + .to.equal(`<input x-on:input.debounce.500ms="fetchResults" />`); + }); + }); |