diff options
author | ache <ache@ache.one> | 2019-12-16 17:41:06 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2019-12-16 17:41:06 +0100 |
commit | bae8eecdb821b80f4bfc6555b477fa340c3de0f6 (patch) | |
tree | 5823af1aaffe7c7653f01d615b07315c3b2c3504 /__tests__ | |
parent | Support for custom data attributes (diff) |
Better attribut name convention
Diffstat (limited to '__tests__')
-rw-r--r-- | __tests__/index.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/__tests__/index.js b/__tests__/index.js index fd55430..d6f1ed9 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -190,5 +190,44 @@ This is a test image : ![test](img.jpg){data-id=2} const {contents} = renderExtended(extentedString); t.deepEqual(parse(contents), parse(`<p><em>Wait</em> ! This is a test image : <img src="img.jpg" alt="test" data-id="2"></p>`)); + + t.notDeepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test"></p>`)); +}); + +test('global custom attributes 2', t => { + const renderExtended = generateExtendParser({extends: {image: ['quality']}}); + const extentedString = `*Wait* ! +This is a test image : ![test](img.jpg){data-id-node=2} +`; + const {contents} = renderExtended(extentedString); + t.deepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test" data-id-node="2"></p>`)); + + t.notDeepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test"></p>`)); +}); + +test('global custom attributes 3', t => { + const renderExtended = generateExtendParser({extends: {image: ['quality']}}); + const extentedString = `*Wait* ! +This is a test image : ![test](img.jpg){data--id=2} +`; + const {contents} = renderExtended(extentedString); + t.deepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test"></p>`)); +}); + +test('global custom attributes 4', t => { + const renderExtended = generateExtendParser({extends: {image: ['quality']}}); + const extentedString = `*Wait* ! +This is a test image : ![test](img.jpg){data-i=2} +`; + const {contents} = renderExtended(extentedString); + t.deepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test" data-i=2></p>`)); + + t.notDeepEqual(parse(contents), parse(`<p><em>Wait</em> ! +This is a test image : <img src="img.jpg" alt="test"></p>`)); }); |