diff --git a/jquery-truncate-html/jquery-truncate-html-tests.ts b/jquery-truncate-html/jquery-truncate-html-tests.ts new file mode 100644 index 0000000000..e20f9c22ee --- /dev/null +++ b/jquery-truncate-html/jquery-truncate-html-tests.ts @@ -0,0 +1,14 @@ +/// + + +function truncateHtmlString(): string { + return $.truncate('

Stuff and Nonsense

', { + length: 13 + }); +} + +function truncateVirtualElement (): JQuery { + return $('

Stuff and Nonsense

').truncate({ + length: 13 + }); +} diff --git a/jquery-truncate-html/jquery-truncate-html.d.ts b/jquery-truncate-html/jquery-truncate-html.d.ts new file mode 100644 index 0000000000..e410716b0a --- /dev/null +++ b/jquery-truncate-html/jquery-truncate-html.d.ts @@ -0,0 +1,22 @@ +// Type definitions for jQuery-truncate-html.js +// Project: https://github.com/kbwood/timeentry +// Definitions by: Abraão Alves +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface TruncateOptions{ + length?: number; + stripTags?: boolean; + words?: boolean; + noBreaks?: boolean; + ellipsis?: string; +} + +interface JQuery{ + truncate(options: TruncateOptions) : JQuery; +} + +interface JQueryStatic { + truncate(html: string, options: TruncateOptions) : string; +}