Skip to content

Commit 064659a

Browse files
committed
update tests
1 parent eef651f commit 064659a

File tree

4 files changed

+168
-148
lines changed

4 files changed

+168
-148
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ module.exports = {
1919
lines: 93,
2020
},
2121
},
22+
prettierPath: require.resolve('prettier-2'),
2223
};

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"highlight.js": "11.9.0"
8989
},
9090
"devDependencies": {
91+
"prettier-2": "npm:prettier@^2",
9192
"@eslint/js": "^9.17.0",
9293
"@eslint/json": "^0.9.0",
9394
"@types/diff": "^6.0.0",

src/__tests__/diff2html-tests.ts

Lines changed: 148 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ describe('Diff2Html', () => {
928928
<td class="d2h-del d2h-change">
929929
<div class="d2h-code-line">
930930
<span class="d2h-code-line-prefix">-</span>
931-
<span class="d2h-code-line-ctn"><del>&lt;!-- commented code --&gt;</del></span>
931+
<span class="d2h-code-line-ctn">&lt;<del>!-- commented code --</del>&gt;</span>
932932
</div>
933933
</td>
934934
</tr><tr>
@@ -939,7 +939,7 @@ describe('Diff2Html', () => {
939939
<td class="d2h-del d2h-change">
940940
<div class="d2h-code-line">
941941
<span class="d2h-code-line-prefix">-</span>
942-
<span class="d2h-code-line-ctn"><del>&lt;&#x2F;div</del>&gt;</span>
942+
<span class="d2h-code-line-ctn">&lt;<del>&#x2F;div</del>&gt;</span>
943943
</div>
944944
</td>
945945
</tr><tr>
@@ -950,7 +950,7 @@ describe('Diff2Html', () => {
950950
<td class="d2h-ins d2h-change">
951951
<div class="d2h-code-line">
952952
<span class="d2h-code-line-prefix">+</span>
953-
<span class="d2h-code-line-ctn"><ins>&lt;html&gt;</ins></span>
953+
<span class="d2h-code-line-ctn">&lt;<ins>html</ins>&gt;</span>
954954
</div>
955955
</td>
956956
</tr><tr>
@@ -961,7 +961,7 @@ describe('Diff2Html', () => {
961961
<td class="d2h-ins d2h-change">
962962
<div class="d2h-code-line">
963963
<span class="d2h-code-line-prefix">+</span>
964-
<span class="d2h-code-line-ctn"><ins>&lt;body</ins>&gt;</span>
964+
<span class="d2h-code-line-ctn">&lt;<ins>body</ins>&gt;</span>
965965
</div>
966966
</td>
967967
</tr>
@@ -1326,78 +1326,78 @@ describe('Diff2Html', () => {
13261326
colorScheme: ColorSchemeType.AUTO,
13271327
});
13281328
expect(result).toMatchInlineSnapshot(`
1329-
"<div class="d2h-file-list-wrapper d2h-auto-color-scheme">
1330-
<div class="d2h-file-list-header">
1331-
<span class="d2h-file-list-title">Files changed (1)</span>
1332-
<a class="d2h-file-switch d2h-hide">hide</a>
1333-
<a class="d2h-file-switch d2h-show">show</a>
1334-
</div>
1335-
<ol class="d2h-file-list">
1336-
<li class="d2h-file-list-line">
1337-
<span class="d2h-file-name-wrapper">
1338-
<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"
1339-
viewBox="0 0 14 16" width="14">
1340-
<path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>
1341-
</svg> <a href="#d2h-675094" class="d2h-file-name">sample</a>
1342-
<span class="d2h-file-stats">
1343-
<span class="d2h-lines-added">+1</span>
1344-
<span class="d2h-lines-deleted">-1</span>
1345-
</span>
1346-
</span>
1347-
</li>
1348-
</ol>
1349-
</div><div class="d2h-wrapper d2h-auto-color-scheme">
1350-
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
1351-
<div class="d2h-file-header">
1352-
<span class="d2h-file-name-wrapper">
1353-
<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">
1354-
<path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>
1355-
</svg> <span class="d2h-file-name">sample</span>
1356-
<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>
1357-
<label class="d2h-file-collapse">
1358-
<input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">
1359-
Viewed
1360-
</label>
1361-
</div>
1362-
<div class="d2h-file-diff">
1363-
<div class="d2h-code-wrapper">
1364-
<table class="d2h-diff-table">
1365-
<tbody class="d2h-diff-tbody">
1366-
<tr>
1367-
<td class="d2h-code-linenumber d2h-info"></td>
1368-
<td class="d2h-info">
1369-
<div class="d2h-code-line">@@ -1 +1 @@</div>
1370-
</td>
1371-
</tr><tr>
1372-
<td class="d2h-code-linenumber d2h-del d2h-change">
1373-
<div class="line-num1">1</div>
1374-
<div class="line-num2"></div>
1375-
</td>
1376-
<td class="d2h-del d2h-change">
1377-
<div class="d2h-code-line">
1378-
<span class="d2h-code-line-prefix">-</span>
1379-
<span class="d2h-code-line-ctn"><del>test</del></span>
1380-
</div>
1381-
</td>
1382-
</tr><tr>
1383-
<td class="d2h-code-linenumber d2h-ins d2h-change">
1384-
<div class="line-num1"></div>
1385-
<div class="line-num2">1</div>
1386-
</td>
1387-
<td class="d2h-ins d2h-change">
1388-
<div class="d2h-code-line">
1389-
<span class="d2h-code-line-prefix">+</span>
1390-
<span class="d2h-code-line-ctn"><ins>test1</ins></span>
1391-
</div>
1392-
</td>
1393-
</tr>
1394-
</tbody>
1395-
</table>
1396-
</div>
1397-
</div>
1398-
</div>
1399-
</div>"
1400-
`);
1329+
"<div class="d2h-file-list-wrapper d2h-auto-color-scheme">
1330+
<div class="d2h-file-list-header">
1331+
<span class="d2h-file-list-title">Files changed (1)</span>
1332+
<a class="d2h-file-switch d2h-hide">hide</a>
1333+
<a class="d2h-file-switch d2h-show">show</a>
1334+
</div>
1335+
<ol class="d2h-file-list">
1336+
<li class="d2h-file-list-line">
1337+
<span class="d2h-file-name-wrapper">
1338+
<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"
1339+
viewBox="0 0 14 16" width="14">
1340+
<path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>
1341+
</svg> <a href="#d2h-675094" class="d2h-file-name">sample</a>
1342+
<span class="d2h-file-stats">
1343+
<span class="d2h-lines-added">+1</span>
1344+
<span class="d2h-lines-deleted">-1</span>
1345+
</span>
1346+
</span>
1347+
</li>
1348+
</ol>
1349+
</div><div class="d2h-wrapper d2h-auto-color-scheme">
1350+
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
1351+
<div class="d2h-file-header">
1352+
<span class="d2h-file-name-wrapper">
1353+
<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">
1354+
<path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>
1355+
</svg> <span class="d2h-file-name">sample</span>
1356+
<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>
1357+
<label class="d2h-file-collapse">
1358+
<input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">
1359+
Viewed
1360+
</label>
1361+
</div>
1362+
<div class="d2h-file-diff">
1363+
<div class="d2h-code-wrapper">
1364+
<table class="d2h-diff-table">
1365+
<tbody class="d2h-diff-tbody">
1366+
<tr>
1367+
<td class="d2h-code-linenumber d2h-info"></td>
1368+
<td class="d2h-info">
1369+
<div class="d2h-code-line">@@ -1 +1 @@</div>
1370+
</td>
1371+
</tr><tr>
1372+
<td class="d2h-code-linenumber d2h-del d2h-change">
1373+
<div class="line-num1">1</div>
1374+
<div class="line-num2"></div>
1375+
</td>
1376+
<td class="d2h-del d2h-change">
1377+
<div class="d2h-code-line">
1378+
<span class="d2h-code-line-prefix">-</span>
1379+
<span class="d2h-code-line-ctn"><del>test</del></span>
1380+
</div>
1381+
</td>
1382+
</tr><tr>
1383+
<td class="d2h-code-linenumber d2h-ins d2h-change">
1384+
<div class="line-num1"></div>
1385+
<div class="line-num2">1</div>
1386+
</td>
1387+
<td class="d2h-ins d2h-change">
1388+
<div class="d2h-code-line">
1389+
<span class="d2h-code-line-prefix">+</span>
1390+
<span class="d2h-code-line-ctn"><ins>test1</ins></span>
1391+
</div>
1392+
</td>
1393+
</tr>
1394+
</tbody>
1395+
</table>
1396+
</div>
1397+
</div>
1398+
</div>
1399+
</div>"
1400+
`);
14011401
});
14021402
});
14031403

@@ -1468,78 +1468,78 @@ describe('Diff2Html', () => {
14681468
colorScheme: ColorSchemeType.DARK,
14691469
});
14701470
expect(result).toMatchInlineSnapshot(`
1471-
"<div class="d2h-file-list-wrapper d2h-dark-color-scheme">
1472-
<div class="d2h-file-list-header">
1473-
<span class="d2h-file-list-title">Files changed (1)</span>
1474-
<a class="d2h-file-switch d2h-hide">hide</a>
1475-
<a class="d2h-file-switch d2h-show">show</a>
1476-
</div>
1477-
<ol class="d2h-file-list">
1478-
<li class="d2h-file-list-line">
1479-
<span class="d2h-file-name-wrapper">
1480-
<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"
1481-
viewBox="0 0 14 16" width="14">
1482-
<path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>
1483-
</svg> <a href="#d2h-675094" class="d2h-file-name">sample</a>
1484-
<span class="d2h-file-stats">
1485-
<span class="d2h-lines-added">+1</span>
1486-
<span class="d2h-lines-deleted">-1</span>
1487-
</span>
1488-
</span>
1489-
</li>
1490-
</ol>
1491-
</div><div class="d2h-wrapper d2h-dark-color-scheme">
1492-
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
1493-
<div class="d2h-file-header">
1494-
<span class="d2h-file-name-wrapper">
1495-
<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">
1496-
<path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>
1497-
</svg> <span class="d2h-file-name">sample</span>
1498-
<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>
1499-
<label class="d2h-file-collapse">
1500-
<input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">
1501-
Viewed
1502-
</label>
1503-
</div>
1504-
<div class="d2h-file-diff">
1505-
<div class="d2h-code-wrapper">
1506-
<table class="d2h-diff-table">
1507-
<tbody class="d2h-diff-tbody">
1508-
<tr>
1509-
<td class="d2h-code-linenumber d2h-info"></td>
1510-
<td class="d2h-info">
1511-
<div class="d2h-code-line">@@ -1 +1 @@</div>
1512-
</td>
1513-
</tr><tr>
1514-
<td class="d2h-code-linenumber d2h-del d2h-change">
1515-
<div class="line-num1">1</div>
1516-
<div class="line-num2"></div>
1517-
</td>
1518-
<td class="d2h-del d2h-change">
1519-
<div class="d2h-code-line">
1520-
<span class="d2h-code-line-prefix">-</span>
1521-
<span class="d2h-code-line-ctn"><del>test</del></span>
1522-
</div>
1523-
</td>
1524-
</tr><tr>
1525-
<td class="d2h-code-linenumber d2h-ins d2h-change">
1526-
<div class="line-num1"></div>
1527-
<div class="line-num2">1</div>
1528-
</td>
1529-
<td class="d2h-ins d2h-change">
1530-
<div class="d2h-code-line">
1531-
<span class="d2h-code-line-prefix">+</span>
1532-
<span class="d2h-code-line-ctn"><ins>test1</ins></span>
1533-
</div>
1534-
</td>
1535-
</tr>
1536-
</tbody>
1537-
</table>
1538-
</div>
1539-
</div>
1540-
</div>
1541-
</div>"
1542-
`);
1471+
"<div class="d2h-file-list-wrapper d2h-dark-color-scheme">
1472+
<div class="d2h-file-list-header">
1473+
<span class="d2h-file-list-title">Files changed (1)</span>
1474+
<a class="d2h-file-switch d2h-hide">hide</a>
1475+
<a class="d2h-file-switch d2h-show">show</a>
1476+
</div>
1477+
<ol class="d2h-file-list">
1478+
<li class="d2h-file-list-line">
1479+
<span class="d2h-file-name-wrapper">
1480+
<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"
1481+
viewBox="0 0 14 16" width="14">
1482+
<path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>
1483+
</svg> <a href="#d2h-675094" class="d2h-file-name">sample</a>
1484+
<span class="d2h-file-stats">
1485+
<span class="d2h-lines-added">+1</span>
1486+
<span class="d2h-lines-deleted">-1</span>
1487+
</span>
1488+
</span>
1489+
</li>
1490+
</ol>
1491+
</div><div class="d2h-wrapper d2h-dark-color-scheme">
1492+
<div id="d2h-675094" class="d2h-file-wrapper" data-lang="">
1493+
<div class="d2h-file-header">
1494+
<span class="d2h-file-name-wrapper">
1495+
<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">
1496+
<path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>
1497+
</svg> <span class="d2h-file-name">sample</span>
1498+
<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span></span>
1499+
<label class="d2h-file-collapse">
1500+
<input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">
1501+
Viewed
1502+
</label>
1503+
</div>
1504+
<div class="d2h-file-diff">
1505+
<div class="d2h-code-wrapper">
1506+
<table class="d2h-diff-table">
1507+
<tbody class="d2h-diff-tbody">
1508+
<tr>
1509+
<td class="d2h-code-linenumber d2h-info"></td>
1510+
<td class="d2h-info">
1511+
<div class="d2h-code-line">@@ -1 +1 @@</div>
1512+
</td>
1513+
</tr><tr>
1514+
<td class="d2h-code-linenumber d2h-del d2h-change">
1515+
<div class="line-num1">1</div>
1516+
<div class="line-num2"></div>
1517+
</td>
1518+
<td class="d2h-del d2h-change">
1519+
<div class="d2h-code-line">
1520+
<span class="d2h-code-line-prefix">-</span>
1521+
<span class="d2h-code-line-ctn"><del>test</del></span>
1522+
</div>
1523+
</td>
1524+
</tr><tr>
1525+
<td class="d2h-code-linenumber d2h-ins d2h-change">
1526+
<div class="line-num1"></div>
1527+
<div class="line-num2">1</div>
1528+
</td>
1529+
<td class="d2h-ins d2h-change">
1530+
<div class="d2h-code-line">
1531+
<span class="d2h-code-line-prefix">+</span>
1532+
<span class="d2h-code-line-ctn"><ins>test1</ins></span>
1533+
</div>
1534+
</td>
1535+
</tr>
1536+
</tbody>
1537+
</table>
1538+
</div>
1539+
</div>
1540+
</div>
1541+
</div>"
1542+
`);
15431543
});
15441544
});
15451545
});

0 commit comments

Comments
 (0)