mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-06 20:46:50 +08:00
Add diff2html typings and tests (#10681)
This commit is contained in:
committed by
Masahiro Wakame
parent
30ada00c03
commit
ba79abdc6a
26
diff2html/diff2html-tests.ts
Normal file
26
diff2html/diff2html-tests.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path="./diff2html.d.ts" />
|
||||
|
||||
import Diff2Html = require('diff2html');
|
||||
|
||||
let d2h = Diff2Html.Diff2Html;
|
||||
|
||||
class Diff2HtmlOptionsImpl implements Diff2Html.Options {
|
||||
constructor (public inputFormat: string) {
|
||||
}
|
||||
}
|
||||
|
||||
let strInput =
|
||||
'diff --git a/sample b/sample\n' +
|
||||
'index 0000001..0ddf2ba\n' +
|
||||
'--- a/sample\n' +
|
||||
'+++ b/sample\n' +
|
||||
'@@ -1 +1 @@\n' +
|
||||
'-test\n' +
|
||||
'+test1r\n';
|
||||
|
||||
let strConfiguration = new Diff2HtmlOptionsImpl('diff');
|
||||
let diffInput = d2h.getJsonFromDiff(strInput, strConfiguration);
|
||||
|
||||
let diffConfiguration = new Diff2HtmlOptionsImpl('json');
|
||||
let htmlString = d2h.getPrettyHtml(diffInput, diffConfiguration);
|
||||
console.log(htmlString);
|
||||
Reference in New Issue
Block a user