From 1ea67ceea476ea5b226130ced5f2cef247eedaab Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Tue, 1 Mar 2016 19:01:41 -0300 Subject: [PATCH 1/3] ad files --- .../jquery-truncate-html-tests.ts | 5 +++++ .../jquery-truncate-html.d.ts | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 jquery-truncate-html/jquery-truncate-html-tests.ts create mode 100644 jquery-truncate-html/jquery-truncate-html.d.ts 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..fe043601b0 --- /dev/null +++ b/jquery-truncate-html/jquery-truncate-html-tests.ts @@ -0,0 +1,5 @@ +/// + +jQuery('

Stuff and Nonsense

').truncate({ + length: 13 +}).html(); 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..d7f4abaa3b --- /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 ITruncateOptions{ + length?: number; + stripTags?: boolean; + words?: boolean; + noBreaks?: boolean; + ellipsis?: string; +} + +interface jQuery{ + truncate(options: ITruncateOptions) : jQuery; +} + +interface JQueryStatic { + truncate(html: string, options: ITruncateOptions) : string; +} From 13d212dfb3ef4672039019036bf2d08acbe728eb Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Tue, 1 Mar 2016 21:40:34 -0300 Subject: [PATCH 2/3] make tests --- .../jquery-truncate-html-tests.ts | 15 ++++++++++++--- jquery-truncate-html/jquery-truncate-html.d.ts | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/jquery-truncate-html/jquery-truncate-html-tests.ts b/jquery-truncate-html/jquery-truncate-html-tests.ts index fe043601b0..e20f9c22ee 100644 --- a/jquery-truncate-html/jquery-truncate-html-tests.ts +++ b/jquery-truncate-html/jquery-truncate-html-tests.ts @@ -1,5 +1,14 @@ /// -jQuery('

Stuff and Nonsense

').truncate({ - length: 13 -}).html(); + +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 index d7f4abaa3b..3a22eaffdb 100644 --- a/jquery-truncate-html/jquery-truncate-html.d.ts +++ b/jquery-truncate-html/jquery-truncate-html.d.ts @@ -13,8 +13,8 @@ interface ITruncateOptions{ ellipsis?: string; } -interface jQuery{ - truncate(options: ITruncateOptions) : jQuery; +interface JQuery{ + truncate(options: ITruncateOptions) : JQuery; } interface JQueryStatic { From 4064f5b0d8945fc38b3568b5bb6a3b24d9e410fc Mon Sep 17 00:00:00 2001 From: AbraaoAlves Date: Sat, 5 Mar 2016 11:26:59 -0300 Subject: [PATCH 3/3] Remove "I" prefix --- jquery-truncate-html/jquery-truncate-html.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery-truncate-html/jquery-truncate-html.d.ts b/jquery-truncate-html/jquery-truncate-html.d.ts index 3a22eaffdb..e410716b0a 100644 --- a/jquery-truncate-html/jquery-truncate-html.d.ts +++ b/jquery-truncate-html/jquery-truncate-html.d.ts @@ -5,7 +5,7 @@ /// -interface ITruncateOptions{ +interface TruncateOptions{ length?: number; stripTags?: boolean; words?: boolean; @@ -14,9 +14,9 @@ interface ITruncateOptions{ } interface JQuery{ - truncate(options: ITruncateOptions) : JQuery; + truncate(options: TruncateOptions) : JQuery; } interface JQueryStatic { - truncate(html: string, options: ITruncateOptions) : string; + truncate(html: string, options: TruncateOptions) : string; }