hexo-component-inferno 2.0.2 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/lib/hexo/helper/cdn.test.js +7 -7
  2. package/lib/view/comment/changyan.js +3 -3
  3. package/lib/view/comment/disqus.js +3 -3
  4. package/lib/view/comment/disqusjs.js +3 -3
  5. package/lib/view/comment/facebook.js +3 -3
  6. package/lib/view/comment/gitalk.js +3 -3
  7. package/lib/view/comment/gitment.js +3 -3
  8. package/lib/view/comment/isso.js +3 -3
  9. package/lib/view/comment/livere.js +3 -3
  10. package/lib/view/comment/twikoo.js +3 -3
  11. package/lib/view/comment/utterances.js +5 -5
  12. package/lib/view/comment/valine.js +3 -3
  13. package/lib/view/comment/waline.js +3 -3
  14. package/lib/view/common/article_media.js +3 -3
  15. package/lib/view/donate/afdian.js +3 -3
  16. package/lib/view/donate/alipay.js +3 -3
  17. package/lib/view/donate/buymeacoffee.js +3 -3
  18. package/lib/view/donate/patreon.js +3 -3
  19. package/lib/view/donate/paypal.js +3 -3
  20. package/lib/view/donate/wechat.js +3 -3
  21. package/lib/view/misc/article_licensing.js +3 -3
  22. package/lib/view/misc/meta.js +5 -5
  23. package/lib/view/misc/open_graph.js +3 -3
  24. package/lib/view/misc/paginator.js +3 -3
  25. package/lib/view/misc/structured_data.js +3 -3
  26. package/lib/view/misc/web_app.js +4 -4
  27. package/lib/view/plugin/baidu_analytics.js +3 -3
  28. package/lib/view/plugin/bing_webmaster.js +3 -3
  29. package/lib/view/plugin/busuanzi.js +3 -3
  30. package/lib/view/plugin/cnzz.js +3 -3
  31. package/lib/view/plugin/cookie_consent.js +3 -3
  32. package/lib/view/plugin/gallery.js +3 -3
  33. package/lib/view/plugin/google_analytics.js +3 -3
  34. package/lib/view/plugin/hotjar.js +3 -3
  35. package/lib/view/plugin/katex.js +3 -3
  36. package/lib/view/plugin/mathjax.js +9 -8
  37. package/lib/view/plugin/outdated_browser.js +3 -3
  38. package/lib/view/plugin/progressbar.js +3 -3
  39. package/lib/view/plugin/statcounter.js +3 -3
  40. package/lib/view/plugin/twitter_conversion_tracking.js +3 -3
  41. package/lib/view/search/algolia.js +3 -3
  42. package/lib/view/search/baidu.js +3 -3
  43. package/lib/view/search/google_cse.js +3 -3
  44. package/lib/view/search/insight.js +3 -3
  45. package/lib/view/share/addthis.js +3 -3
  46. package/lib/view/share/addtoany.js +3 -3
  47. package/lib/view/share/bdshare.js +3 -3
  48. package/lib/view/share/sharejs.js +3 -3
  49. package/lib/view/share/sharethis.js +3 -3
  50. package/lib/view/widget/adsense.js +3 -3
  51. package/lib/view/widget/archives.js +15 -14
  52. package/lib/view/widget/categories.js +15 -13
  53. package/lib/view/widget/followit.js +3 -3
  54. package/lib/view/widget/links.js +19 -9
  55. package/lib/view/widget/recent_posts.js +6 -5
  56. package/lib/view/widget/subscribe_email.js +3 -3
  57. package/lib/view/widget/tags.js +3 -3
  58. package/lib/view/widget/toc.js +17 -17
  59. package/lib/view/widget/toc.test.js +30 -0
  60. package/package.json +4 -3
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _inferno = require("inferno");
4
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ var Toc = require('./toc');
11
+ var _require = require('inferno-test-utils'),
12
+ renderIntoContainer = _require.renderIntoContainer,
13
+ scryRenderedDOMElementsWithClass = _require.scryRenderedDOMElementsWithClass;
14
+ function createTocAndGetLevels(content) {
15
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
16
+ var widget = renderIntoContainer((0, _inferno.normalizeProps)((0, _inferno.createComponentVNode)(2, Toc, _objectSpread({
17
+ "content": content
18
+ }, options))));
19
+ return scryRenderedDOMElementsWithClass(widget, 'level-item').map(function (item) {
20
+ return item.innerHTML;
21
+ });
22
+ }
23
+ test('Correctly render headings', function () {
24
+ var levels = createTocAndGetLevels("\n <h1>Title 1</h1>\n <h2>Title 1.1</h2>\n <h3>Title 1.1.1</h3>\n <h3>Title 1.1.2</h3>\n <h2>Title 1.2</h2>\n <h3>Title 1.2.1</h3>\n <h3>Title 1.2.2</h3>\n <h1>Title 2</h1>\n <h2>Title 2.1</h2>\n <h2>Title 2.2</h2>\n <h3>Title 2.2.1</h3>\n <h3>Title 2.2.2</h3>\n ");
25
+ expect(levels).toEqual(['1', 'Title 1', '1.1', 'Title 1.1', '1.1.1', 'Title 1.1.1', '1.1.2', 'Title 1.1.2', '1.2', 'Title 1.2', '1.2.1', 'Title 1.2.1', '1.2.2', 'Title 1.2.2', '2', 'Title 2', '2.1', 'Title 2.1', '2.2', 'Title 2.2', '2.2.1', 'Title 2.2.1', '2.2.2', 'Title 2.2.2']);
26
+ });
27
+ test('Correctly render disjunct levels of heading', function () {
28
+ var levels = createTocAndGetLevels("\n <h2>Title 1</h2>\n <h2>Title 2</h2>\n <h4>Title 2.1</h4>\n <h4>Title 2.2</h4>\n <h4>Title 2.3</h4>\n <h2>Title 3</h2>\n ");
29
+ expect(levels).toEqual(['1', 'Title 1', '2', 'Title 2', '2.1', 'Title 2.1', '2.2', 'Title 2.2', '2.3', 'Title 2.3', '3', 'Title 3']);
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-component-inferno",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "A collection of Inferno.js layout components and utility scripts for Hexo",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/ppoffice/hexo-component-inferno",
@@ -10,8 +10,8 @@
10
10
  "node": ">=12.4.0"
11
11
  },
12
12
  "scripts": {
13
- "test": "jest lib",
14
- "test-cov": "jest lib --coverage",
13
+ "test": "jest",
14
+ "test-cov": "jest --coverage",
15
15
  "lint": "eslint '{src,asset,fixture}/**/*.{js,jsx}'",
16
16
  "_format": "prettier \"*.{json,babelrc,prettierrc,md}\" \"{.github,*[^lib]}/**/*.{js,jsx,json,yml}\"",
17
17
  "format": "npm run _format -- --write",
@@ -46,6 +46,7 @@
46
46
  "hexo-renderer-marked": "^5.0.0",
47
47
  "html-minifier": "^4.0.0",
48
48
  "inferno-server": "^7.4.1",
49
+ "inferno-test-utils": "^8.1.1",
49
50
  "jest": "^27.4.7",
50
51
  "jsdoc": "^3.6.3",
51
52
  "minami": "^1.2.3",