diff --git a/.babelrc b/.babelrc deleted file mode 100644 index f4e4578..0000000 --- a/.babelrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "env": { - "rollup": { - "presets": [ - [ - "@babel/env", - { - "modules": false - } - ] - ], - "plugins": [ - "version" - ] - }, - "babel": { - "presets": ["@babel/env"], - "plugins": [ - "add-module-exports", - "version" - ] - } - } -} diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000..a43666e --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,9 @@ +module.exports = { + rules: { + 'type-enum': [ + 2, + 'always', + ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test', 'wip'], + ], + }, +}; diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..1cb91e6 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,18 @@ +{ + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "./tsconfig.ci.json" + }, + "plugins": ["@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + "prettier/@typescript-eslint" + ], + "rules": { + "@typescript-eslint/ban-ts-ignore": 1, + "@typescript-eslint/camelcase": 0 + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..59e5f63 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "semi": true, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "printWidth": 120, + "arrowParens": "always" +} diff --git a/.travis.yml b/.travis.yml index a5825f6..f02c4eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,5 +13,7 @@ install: - export DISPLAY=':99.0' - Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & - npm install +script: + - npm run ci after_success: - npm run coveralls diff --git a/README.md b/README.md index 51ea125..39fce58 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,11 @@ npm install timeago.js - Import -```js -// ES6 +```ts import { format, render, cancel, register } from 'timeago.js'; -// commonjs -const { format, render, cancel, register } = require('timeago.js'); +// or +import * as timeago from 'timeago.js'; ``` or import with `script` in html file and access global variable `timeago`. @@ -66,7 +65,7 @@ or import with `script` in html file and access global variable `timeago`. - Usage -```js +```ts // format the time with locale format('2016-06-12', 'en_US'); ``` @@ -89,7 +88,7 @@ There only 4 API: Just format date into a string. -```js +```ts import { format, render, cancel, register } from 'timeago.js'; // format timestamp @@ -117,13 +116,15 @@ You can `render` a dom node with automatic rendering. HTML code: ```html -
+ ``` Javascript code: -```js -var nodes = document.querySelectorAll('.needs_to_be_rendered'); +```ts +import * as timeago from 'timeago.js'; + +const nodes = document.querySelectorAll('.needs-tobe-rendered'); // use render method to render nodes in real time timeago.render(nodes, 'zh_CN'); @@ -135,7 +136,7 @@ timeago.cancel(); timeago.cancel(nodes[0]) ``` -The input for `render` method should be DOM object / array, pure javascript DOM node or jQuery DOM object supported. +The input for `render` method should be DOM object / array, pure javascript DOM node ~~or jQuery DOM object supported~~. The `cancel` method clears all the render timers and release all resources of the instance. Optionally it accepts a single node to cancel timer just for it. @@ -146,12 +147,12 @@ The `cancel` method clears all the render timers and release all resources of th Default locale is **`en_US`**, and the library supports `en_US` and `zh_CN`. You can register your own language with `register`. -```js +```ts // the local dict example is below. -const localeFunc = (number, index, total_sec) => { +const localeFunc = (number: number, index: number, totalSec: number): [string, string] => { // number: the timeago / timein number; // index: the index of array below; - // total_sec: total seconds between date to be formatted and today's date; + // totalSec: total seconds between date to be formatted and today's date; return [ ['just now', 'right now'], ['%s seconds ago', 'in %s seconds'], @@ -187,7 +188,7 @@ Check out more [locales](src/lang). 2. **locale translations**: The library needs more locale translations. You can: - Open an issue to write the locale translations, or submit a pull request. How to ? see [locales translation](src/lang/). - - Please **test** the locale by exec `npm test`. How to write testcase, see [locales test cases](__tests__/lang/). + - Please **test** the locale by exec `npm test`. How to write test cases, see [locales test cases](__tests__/lang/). diff --git a/README_zh.md b/README_zh.md index 3505a9f..c5b3e2f 100644 --- a/README_zh.md +++ b/README_zh.md @@ -48,12 +48,11 @@ npm install timeago.js - 引入 -```js -// ES6 +```ts import { format, render, cancel, register } from 'timeago.js'; -// commonjs -const { format, render, cancel, register } = require('timeago.js'); +// or +import * as timeago from 'timeago.js'; ``` 或者使用 `script` 在 html 文件中引入,然后就可以使用全局的变量 `timeago`。 @@ -64,7 +63,7 @@ const { format, render, cancel, register } = require('timeago.js'); - 使用 -```js +```ts // 格式化日期 format('2016-06-12', 'en_US'); ``` @@ -115,13 +114,13 @@ format(Date.now() - 11 * 1000 * 60 * 60); // returns '11 hours ago' HTML code: ```html - + ``` Javascript code: ```js -var nodes = document.querySelectorAll('.needs_to_be_rendered'); +var nodes = document.querySelectorAll('.needs-tobe-rendered'); // use render method to render nodes in real time timeago.render(nodes, 'zh_CN'); @@ -133,9 +132,9 @@ timeago.cancel(); timeago.cancel(nodes[0]) ``` -`render` 函数的输入必须是一个 dom 元素或者数组,JavaScript dom 和 JQuery 的 dom 均支持。 +`render` 函数的输入必须是一个 dom 元素或者数组,JavaScript dom ~~和 JQuery 的 dom 均~~支持。 -`cancel` 清楚实时渲染,如果传入 dom,则清除这个 dom 的实时渲染,否则清除所有。 +`cancel` 清除实时渲染,如果传入 dom,则清除这个 dom 的实时渲染,否则清除所有。 > 被渲染的 dom 元素必须包含一个 `datetime` 属性,用于被格式化的日期。 @@ -146,10 +145,10 @@ timeago.cancel(nodes[0]) ```js // the local dict example is below. -const localeFunc = (number, index, total_sec) => { +const localeFunc = (number, index, totalSec) => { // number: the timeago / timein number; // index: the index of array below; - // total_sec: total seconds between date to be formatted and today's date; + // totalSec: total seconds between date to be formatted and today's date; return [ ['just now', 'right now'], ['%s seconds ago', 'in %s seconds'], diff --git a/__tests__/index.spec.js b/__tests__/index.spec.js deleted file mode 100644 index aeb0693..0000000 --- a/__tests__/index.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Created by hustcc on 18/5/20. - * Contract: i@hust.cc - */ - -import pkg from '../package.json'; -import { format, render, cancel, register, version } from '../src/'; - -describe('index', () => { - test('all', () => { - expect(format).toBeFunction(); - expect(render).toBeFunction(); - expect(cancel).toBeFunction(); - expect(register).toBeFunction(); - - expect(version).toBe(pkg.version); - }); - - test('format', () => { - expect(format(new Date() - 7000)).toBe('just now'); - - expect(format(new Date() - 1000 * 1000, 'zh_CN')).toBe('16 分钟前'); - }); - - test('render', () => { - // render array - render([{}]); - - // render node - render({}); - expect(format(new Date() - 1000 * 1000, 'zh_CN')).toBe('16 分钟前'); - }); - - test('cancel', () => { - cancel(); - - const node = { - getAttribute: () => 1, - }; - - cancel(node); - }); -}); diff --git a/__tests__/index.spec.ts b/__tests__/index.spec.ts new file mode 100644 index 0000000..013d2c8 --- /dev/null +++ b/__tests__/index.spec.ts @@ -0,0 +1,32 @@ +/** + * Created by hustcc on 18/5/20. + * Contract: i@hust.cc + */ + +import { format, render, cancel, register } from '../src/'; + +describe('index', () => { + test('all', () => { + expect(format).toBeInstanceOf(Function); + expect(render).toBeInstanceOf(Function); + expect(cancel).toBeInstanceOf(Function); + expect(register).toBeInstanceOf(Function); + }); + + test('format', () => { + expect(format(+new Date() - 5000)).toBe('just now'); + + expect(format(+new Date() - 1000 * 1000, 'zh_CN')).toBe('16 分钟前'); + }); + + test('cancel', () => { + cancel(); + + const node = { + getAttribute: () => 1, + }; + + // @ts-ignore + cancel(node); + }); +}); diff --git a/__tests__/lang/cs.spec.js b/__tests__/lang/cs.spec.ts similarity index 98% rename from __tests__/lang/cs.spec.js rename to __tests__/lang/cs.spec.ts index d36a7a7..c6ee2a5 100644 --- a/__tests__/lang/cs.spec.js +++ b/__tests__/lang/cs.spec.ts @@ -1,4 +1,4 @@ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import cs from '../../src/lang/cs'; @@ -28,7 +28,6 @@ describe('cs', () => { test('minute', () => { advanceTo(1000 * 60); expect(format(date, 'cs')).toEqual('před minutou'); - }); test('minutes', () => { @@ -49,7 +48,6 @@ describe('cs', () => { test('yesterday', () => { advanceTo(1000 * 60 * 60 * 24); expect(format(date, 'cs')).toEqual('včera'); - }); test('days', () => { @@ -60,7 +58,6 @@ describe('cs', () => { test('last week', () => { advanceTo(1000 * 60 * 60 * 24 * 7); expect(format(date, 'cs')).toEqual('minulý týden'); - }); test('weeks', () => { diff --git a/__tests__/lang/fa.spec.js b/__tests__/lang/fa.spec.ts similarity index 98% rename from __tests__/lang/fa.spec.js rename to __tests__/lang/fa.spec.ts index 34c226a..6407684 100644 --- a/__tests__/lang/fa.spec.js +++ b/__tests__/lang/fa.spec.ts @@ -1,4 +1,4 @@ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import fa from '../../src/lang/fa'; diff --git a/__tests__/lang/he.spec.js b/__tests__/lang/he.spec.ts similarity index 98% rename from __tests__/lang/he.spec.js rename to __tests__/lang/he.spec.ts index ea49823..8ccec6c 100644 --- a/__tests__/lang/he.spec.js +++ b/__tests__/lang/he.spec.ts @@ -1,4 +1,4 @@ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import he from '../../src/lang/he'; diff --git a/__tests__/lang/hi_IN.spec.js b/__tests__/lang/hi_IN.spec.ts similarity index 95% rename from __tests__/lang/hi_IN.spec.js rename to __tests__/lang/hi_IN.spec.ts index 72304e9..b91a930 100644 --- a/__tests__/lang/hi_IN.spec.js +++ b/__tests__/lang/hi_IN.spec.ts @@ -2,13 +2,12 @@ * Created by porcus on 2018/10/09. * Contact: avoicefromthedust@gmail.com */ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { format, register } from '../../src'; import hi_IN from '../../src/lang/hi_IN'; register('hi_IN', hi_IN); - let date = new Date(); beforeEach(() => { diff --git a/__tests__/lang/index.spec.js b/__tests__/lang/index.spec.ts similarity index 100% rename from __tests__/lang/index.spec.js rename to __tests__/lang/index.spec.ts diff --git a/__tests__/lang/it.spec.js b/__tests__/lang/it.spec.ts similarity index 94% rename from __tests__/lang/it.spec.js rename to __tests__/lang/it.spec.ts index 93f7d9e..3caca73 100644 --- a/__tests__/lang/it.spec.js +++ b/__tests__/lang/it.spec.ts @@ -1,4 +1,4 @@ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import it from '../../src/lang/it'; @@ -28,7 +28,7 @@ describe('it', () => { expect(format(date, 'it')).toEqual('30 minuti fa'); advanceTo(1000 * 60 * 60); - expect(format(date, 'it')).toEqual('un\'ora fa'); + expect(format(date, 'it')).toEqual("un'ora fa"); advanceTo(1000 * 60 * 60 * 8); expect(format(date, 'it')).toEqual('8 ore fa'); @@ -71,7 +71,7 @@ describe('it', () => { expect(format(date, 'it')).toEqual('fra 30 minuti'); advanceTo(-1000 * 60 * 60); - expect(format(date, 'it')).toEqual('fra un\'ora'); + expect(format(date, 'it')).toEqual("fra un'ora"); advanceTo(-1000 * 60 * 60 * 8); expect(format(date, 'it')).toEqual('fra 8 ore'); diff --git a/__tests__/lang/ka.spec.js b/__tests__/lang/ka.spec.ts similarity index 98% rename from __tests__/lang/ka.spec.js rename to __tests__/lang/ka.spec.ts index 32fc6f5..91b2ea3 100644 --- a/__tests__/lang/ka.spec.js +++ b/__tests__/lang/ka.spec.ts @@ -2,13 +2,12 @@ * Created by hustcc on 18/5/24. * Contact: i@hust.cc */ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { format, register } from '../../src'; import ka from '../../src/lang/ka'; register('ka', ka); - let date = new Date(); beforeEach(() => { diff --git a/__tests__/lang/nl.spec.js b/__tests__/lang/nl.spec.ts similarity index 97% rename from __tests__/lang/nl.spec.js rename to __tests__/lang/nl.spec.ts index 26df703..dba492b 100644 --- a/__tests__/lang/nl.spec.js +++ b/__tests__/lang/nl.spec.ts @@ -2,13 +2,12 @@ * Created by hustcc on 18/5/24. * Contact: i@hust.cc */ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { format, register } from '../../src'; import nl from '../../src/lang/nl'; register('nl', nl); - let date = new Date(); beforeEach(() => { diff --git a/__tests__/lang/oc.spec.js b/__tests__/lang/oc.spec.ts similarity index 70% rename from __tests__/lang/oc.spec.js rename to __tests__/lang/oc.spec.ts index dd4790d..5c19270 100644 --- a/__tests__/lang/oc.spec.js +++ b/__tests__/lang/oc.spec.ts @@ -1,4 +1,4 @@ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import oc from '../../src/lang/oc'; @@ -59,45 +59,45 @@ describe('oc', () => { }); test('time in', () => { advanceTo(-9 * 1000); - expect(format(date, 'oc')).toEqual('d\'aquí un moment'); + expect(format(date, 'oc')).toEqual("d'aquí un moment"); advanceTo(-30 * 1000); - expect(format(date, 'oc')).toEqual('d\'aquí 30 segondas'); + expect(format(date, 'oc')).toEqual("d'aquí 30 segondas"); advanceTo(-1000 * 60); - expect(format(date, 'oc')).toEqual('d\'aquí 1 minuta'); + expect(format(date, 'oc')).toEqual("d'aquí 1 minuta"); advanceTo(-1000 * 60 * 30); - expect(format(date, 'oc')).toEqual('d\'aquí 30 minutas'); + expect(format(date, 'oc')).toEqual("d'aquí 30 minutas"); advanceTo(-1000 * 60 * 60); - expect(format(date, 'oc')).toEqual('d\'aquí 1 ora'); + expect(format(date, 'oc')).toEqual("d'aquí 1 ora"); advanceTo(-1000 * 60 * 60 * 8); - expect(format(date, 'oc')).toEqual('d\'aquí 8 oras'); + expect(format(date, 'oc')).toEqual("d'aquí 8 oras"); advanceTo(-1000 * 60 * 60 * 24); - expect(format(date, 'oc')).toEqual('d\'aquí 1 jorn'); + expect(format(date, 'oc')).toEqual("d'aquí 1 jorn"); advanceTo(-1000 * 60 * 60 * 24 * 3); - expect(format(date, 'oc')).toEqual('d\'aquí 3 jorns'); + expect(format(date, 'oc')).toEqual("d'aquí 3 jorns"); advanceTo(-1000 * 60 * 60 * 24 * 7); - expect(format(date, 'oc')).toEqual('d\'aquí 1 setmana'); + expect(format(date, 'oc')).toEqual("d'aquí 1 setmana"); advanceTo(-1000 * 60 * 60 * 24 * 7 * 3); - expect(format(date, 'oc')).toEqual('d\'aquí 3 setmanas'); + expect(format(date, 'oc')).toEqual("d'aquí 3 setmanas"); advanceTo(-1000 * 60 * 60 * 24 * 31); - expect(format(date, 'oc')).toEqual('d\'aquí 1 mes'); + expect(format(date, 'oc')).toEqual("d'aquí 1 mes"); advanceTo(-1000 * 60 * 60 * 24 * 31 * 4); - expect(format(date, 'oc')).toEqual('d\'aquí 4 meses'); + expect(format(date, 'oc')).toEqual("d'aquí 4 meses"); advanceTo(-1000 * 60 * 60 * 24 * 366); - expect(format(date, 'oc')).toEqual('d\'aquí 1 an'); + expect(format(date, 'oc')).toEqual("d'aquí 1 an"); advanceTo(-1000 * 60 * 60 * 24 * 366 * 10); - expect(format(date, 'oc')).toEqual('d\'aquí 10 ans'); + expect(format(date, 'oc')).toEqual("d'aquí 10 ans"); }); }); diff --git a/__tests__/lang/zh_TW.spec.js b/__tests__/lang/zh_TW.spec.ts similarity index 98% rename from __tests__/lang/zh_TW.spec.js rename to __tests__/lang/zh_TW.spec.ts index cf8cb90..24a50ed 100644 --- a/__tests__/lang/zh_TW.spec.js +++ b/__tests__/lang/zh_TW.spec.ts @@ -2,7 +2,7 @@ * Created by leoliu1209 on 18/12/11. * Contact: cubemail88@gmail.com */ -import { advanceBy, advanceTo, clear } from 'jest-date-mock'; +import { advanceTo, clear } from 'jest-date-mock'; import { register, format } from '../../src'; import zh_TW from '../../src/lang/zh_TW'; diff --git a/__tests__/locales.spec.js b/__tests__/locales.spec.ts similarity index 98% rename from __tests__/locales.spec.js rename to __tests__/locales.spec.ts index 9c4b6ce..6b2aac0 100644 --- a/__tests__/locales.spec.js +++ b/__tests__/locales.spec.ts @@ -63,8 +63,10 @@ describe('locales', () => { test('register', () => { const fr = () => 'test'; + // @ts-ignore register('fr', fr); expect(getLocale('fr')).toBe(fr); + // @ts-ignore expect(getLocale('fr')()).toBe('test'); }); }); diff --git a/__tests__/utils/date.spec.js b/__tests__/utils/date.spec.ts similarity index 65% rename from __tests__/utils/date.spec.js rename to __tests__/utils/date.spec.ts index f48b448..e3a0a5e 100644 --- a/__tests__/utils/date.spec.js +++ b/__tests__/utils/date.spec.ts @@ -3,37 +3,30 @@ * Contract: i@hust.cc */ -import { - toInt, - toDate, - formatDiff, - diffSec, - nextInterval, -} from '../../src/utils/date'; +import { toDate, formatDiff, diffSec, nextInterval } from '../../src/utils/date'; import { getLocale } from '../../src/locales'; describe('date', () => { - test('toInt', () => { - expect(toInt('a')).toBeNaN(); - }); - // TODO fill all test cases test('toDate', () => { - expect(toDate('1992-08-01') instanceof Date).toEqual(true); - expect(toDate(712627200000) instanceof Date).toEqual(true); + expect(typeof toDate('1992-08-01')).toEqual('number'); + expect(typeof toDate(712627200000)).toEqual('number'); - expect(toDate('2017-2-5 3:57:52UTC') instanceof Date).toEqual(true); - expect(toDate('2017-2-5T3:57:52Z') instanceof Date).toEqual(true); + expect(typeof toDate('2017-2-5 3:57:52UTC')).toEqual('number'); + expect(typeof toDate('2017-2-5T3:57:52Z')).toEqual('number'); - expect(toDate() instanceof Date).toEqual(true); + expect(typeof toDate()).toEqual('number'); }); test('diffSec', () => { const now = new Date(); + // @ts-ignore expect(diffSec(now)).toBeApproximate(0); + // @ts-ignore expect(diffSec(now, now)).toBeApproximate(0); - expect(diffSec(new Date(now - 10000), now)).toBeApproximate(10); + // @ts-ignore + expect(diffSec(new Date(+now - 10000), now)).toBeApproximate(10); }); test('nextInterval', () => { diff --git a/__tests__/utils/dom.spec.js b/__tests__/utils/dom.spec.js deleted file mode 100644 index 131a4c3..0000000 --- a/__tests__/utils/dom.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Created by hustcc on 18/5/20. - * Contract: i@hust.cc - */ - -import { - getTimerId, - saveTimerId, - getDateAttribute -} from '../../src/utils/dom'; - -describe('dom', () => { - test('getTimerId', () => { - const node = { - getAttribute: name => `${name}-native`, - }; - - const jqNode = { - attr: name => `${name}-jq`, - }; - expect(getTimerId(node)).toEqual('timeago-tid-native'); - - expect(getTimerId(jqNode)).toEqual('timeago-tid-jq'); - - expect(getTimerId({})).toEqual(undefined); - }); - - test('getDateAttribute', () => { - const node1 = { - getAttribute: name => { - if (name === 'datetime') return 'datetime-value'; - }, - }; - - const node2 = { - attr: name => { - if (name === 'datetime') return 'datetime-value'; - }, - }; - - expect(getDateAttribute(node1)).toEqual('datetime-value'); - expect(getDateAttribute(node2)).toEqual('datetime-value'); - }); - - test('saveTimerId', () => { - const node1 = { - setAttribute: jest.fn(), - }; - - const node2 = { - attr: jest.fn(), - }; - - saveTimerId({}, 0); - saveTimerId(node1, 1); - saveTimerId(node2, 2); - - expect(node1.setAttribute).toBeCalledWith('timeago-tid', 1); - expect(node2.attr).toBeCalledWith('timeago-tid', 2); - }); -}); diff --git a/__tests__/utils/dom.spec.ts b/__tests__/utils/dom.spec.ts new file mode 100644 index 0000000..c3c6944 --- /dev/null +++ b/__tests__/utils/dom.spec.ts @@ -0,0 +1,44 @@ +/** + * Created by hustcc on 18/5/20. + * Contract: i@hust.cc + */ + +import { getTimerId, getDateAttribute, setTimerId } from '../../src/utils/dom'; + +describe('dom', () => { + test('getTimerId', () => { + const node = { + getAttribute: (name: string): string => '123', + }; + + // @ts-ignore + expect(getTimerId(node)).toEqual(123); + + expect(() => { + // @ts-ignore + getTimerId({}); + }).toThrow(); + }); + + test('getDateAttribute', () => { + const node1 = { + getAttribute: (name) => { + if (name === 'datetime') return 'datetime-value'; + }, + }; + + // @ts-ignore + expect(getDateAttribute(node1)).toEqual('datetime-value'); + }); + + test('setTimerId', () => { + const node1 = { + setAttribute: jest.fn(), + }; + + // @ts-ignore + setTimerId(node1, 1); + + expect(node1.setAttribute).toBeCalledWith('timeago-tid', 1); + }); +}); diff --git a/gh-pages/demo.html b/gh-pages/demo.html index cf1677b..97cb652 100644 --- a/gh-pages/demo.html +++ b/gh-pages/demo.html @@ -31,11 +31,10 @@You opened this page @@ -46,16 +45,6 @@
- You opened this page . - - -
-- You opened this page . -
-You opened this page . @@ -67,23 +56,15 @@