Compare commits

..

107 Commits

Author SHA1 Message Date
Dailer-刘荣歆 cdec6f784f Pull request #3750: 无JIRA 同步一下代码 5 months ago
Dailer-刘荣歆 039ec622c4 Pull request #9: Feature/x 5 months ago
翠屏山最速下山传说 d5ee4e67f9 Merge branch 'master' of https://code.fineres.com/scm/~dailer/fineui into feature/x 5 months ago
Oliver.Chen-陈润桐 04a58a4a0b Pull request #3749: 无jira任务 fix: 更新图标 5 months ago
Oliver.Chen 26b2e1332f 无jira任务 fix: 更新图标 5 months ago
superman 77477f1bfd Merge pull request #282881 in DEC/fineui from release/11.0 to feature/x 5 months ago
superman cbdc63081f Merge pull request #282880 in DEC/fineui from final/11.0 to release/11.0 5 months ago
Zoey.Chen-陈泽语 41609ada7e Pull request #282878: BI-150695 fix: 兼容当前元素无parentNode的情况 5 months ago
chenzeyu 37fbf06103 BI-150695 fix: 兼容当前元素无parentNode的情况 5 months ago
superman e100e4115e Merge pull request #282507 in DEC/fineui from bugfix/11.0 to feature/x 5 months ago
superman ebbd7e6056 Merge pull request #282506 in DEC/fineui from release/11.0 to bugfix/11.0 5 months ago
superman 3063da4874 Merge pull request #282486 in DEC/fineui from release/11.0 to feature/x 5 months ago
superman 736980cb6e Merge pull request #282485 in DEC/fineui from final/11.0 to release/11.0 5 months ago
Zoey.Chen-陈泽语 bcedb54782 Pull request #282357: BI-150395 fix: safari下拉搜索框定位不对 5 months ago
chenzeyu bbd0315030 BI-150395 fix: safari下拉搜索框定位不对 5 months ago
Jimmy.Chai-柴嘉明 2109dee89d Pull request #281324: BI-149124 refactor: 粘贴限制变成参数 6 months ago
Jimmy.Chai c8d04fabdb BI-149124 refactor: 粘贴限制变成参数 6 months ago
superman d421c97306 Merge pull request #281311 in DEC/fineui from bugfix/11.0 to feature/x 6 months ago
superman b6ad497984 Merge pull request #281310 in DEC/fineui from release/11.0 to bugfix/11.0 6 months ago
superman a6b9042a49 Merge pull request #281154 in DEC/fineui from release/11.0 to feature/x 6 months ago
superman 6a17673c96 Merge pull request #281151 in DEC/fineui from bugfix/11.0 to release/11.0 6 months ago
superman 45172096df Merge pull request #281150 in DEC/fineui from feature/x to bugfix/11.0 6 months ago
superman 1c7689361d Merge pull request #280328 in DEC/fineui from bugfix/11.0 to feature/x 6 months ago
superman 572d216e64 Merge pull request #280327 in DEC/fineui from release/11.0 to bugfix/11.0 6 months ago
superman aaf988b6fe Merge pull request #280315 in DEC/fineui from bugfix/11.0 to feature/x 6 months ago
Xavier.Meng-孟宇翔 aed35bbce6 Pull request #280308: BI-147036 feat: 更新图标 6 months ago
Xavier.Meng f9b75be7ea BI-147036 feat: 更新图标 6 months ago
Jimmy.Chai-柴嘉明 eacdf59bed Pull request #279928: BI-143733 fix: 深色预览样式调整 6 months ago
superman 91c81250fc Merge pull request #280161 in DEC/fineui from release/11.0 to feature/x 6 months ago
fanglei-方磊 bb260ec29a Pull request #280112: REPORT-122294 lodash 低版本安全漏洞 6 months ago
方磊 e4aafdc056 REPORT-122294 lodash 低版本安全漏洞 6 months ago
superman 9189327b54 Merge pull request #280099 in DEC/fineui from release/11.0 to bugfix/11.0 6 months ago
Jimmy.Chai 02361b2675 BI-143733 fix: 深色预览样式调整 6 months ago
superman 1909ba3ef7 Merge pull request #279905 in DEC/fineui from master to feature/x 6 months ago
superman 8a57bcb479 Merge pull request #279904 in DEC/fineui from release/11.0 to feature/x 6 months ago
superman 7bcfbc79d2 Merge pull request #279903 in DEC/fineui from final/11.0 to release/11.0 6 months ago
superman 304126a7f1 Merge pull request #279902 in DEC/fineui from persist/11.0 to final/11.0 6 months ago
Zoey.Chen-陈泽语 fba8461b98 Pull request #279891: feature/x 合并 Final/11.0(6.1.1合final) 6 months ago
chenzeyu 8f41724169 Merge branch 'feature/x' into final/11.0 6 months ago
Kevin.King-王凯壮 9ab289d8c3 REPORT-121158 fix:控制台报错 6 months ago
chenzeyu 117d7fb659 BI-148724 fix: 树控件查看已选项连发两次请求 6 months ago
Dailer-刘荣歆 a26102950d Uploaded files 6 months ago
superman 4e63a7ef55 Merge pull request #279890 in DEC/fineui from final/11.0 to persist/11.0 6 months ago
fanglei-方磊 b74eba39f0 Pull request #3748: REPORT-122294 lodash 低版本安全漏洞 6 months ago
方磊 e1593bc0fc REPORT-122294 lodash 低版本安全漏洞 6 months ago
superman a33d9862b0 Merge pull request #279705 in DEC/fineui from bugfix/11.0 to feature/x 6 months ago
superman 2d7d80e719 Merge pull request #279704 in DEC/fineui from release/11.0 to bugfix/11.0 6 months ago
superman 535f7128fe Merge pull request #279098 in DEC/fineui from release/11.0 to feature/x 6 months ago
Kevin.King-王凯壮 fbe18a5138 Pull request #279091: REPORT-121158 fix:控制台报错 6 months ago
Kevin.King-王凯壮 c22c5d43dd REPORT-121158 fix:控制台报错 6 months ago
superman 7b407d4aa1 Merge pull request #278329 in DEC/fineui from release/11.0 to bugfix/11.0 6 months ago
superman 1b4e6e43b1 Merge pull request #278313 in DEC/fineui from release/11.0 to feature/x 6 months ago
superman 70e2f876da Merge pull request #278312 in DEC/fineui from final/11.0 to release/11.0 6 months ago
superman d3ab2af3fd Merge pull request #278310 in DEC/fineui from release/11.0 to final/11.0 6 months ago
Zoey.Chen-陈泽语 067435dd1e Pull request #277981: BI-148724 fix: 树控件查看已选项连发两次请求 6 months ago
chenzeyu f00e4c5b6c BI-148724 fix: 树控件查看已选项连发两次请求 6 months ago
Dailer-刘荣歆 5bff3e170e Pull request #276950: Uploaded font files 7 months ago
Dailer-刘荣歆 59a4e56d5f Uploaded files 7 months ago
superman 9bb7c12459 Merge pull request #276878 in DEC/fineui from bugfix/11.0 to feature/x 7 months ago
superman 05f6c41996 Merge pull request #276877 in DEC/fineui from release/11.0 to bugfix/11.0 7 months ago
superman 7fc5c63af9 Merge pull request #276101 in DEC/fineui from release/11.0 to feature/x 7 months ago
superman fba1af3f9b Merge pull request #276094 in DEC/fineui from bugfix/11.0 to release/11.0 7 months ago
superman 12899d2e88 Merge pull request #276093 in DEC/fineui from feature/x to bugfix/11.0 7 months ago
superman 3fe3b3d8e9 Merge pull request #275999 in DEC/fineui from release/11.0 to feature/x 7 months ago
superman 3b060f11a2 Merge pull request #275998 in DEC/fineui from final/11.0 to release/11.0 7 months ago
superman 3f55e7a72b Merge pull request #275997 in DEC/fineui from persist/11.0 to final/11.0 7 months ago
superman a01610e2ab Merge pull request #275996 in DEC/fineui from final/11.0 to persist/11.0 7 months ago
Zoey.Chen-陈泽语 e8f7a6c60b Pull request #275547: BI-148103 fix: 6.0.18过滤组件下拉框异常变小 7 months ago
chenzeyu 74ccf2f8cc BI-148103 fix: 6.0.18过滤组件下拉框异常变小 7 months ago
Zoey.Chen-陈泽语 f752b70990 Pull request #275347: BI-138636 fix: 文本、动态时间支持按钮组 7 months ago
chenzeyu 7beaeccebb BI-138636 fix: 文本、动态时间支持按钮组 7 months ago
superman 8dbbbd5e2c Merge pull request #275123 in DEC/fineui from master to feature/x 7 months ago
superman 2f199552b9 Merge pull request #275057 in DEC/fineui from master to feature/x 7 months ago
superman 212e8315f4 Merge pull request #274919 in DEC/fineui from release/11.0 to feature/x 7 months ago
superman b87665d7be Merge pull request #274918 in DEC/fineui from final/11.0 to release/11.0 7 months ago
Zoey.Chen-陈泽语 6378314e1b Pull request #274906: 无jira任务:feature/x 合并 Final/11.0 7 months ago
Zoey.Chen-陈泽语 877e71adfc Pull request #274494: BI-138679 feat: 更新图标 7 months ago
chenzeyu 4a69f2f440 BI-138679 feat: 更新图标 7 months ago
Zoey.Chen-陈泽语 e712b52428 Pull request #273912: BI-147341 fix:contentFormat未考虑时区问题 7 months ago
chenzeyu f0e91077bb BI-147341 fix:contentFormat未考虑时区问题 7 months ago
superman 00a60c6a63 Merge pull request #273681 in DEC/fineui from master to feature/x 7 months ago
superman 083ad18c21 Merge pull request #273142 in DEC/fineui from release/11.0 to feature/x 8 months ago
Kevin.King-王凯壮 3e44318c7e Pull request #273121: FDL-10490 fix:demo平台权限管理api列表显示空白 8 months ago
Kevin.King-王凯壮 8d4b0a67cc FDL-10490 fix:demo平台权限管理api列表显示空白 8 months ago
superman 36083aca64 Merge pull request #273113 in DEC/fineui from release/11.0 to feature/x 8 months ago
superman ca3659e5e3 Merge pull request #273112 in DEC/fineui from final/11.0 to release/11.0 8 months ago
superman ecbc12af1b Merge pull request #273111 in DEC/fineui from persist/11.0 to final/11.0 8 months ago
superman 6c0c17ac8b Merge pull request #273110 in DEC/fineui from final/11.0 to persist/11.0 8 months ago
superman de3dd7a48a Merge pull request #272557 in DEC/fineui from master to feature/x 8 months ago
superman d19aa45390 Merge pull request #271682 in DEC/fineui from bugfix/11.0 to feature/x 8 months ago
superman d03dff4c64 Merge pull request #271681 in DEC/fineui from release/11.0 to bugfix/11.0 8 months ago
superman 9a244ce9cb Merge pull request #271521 in DEC/fineui from release/11.0 to feature/x 8 months ago
superman 201d665d25 Merge pull request #271520 in DEC/fineui from final/11.0 to release/11.0 8 months ago
superman 5a7d85e730 Merge pull request #271518 in DEC/fineui from release/11.0 to final/11.0 8 months ago
superman 4e2d22a017 Merge pull request #271513 in DEC/fineui from master to feature/x 8 months ago
superman 930ebedede Merge pull request #271149 in DEC/fineui from master to feature/x 8 months ago
superman 7cb4f23775 Merge pull request #270577 in DEC/fineui from bugfix/11.0 to feature/x 8 months ago
superman e8fa741855 Merge pull request #270576 in DEC/fineui from release/11.0 to bugfix/11.0 8 months ago
superman 198d1fcb6f Merge pull request #270372 in DEC/fineui from release/11.0 to feature/x 8 months ago
Zoey.Chen-陈泽语 7c95e8c1fb Pull request #270179: BI-146095 fix:文本下拉加载最后一次缓存时cachegroup新增了 8 months ago
superman 9288b7bd0d Merge pull request #270178 in DEC/fineui from master to feature/x 8 months ago
chenzeyu fdb47604f7 BI-146095 fix:文本下拉加载最后一次缓存时cachegroup新增了 8 months ago
superman af7e395d4a Merge pull request #270010 in DEC/fineui from bugfix/11.0 to feature/x 8 months ago
superman 42deeb4a67 Merge pull request #270009 in DEC/fineui from release/11.0 to bugfix/11.0 8 months ago
superman 0537e0c4e9 Merge pull request #269989 in DEC/fineui from release/11.0 to feature/x 8 months ago
Dailer-刘荣歆 f4a5e2e574 Pull request #269825: KERNEL-17875 fix: fineui Dep不能回收问题 8 months ago
Dailer-刘荣歆 c87867cf2e Pull request #13: KERNEL-17875 fix: fineui Dep不能回收问题 8 months ago
  1. 2
      .npmrc
  2. 2
      packages/demo/i18n/i18n.cn.js
  3. 2
      packages/fineui/.gitignore
  4. 18
      packages/fineui/bi.lessconfig.json
  5. BIN
      packages/fineui/dist/font/iconfont.eot
  6. 124
      packages/fineui/dist/font/iconfont.svg
  7. BIN
      packages/fineui/dist/font/iconfont.ttf
  8. BIN
      packages/fineui/dist/font/iconfont.woff
  9. BIN
      packages/fineui/dist/font/iconfont.woff2
  10. 51
      packages/fineui/jest.config.ts
  11. 167
      packages/fineui/karma.conf.js
  12. 36
      packages/fineui/package.json
  13. 5
      packages/fineui/src/base/collection/__test__/collection.test.js
  14. 18
      packages/fineui/src/base/foundation/__test__/message.test.js
  15. 4
      packages/fineui/src/base/grid/__test__/grid.test.js
  16. 6
      packages/fineui/src/base/layer/__test__/layer.popover.test.js
  17. 6
      packages/fineui/src/base/list/__test__/listview.test.js
  18. 60
      packages/fineui/src/base/single/__test__/text.test.js
  19. 10
      packages/fineui/src/base/single/a/__test__/a.test.js
  20. 22
      packages/fineui/src/base/single/button/buttons/__test__/button.test.js
  21. 32
      packages/fineui/src/base/single/button/node/__test__/icontexticonnode.test.js
  22. 32
      packages/fineui/src/base/single/button/node/__test__/icontextnode.test.js
  23. 32
      packages/fineui/src/base/single/button/node/__test__/texticonnode.test.js
  24. 32
      packages/fineui/src/base/single/button/node/__test__/textnode.test.js
  25. 10
      packages/fineui/src/base/single/html/__test__/html.test.js
  26. 4
      packages/fineui/src/base/single/iframe/__test__/iframe.test.js
  27. 8
      packages/fineui/src/base/single/img/__test__/img.test.js
  28. 6
      packages/fineui/src/base/single/link/__test__/link.test.js
  29. 5
      packages/fineui/src/base/tree/customtree.js
  30. 24
      packages/fineui/src/case/button/node/__test__/node.arrow.test.js
  31. 20
      packages/fineui/src/case/button/node/__test__/node.first.plus.test.js
  32. 20
      packages/fineui/src/case/button/node/__test__/node.icon.arrow.test.js
  33. 20
      packages/fineui/src/case/button/node/__test__/node.last.plus.test.js
  34. 20
      packages/fineui/src/case/button/node/__test__/node.mid.plus.test.js
  35. 24
      packages/fineui/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js
  36. 20
      packages/fineui/src/case/button/node/__test__/node.plus.test.js
  37. 98
      packages/fineui/src/case/button/treeitem/__test__/item.treeleaf.test.js
  38. 14
      packages/fineui/src/case/colorchooser/__test__/colorchooser.test.js
  39. 6
      packages/fineui/src/case/colorchooser/farbtastic/__test__/farbtastic.test.js
  40. 18
      packages/fineui/src/case/combo/bubblecombo/__test__/combo.bubble.test.js
  41. 8
      packages/fineui/src/case/combo/editoriconcheckcombo/__test__/combo.editiconcheck.test.js
  42. 10
      packages/fineui/src/case/combo/icontextvaluecombo/__test__/combo.icontextvalue.test.js
  43. 20
      packages/fineui/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js
  44. 14
      packages/fineui/src/case/combo/textvaluecheckcombo/__test__/combo.textvaluecheck.test.js
  45. 18
      packages/fineui/src/case/combo/textvaluecombo/__test__/combo.textvalue.test.js
  46. 26
      packages/fineui/src/case/editor/__test__/editor.clear.test.js
  47. 18
      packages/fineui/src/case/editor/__test__/editor.sign.test.js
  48. 18
      packages/fineui/src/case/editor/__test__/editor.state.simple.test.js
  49. 18
      packages/fineui/src/case/editor/__test__/editor.state.test.js
  50. 16
      packages/fineui/src/case/loader/__test__/loader.lazy.test.js
  51. 16
      packages/fineui/src/case/loader/__test__/loader.list.test.js
  52. 40
      packages/fineui/src/case/pager/__test__/pager.test.js
  53. 8
      packages/fineui/src/case/segment/__test__/segment.test.js
  54. 10
      packages/fineui/src/component/allvaluechooser/__test__/combo.allvaluechooser.test.js
  55. 6
      packages/fineui/src/component/allvaluemultitextvaluecombo/__test__/allvalue.multitextvalue.combo.test.js
  56. 30
      packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.insert.test.js
  57. 22
      packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.test.js
  58. 14
      packages/fineui/src/component/valuechooser/__test__/pane.valuechooser.test.js
  59. 8
      packages/fineui/src/core/1.lodash.js
  60. 2
      packages/fineui/src/core/5.inject.js
  61. 110
      packages/fineui/src/core/__test__/alias.test.js
  62. 280
      packages/fineui/src/core/__test__/base.test.js
  63. 24
      packages/fineui/src/core/__test__/context.test.js
  64. 8
      packages/fineui/src/core/__test__/widget.test.js
  65. 11
      packages/fineui/src/core/constant/writable.var.js
  66. 2
      packages/fineui/src/core/controller/controller.layer.js
  67. 38
      packages/fineui/src/core/func/__test__/date.test.js
  68. 14
      packages/fineui/src/core/func/__test__/function.test.js
  69. 10
      packages/fineui/src/core/func/__test__/string.test.js
  70. 7
      packages/fineui/src/core/func/alias.js
  71. 36
      packages/fineui/src/core/platform/web/jquery/__test__/fn.test.js
  72. 10
      packages/fineui/src/core/utils/__test__/aes.test.js
  73. 9
      packages/fineui/src/core/utils/dom.js
  74. 8
      packages/fineui/src/less/base/colorchooser/colorpicker/button.colorshow.less
  75. 12
      packages/fineui/src/less/base/single/button/button.less
  76. 2
      packages/fineui/src/less/base/single/button/switch.less
  77. 6
      packages/fineui/src/less/core/utils/common.less
  78. 6
      packages/fineui/src/less/core/utils/list-item.less
  79. 3
      packages/fineui/src/less/lib/colors.less
  80. 4
      packages/fineui/src/less/lib/theme.less
  81. 32
      packages/fineui/src/widget/datepane/__test__/datepane.test.js
  82. 16
      packages/fineui/src/widget/datetime/__test__/datetime.test.js
  83. 32
      packages/fineui/src/widget/datetimepane/__test__/datetimepane.test.js
  84. 14
      packages/fineui/src/widget/downlist/__test__/downlist.test.js
  85. 46
      packages/fineui/src/widget/dynamicdate/__test__/dynamicdate.test.js
  86. 46
      packages/fineui/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
  87. 50
      packages/fineui/src/widget/editor/__test__/editor.search.test.js
  88. 42
      packages/fineui/src/widget/editor/__test__/editor.text.test.js
  89. 26
      packages/fineui/src/widget/intervalslider/__test__/accuratecalculation.test.js
  90. 22
      packages/fineui/src/widget/intervalslider/__test__/intervalslider.test.js
  91. 14
      packages/fineui/src/widget/multilayerdownlist/__test__/downlist.test.js
  92. 10
      packages/fineui/src/widget/multilayerselecttree/__test__/multilayerselecttree.combo.test.js
  93. 22
      packages/fineui/src/widget/multilayersingletree/__test__/multilayersingletree.combo.test.js
  94. 24
      packages/fineui/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js
  95. 6
      packages/fineui/src/widget/multiselect/loader.js
  96. 5
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.js
  97. 7
      packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js
  98. 7
      packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js
  99. 2
      packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js
  100. 14
      packages/fineui/src/widget/multiselectlist/__test__/multiselect.insert.nobar.test.js
  101. Some files were not shown because too many files have changed in this diff Show More

2
.npmrc

@ -1,2 +1,2 @@
PUPPETEER_DOWNLOAD_BASE_URL=https://cdn.npmmirror.com/binaries/chrome-for-testing
puppeteer_download_host=https://npm.taobao.org/mirrors
@fui:registry=https://npm.fineres.com/

2
packages/demo/i18n/i18n.cn.js

@ -1,4 +1,4 @@
window.BI = window.BI || {};
window.BI = {};
window.BI.i18n = {
'BI-Multi_Date_Quarter_End': '季度末',
'BI-Multi_Date_Month_Begin': '月初',

2
packages/fineui/.gitignore vendored

@ -1,2 +0,0 @@
logs/*
coverage/*

18
packages/fineui/bi.lessconfig.json

@ -23,8 +23,8 @@
"@color-bi-border-disabled-radio": "rgba(9, 30, 64, 0.19)",
"@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-border-checkbox-theme-dark": "rgba(255, 255, 255, 0.37)",
"@color-bi-border-hover-active-radio-theme-dark": "#3869DC",
"@color-bi-background-active-radio-content-theme-dark": "#3869DC",
"@color-bi-border-hover-active-radio-theme-dark": "#497FFD",
"@color-bi-background-active-radio-content-theme-dark": "#497FFD",
"@color-bi-background-disabled-active-radio-content": "#FFFFFF",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
@ -48,5 +48,17 @@
"@font-solid-bottom": "e905",
"@font-solid-right": "e906",
"@font-dot": "e762",
"@font-down-triangle": "e70b"
"@font-down-triangle": "e70b",
"@color-bi-background-theme-dark": "#1B1F31",
"@border-color-light-line-theme-dark": "#30364B",
"@color-bi-background-header-background": "#F8F9FC",
"@color-bi-background-header-background-theme-dark": "#1B1F31",
"@color-bi-background-common-light-button": "#E5EFFF",
"@color-bi-background-common-light-button-theme-dark": "#0F2A62",
"@color-bi-text-highlight-theme-dark": "#497FFD",
"@color-bi-border-active-chooser-show-button-theme-dark": "#497FFD",
"@color-bi-background-button-theme-dark": "#497FFD",
"@color-bi-background-active-switch-theme-dark": "#497FFD",
"@color-bi-text-common-light-button-theme-dark": "#497FFD",
"@color-bi-text-common-light-button": "#2c60db"
}

BIN
packages/fineui/dist/font/iconfont.eot vendored

Binary file not shown.

124
packages/fineui/dist/font/iconfont.svg vendored

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
packages/fineui/dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
packages/fineui/dist/font/iconfont.woff vendored

Binary file not shown.

BIN
packages/fineui/dist/font/iconfont.woff2 vendored

Binary file not shown.

51
packages/fineui/jest.config.ts

@ -1,51 +0,0 @@
import type { Config } from "jest";
// import webpackConfig from "./webpack/webpack.dev";
export default {
// testEnvironment: "<rootDir>/test/testEnvironmentJsdom.ts",
testEnvironment: "jsdom",
testEnvironmentOptions: {
// html: fs.readFileSync(path.join(__dirname, "test/index.html")),
},
testMatch: ["<rootDir>/src/**/*.test.js"],
collectCoverage: false,
collectCoverageFrom: ["src/**/*.js", "!src/**/*.test.js"],
coverageDirectory: "coverage",
coverageReporters: ["html", "json-summary", "cobertura"],
reporters: [
"default",
[
"jest-html-reporters",
{
publicPath: "./html-report",
openReport: true,
},
],
],
transform: {
"^.+\\.jsx?$": "babel-jest",
"^.+\\.tsx?$": "babel-jest",
},
preset: "jest-puppeteer",
verbose: true,
watchman: true,
injectGlobals: true,
globals: {
"ts-jest": {
tsconfig: "tsconfig.json",
},
},
setupFilesAfterEnv: [
"<rootDir>/src/bundle.js",
"<rootDir>/src/core/platform/web/config.js",
"<rootDir>/../demo/i18n/i18n.cn.js",
"<rootDir>/test/utils.js",
"<rootDir>/test/prepare.js",
],
moduleNameMapper: {
"@/(.*)$": "<rootDir>/src/$1",
},
} as Config;

167
packages/fineui/karma.conf.js

@ -1,167 +0,0 @@
// Karma configuration
// Generated on Mon Nov 27 2017 11:16:26 GMT+0800 (中国标准时间)
const os = require("os");
const webpackConfig = require("./webpack/webpack.dev")
process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ["webpack", "mocha", "chai"],
// list of files / patterns to load in the browser
files: [].concat(
webpackConfig.entry.fineui,
["test/**/*.js", "src/**/*.test.js"]
),
exclude: [
"src/base/tree/ztree/jquery.ztree.core-3.5.js",
"src/base/tree/ztree/jquery.ztree.excheck-3.5.js",
"src/base/single/input/file.js",
"src/case/loading/loading_pane.js",
"src/base/tree/ztree/**/*.js",
"src/case/tree/ztree/*.js",
"src/widget/multitree/**/*.js",
"src/widget/multiselecttree/**/*.js",
"src/component/treevaluechooser/*.js"
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"src/less/**/*.less": ["webpack"],
"ui/**/*.less": ["webpack"],
"src/*.js": ["webpack"],
"src/**/!(*.test).js": ["webpack"],
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ["progress", "coverage", "html"],
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 300000,
browserNoActivityTimeout : 300000,
coverageReporter: {
// specify a common output directory
dir: "coverage/",
reporters: [
// reporters not supporting the `file` property
{ type: "html", subdir: "report-html" },
{ type: "json-summary", subdir: "report-json-summary" },
{ type: "cobertura", subdir: "report-cobertura"}
]
},
htmlReporter: {
outputFile: "logs/test-report.html"
},
// web server port
port: 9878,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
loggers: [
{
type: "console"
},
{
type: "file",
filename: "logs/karma.log"
}
],
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// you can define custom flags
customLaunchers: {
HeadlessChrome: {
base: "ChromeHeadless",
flags: [
"--no-sandbox",
"--remote-debugging-port=9222",
"--enable-logging",
"--user-data-dir=./karma-chrome",
"--v=1",
"--disable-background-timer-throttling",
"--disable-renderer-backgrounding",
"--proxy-bypass-list=*",
"--disable-web-security",
"--disable-gpu",
],
},
ChromeDebug: {
base: "Chrome",
flags: [
"--no-sandbox",
"--remote-debugging-port=9222",
"--enable-logging",
"--user-data-dir=./karma-chrome",
"--v=1",
"--disable-background-timer-throttling",
"--disable-renderer-backgrounding",
"--proxy-bypass-list=*",
"--disable-web-security",
"--disable-gpu",
],
},
},
// // start these browsers
// // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [os.platform() === "win32"
&& parseFloat(os.release()
.split(".")
.slice(0, 2)
.join(".")) <= 6.1
? "HeadlessChrome" : "ChromeHeadless"],
retryLimit: 30,
captureTimeout: 30000,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
webpack: webpackConfig,
plugins: [
"karma-webpack",
"karma-mocha",
"karma-chai",
"karma-chrome-launcher",
"karma-coverage",
"karma-htmlfile-reporter",
]
});
};

36
packages/fineui/package.json

@ -30,9 +30,7 @@
"tsc": "tsc",
"link": "pnpm link --global",
"build:biCss": "cross-env LESS_CONFIG_PATH=bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css",
"build:jsyCss": "cross-env LESS_CONFIG_PATH=jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css",
"test:jest": "jest --coverage --noStackTrace --silent",
"test:karma": "karma start"
"build:jsyCss": "cross-env LESS_CONFIG_PATH=jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css"
},
"files": [
"dist",
@ -59,37 +57,7 @@
"jquery": "3.6.3"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.24.1",
"@babel/plugin-transform-classes": "^7.24.5",
"@babel/plugin-transform-modules-commonjs": "7.6.0",
"@babel/plugin-transform-proto-to-assign": "^7.24.1",
"@babel/plugin-transform-react-jsx": "^7.23.4",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime": "7.20.1",
"@jest/environment": "^29.7.0",
"babel-jest": "^29.7.0",
"chai": "4.2.0",
"core-js": "^3.30.2",
"cross-env": "^7.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-environment-puppeteer": "^10.0.1",
"jest-html-reporters": "^3.1.7",
"jest-puppeteer": "^10.0.1",
"karma": "3.1.4",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.2",
"karma-htmlfile-reporter": "^0.3.8",
"karma-mocha": "1.3.0",
"karma-typescript": "^5.5.4",
"karma-webpack": "^5.0.1",
"mocha": "5.2.0",
"puppeteer": "^22.8.2",
"ts-jest": "^29.1.2"
"cross-env": "^7.0.3"
}
}

5
packages/fineui/src/base/collection/__test__/collection.test.js

@ -3,13 +3,12 @@
* @version 2.0
* Created by windy on 2020/3/17
*/
require("../../../bundle")
describe("CollectionTest", () => {
describe("CollectionTest", function () {
/**
* test_author_windy
*/
it("collection", () => {
it("collection", function () {
var items = [];
var cellCount = 100;
for (var i = 0; i < cellCount; i++) {

18
packages/fineui/src/base/foundation/__test__/message.test.js

@ -3,17 +3,17 @@
* @version 2.0
* Created by windy on 2020/3/9
*/
describe("MessageTest", () => {
describe("MessageTest", function () {
/**
* test_author_windy
*/
it("alert", done => {
it("alert", function (done) {
BI.Msg.alert("message", "ASASASASA");
var body = BI.Widget._renderEngine.createElement("body");
expect(body.find(".bi-message-depend").length).toBe(1);
expect(body.find(".bi-message-depend").length).to.equal(1);
BI.nextTick(function () {
body.find(".bi-message-depend .bi-button").click();
expect(body.find(".bi-message-depend").length).toBe(0);
expect(body.find(".bi-message-depend").length).to.equal(0);
done();
});
});
@ -21,15 +21,15 @@ describe("MessageTest", () => {
/**
* test_author_windy
*/
it("toast_hand_close", done => {
it("toast_hand_close", function (done) {
BI.Msg.toast("message", {
autoClose: false,
});
var body = BI.Widget._renderEngine.createElement("body");
expect(body.find(".bi-toast").length).toBe(1);
expect(body.find(".bi-toast").length).to.equal(1);
BI.nextTick(function () {
body.find(".bi-toast .bi-icon-button").click();
expect(body.find(".bi-toast").length).toBe(0);
expect(body.find(".bi-toast").length).to.equal(0);
done();
});
});
@ -37,9 +37,9 @@ describe("MessageTest", () => {
/**
* test_author_windy
*/
it("toast_auto_close", () => {
it("toast_auto_close", function () {
BI.Msg.toast("message");
var body = BI.Widget._renderEngine.createElement("body");
expect(body.find(".bi-toast").length).toBe(1);
expect(body.find(".bi-toast").length).to.equal(1);
});
});

4
packages/fineui/src/base/grid/__test__/grid.test.js

@ -3,11 +3,11 @@
* @version 2.0
* Created by windy on 2020/3/20
*/
describe("GridTest", () => {
describe("GridTest", function () {
/**
* test_author_windy
*/
it("grid", () => {
it("grid", function () {
var items = [];
var rowCount = 1000, columnCount = 100;
for (var i = 0; i < rowCount; i++) {

6
packages/fineui/src/base/layer/__test__/layer.popover.test.js

@ -4,11 +4,11 @@
* Created by windy on 2020/3/17
*/
describe("PopoverTest", () => {
describe("PopoverTest", function () {
/**
* test_author_windy
*/
it("BarPopover", done => {
it("BarPopover", function (done) {
var id = BI.UUID();
BI.Popovers.remove(id);
BI.Popovers.create(id, {
@ -24,7 +24,7 @@ describe("PopoverTest", () => {
},
}).open(id);
BI.delay(function () {
expect(BI.Widget._renderEngine.createElement("body").find(".bi-popup-view .bi-z-index-mask").length).toBe(1);
expect(BI.Widget._renderEngine.createElement("body").find(".bi-popup-view .bi-z-index-mask").length).to.equal(1);
BI.Popovers.remove(id);
done();
}, 100);

6
packages/fineui/src/base/list/__test__/listview.test.js

@ -5,11 +5,11 @@
*/
// TODO 展示类控件测什么没想好标记一下
describe("ListView && VirtualList", () => {
describe("ListView && VirtualList", function () {
/**
* test_author_windy
*/
it("ListView初始化测试", () => {
it("ListView初始化测试", function () {
var a = BI.Test.createWidget({
type: "bi.list_view",
el: {
@ -31,7 +31,7 @@ describe("ListView && VirtualList", () => {
/**
* test_author_windy
*/
it("VirtualList初始化测试", () => {
it("VirtualList初始化测试", function () {
var a = BI.Test.createWidget({
type: "bi.virtual_list",
items: BI.map(BI.range(0, 100), function (i, item) {

60
packages/fineui/src/base/single/__test__/text.test.js

@ -1,54 +1,54 @@
/**
* Created by windy on 2018/01/23.
*/
describe("TextTest", () => {
describe("TextTest", function () {
/**
* test_author_windy
*/
it("setText", () => {
it("setText", function () {
var text = BI.Test.createWidget({
type: "bi.text",
});
text.setText("AAA");
expect(text.element.text()).toBe("AAA");
expect(text.element.text()).to.equal("AAA");
text.destroy();
});
/**
* test_author_windy
*/
it("setStyle", () => {
it("setStyle", function () {
var text = BI.Test.createWidget({
type: "bi.text",
});
text.setStyle({ "color": "red" });
expect(text.element.getStyle("color")).toBe("rgb(255, 0, 0)");
expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)");
text.destroy();
});
/**
* test_author_windy
*/
it("高亮doHighlight", () => {
it("高亮doHighlight", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "AAA",
highLight: true,
});
expect(text.element.getStyle("color")).toBe("rgb(54, 133, 242)");
expect(text.element.getStyle("color")).to.equal("rgb(54, 133, 242)");
text.destroy();
});
/**
* test_author_windy
*/
it("标红doRedMark", () => {
it("标红doRedMark", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是要标红的A",
keyword: "A",
});
expect(text.element.children(".bi-keyword-red-mark").length).not.toBe(0);
expect(text.element.children(".bi-keyword-red-mark").length).to.not.equal(0);
text.destroy();
});
@ -56,89 +56,89 @@ describe("TextTest", () => {
/**
* test_author_windy
*/
it("取消高亮undoHighlight", () => {
it("取消高亮undoHighlight", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "AAA",
highLight: true,
});
text.unHighLight();
expect(text.element.getStyle("color")).not.toBe("rgb(54, 133, 242)");
expect(text.element.getStyle("color")).to.not.equal("rgb(54, 133, 242)");
text.destroy();
});
/**
* test_author_windy
*/
it("取消标红undoRedMark", () => {
it("取消标红undoRedMark", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是要标红的A",
keyword: "A",
});
text.unRedMark();
expect(text.element.children(".bi-keyword-red-mark").length).toBe(0);
expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0);
text.destroy();
});
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var text = BI.Test.createWidget({
type: "bi.text",
value: "AAA",
});
text.setValue("value");
expect(text.element.text()).toBe("value");
expect(text.element.text()).to.equal("value");
text.destroy();
});
/**
* test_author_windy
*/
it("gap测试", () => {
it("gap测试", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是要标红的A",
vgap: 10,
hgap: 10,
});
expect(text.element.css("padding")).toBe("10px");
expect(text.element.css("padding")).to.equal("10px");
text.destroy();
});
/**
* test_author_windy
*/
it("空格测试", () => {
it("空格测试", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是要标红的 A",
});
expect(text.element.text()).toBe("我是要标红的 A");
expect(text.element.text()).to.equal("我是要标红的 A");
text.destroy();
});
/**
* test_author_windy
*/
it("lineHeight和height", () => {
it("lineHeight和height", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是A",
lineHeight: 12,
height: 24,
});
expect(text.element.css("height")).toBe("24px");
expect(text.element.css("line-height")).toBe("12px");
expect(text.element.css("height")).to.equal("24px");
expect(text.element.css("line-height")).to.equal("12px");
text.destroy();
});
/**
* test_author_windy
*/
it("handler", done => {
it("handler", function (done) {
var text = BI.Test.createWidget({
type: "bi.text",
text: "我是A",
@ -148,7 +148,7 @@ describe("TextTest", () => {
});
BI.nextTick(function () {
text.text.element.click();
expect(text.text.element.text()).toBe("handler");
expect(text.text.element.text()).to.equal("handler");
text.destroy();
done();
});
@ -157,38 +157,38 @@ describe("TextTest", () => {
/**
* test_author_windy
*/
it("text的value属性", () => {
it("text的value属性", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: "",
value: "aaaa",
});
expect(text.element.text()).toBe("");
expect(text.element.text()).to.equal("");
text.destroy();
});
/**
* test_author_windy
*/
it("text的value属性1", () => {
it("text的value属性1", function () {
var text = BI.Test.createWidget({
type: "bi.text",
value: "aaaa",
});
expect(text.element.text()).toBe("aaaa");
expect(text.element.text()).to.equal("aaaa");
text.destroy();
});
/**
* test_author_windy
*/
it("text的value属性2", () => {
it("text的value属性2", function () {
var text = BI.Test.createWidget({
type: "bi.text",
text: null,
value: "aaaa",
});
expect(text.element.text()).toBe("");
expect(text.element.text()).to.equal("");
text.destroy();
});
});

10
packages/fineui/src/base/single/a/__test__/a.test.js

@ -1,23 +1,23 @@
/**
* Created by windy on 2018/01/23.
*/
describe("ALinkTest", () => {
describe("ALinkTest", function () {
/**
* test_author_windy
*/
it("A初始化测试", () => {
it("A初始化测试", function () {
var a = BI.Test.createWidget({
type: "bi.a",
text: "CCC",
});
expect(a.element.is("a")).toBe(true);
expect(a.element.is("a")).to.equal(true);
a.destroy();
});
/**
* test_author_windy
*/
it("A的el测试", () => {
it("A的el测试", function () {
var a = BI.Test.createWidget({
type: "bi.a",
text: "DDD",
@ -25,7 +25,7 @@ describe("ALinkTest", () => {
type: "bi.label",
},
});
expect(a.element.is("a") && a.element.hasClass("bi-label")).toBe(true);
expect(a.element.is("a") && a.element.hasClass("bi-label")).to.equal(true);
a.destroy();
});
});

22
packages/fineui/src/base/single/button/buttons/__test__/button.test.js

@ -1,11 +1,11 @@
/**
* Created by windy on 2018/01/23.
*/
describe("ButtonTest", () => {
describe("ButtonTest", function () {
/**
* test_author_windy
*/
it("Click点击触发事件", done => {
it("Click点击触发事件", function (done) {
var button = BI.Test.createWidget({
type: "bi.button",
text: "CCC",
@ -15,7 +15,7 @@ describe("ButtonTest", () => {
});
BI.nextTick(function () {
button.element.click();
expect(button.element.children(".bi-text").text()).toBe("click");
expect(button.element.children(".bi-text").text()).to.equal("click");
button.destroy();
done();
});
@ -25,7 +25,7 @@ describe("ButtonTest", () => {
/**
* test_author_windy
*/
it("MouseDown触发事件", done => {
it("MouseDown触发事件", function (done) {
var button = BI.Test.createWidget({
type: "bi.button",
text: "CCC",
@ -36,7 +36,7 @@ describe("ButtonTest", () => {
});
BI.nextTick(function () {
button.element.mousedown();
expect(button.element.children(".bi-text").text()).toBe("click");
expect(button.element.children(".bi-text").text()).to.equal("click");
button.destroy();
done();
});
@ -45,7 +45,7 @@ describe("ButtonTest", () => {
/**
* test_author_windy
*/
it("MouseUp触发事件", done => {
it("MouseUp触发事件", function (done) {
var button = BI.Test.createWidget({
type: "bi.button",
text: "CCC",
@ -57,7 +57,7 @@ describe("ButtonTest", () => {
BI.nextTick(function () {
button.element.mousedown();
button.element.mouseup();
expect(button.element.children(".bi-text").text()).toBe("click");
expect(button.element.children(".bi-text").text()).to.equal("click");
button.destroy();
done();
});
@ -66,7 +66,7 @@ describe("ButtonTest", () => {
/**
* test_author_windy
*/
it("doubleClick触发事件", done => {
it("doubleClick触发事件", function (done) {
var button = BI.Test.createWidget({
type: "bi.button",
text: "CCC",
@ -77,7 +77,7 @@ describe("ButtonTest", () => {
});
BI.nextTick(function () {
button.element.dblclick();
expect(button.element.children(".bi-text").text()).toBe("click");
expect(button.element.children(".bi-text").text()).to.equal("click");
button.destroy();
done();
});
@ -86,7 +86,7 @@ describe("ButtonTest", () => {
/**
* test_author_windy
*/
it("LongClick触发事件", done => {
it("LongClick触发事件", function (done) {
var clickNum = 0;
var button = BI.Test.createWidget({
type: "bi.button",
@ -102,7 +102,7 @@ describe("ButtonTest", () => {
BI.nextTick(function () {
button.element.mousedown();
BI.delay(function () {
expect(clickNum).toBe(2);
expect(clickNum).to.equal(2);
button.destroy();
done();
}, 360);

32
packages/fineui/src/base/single/button/node/__test__/icontexticonnode.test.js

@ -3,88 +3,88 @@
* @date 2020/4/21
*/
describe("IconTextIconNodeTest", () => {
describe("IconTextIconNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", () => {
it("setText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
});
iconTextIconNode.setText("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("getText", () => {
it("getText", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "AAA",
});
expect(iconTextIconNode.getText()).toBe("AAA");
expect(iconTextIconNode.getText()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("setValue", () => {
it("setValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
});
iconTextIconNode.setValue("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("readonly下的setValue", () => {
it("readonly下的setValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA",
readonly: true,
});
iconTextIconNode.setValue("BBB");
expect(iconTextIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("getValue", () => {
it("getValue", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
value: "AAA",
});
expect(iconTextIconNode.getValue()).toBe("AAA");
expect(iconTextIconNode.getValue()).to.equal("AAA");
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("doRedMark和unRedMark", () => {
it("doRedMark和unRedMark", function () {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "要标红的AAA",
});
iconTextIconNode.doRedMark("AAA");
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
iconTextIconNode.unRedMark();
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(iconTextIconNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
iconTextIconNode.destroy();
});
/**
* test_author_kobi
*/
it("Click点击触发事件", done => {
it("Click点击触发事件", function (done) {
var iconTextIconNode = BI.Test.createWidget({
type: "bi.icon_text_icon_node",
text: "AAA",
@ -94,7 +94,7 @@ describe("IconTextIconNodeTest", () => {
});
BI.nextTick(function () {
iconTextIconNode.element.click();
expect(iconTextIconNode.element.find(".bi-text").text()).toBe("click");
expect(iconTextIconNode.element.find(".bi-text").text()).to.equal("click");
iconTextIconNode.destroy();
done();
});

32
packages/fineui/src/base/single/button/node/__test__/icontextnode.test.js

@ -3,88 +3,88 @@
* @date 2020/4/21
*/
describe("IconTextNodeTest", () => {
describe("IconTextNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", () => {
it("setText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
});
iconTextNode.setText("AAA");
expect(iconTextNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("getText", () => {
it("getText", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "AAA",
});
expect(iconTextNode.getText()).toBe("AAA");
expect(iconTextNode.getText()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("setValue", () => {
it("setValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
});
iconTextNode.setValue("AAA");
expect(iconTextNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("readonly下的setValue", () => {
it("readonly下的setValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA",
readonly: true,
});
iconTextNode.setValue("BBB");
expect(iconTextNode.element.find(".bi-text").text()).toBe("AAA");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("getValue", () => {
it("getValue", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
value: "AAA",
});
expect(iconTextNode.getValue()).toBe("AAA");
expect(iconTextNode.getValue()).to.equal("AAA");
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("doRedMark和unRedMark", () => {
it("doRedMark和unRedMark", function () {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "要标红的AAA",
});
iconTextNode.doRedMark("AAA");
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
iconTextNode.unRedMark();
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(iconTextNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
iconTextNode.destroy();
});
/**
* test_author_kobi
*/
it("Click点击触发事件", done => {
it("Click点击触发事件", function (done) {
var iconTextNode = BI.Test.createWidget({
type: "bi.icon_text_node",
text: "AAA",
@ -94,7 +94,7 @@ describe("IconTextNodeTest", () => {
});
BI.nextTick(function () {
iconTextNode.element.click();
expect(iconTextNode.element.find(".bi-text").text()).toBe("click");
expect(iconTextNode.element.find(".bi-text").text()).to.equal("click");
iconTextNode.destroy();
done();
});

32
packages/fineui/src/base/single/button/node/__test__/texticonnode.test.js

@ -3,88 +3,88 @@
* @date 2020/4/21
*/
describe("TextIconNodeTest", () => {
describe("TextIconNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", () => {
it("setText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
});
textIconNode.setText("AAA");
expect(textIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("getText", () => {
it("getText", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "AAA",
});
expect(textIconNode.getText()).toBe("AAA");
expect(textIconNode.getText()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("setValue", () => {
it("setValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
});
textIconNode.setValue("AAA");
expect(textIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("readonly下的setValue", () => {
it("readonly下的setValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA",
readonly: true,
});
textIconNode.setValue("BBB");
expect(textIconNode.element.find(".bi-text").text()).toBe("AAA");
expect(textIconNode.element.find(".bi-text").text()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("getValue", () => {
it("getValue", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
value: "AAA",
});
expect(textIconNode.getValue()).toBe("AAA");
expect(textIconNode.getValue()).to.equal("AAA");
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("doRedMark和unRedMark", () => {
it("doRedMark和unRedMark", function () {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "要标红的AAA",
});
textIconNode.doRedMark("AAA");
expect(textIconNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textIconNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textIconNode.unRedMark();
expect(textIconNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textIconNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textIconNode.destroy();
});
/**
* test_author_kobi
*/
it("Click点击触发事件", done => {
it("Click点击触发事件", function (done) {
var textIconNode = BI.Test.createWidget({
type: "bi.text_icon_node",
text: "AAA",
@ -94,7 +94,7 @@ describe("TextIconNodeTest", () => {
});
BI.nextTick(function () {
textIconNode.element.click();
expect(textIconNode.element.find(".bi-text").text()).toBe("click");
expect(textIconNode.element.find(".bi-text").text()).to.equal("click");
textIconNode.destroy();
done();
});

32
packages/fineui/src/base/single/button/node/__test__/textnode.test.js

@ -3,89 +3,89 @@
* @date 2020/4/21
*/
describe("TextNodeTest", () => {
describe("TextNodeTest", function () {
/**
* test_author_kobi
*/
it("setText", () => {
it("setText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
});
textNode.setText("AAA");
expect(textNode.element.children(".bi-text").text()).toBe("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
it("getText", () => {
it("getText", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
whiteSpace: "normal",
});
expect(textNode.getText()).toBe("AAA");
expect(textNode.getText()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
it("setValue", () => {
it("setValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
});
textNode.setValue("AAA");
expect(textNode.element.children(".bi-text").text()).toBe("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
it("readonly下的setValue", () => {
it("readonly下的setValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA",
readonly: true,
});
textNode.setValue("BBB");
expect(textNode.element.children(".bi-text").text()).toBe("AAA");
expect(textNode.element.children(".bi-text").text()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
it("getValue", () => {
it("getValue", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
value: "AAA",
});
expect(textNode.getValue()).toBe("AAA");
expect(textNode.getValue()).to.equal("AAA");
textNode.destroy();
});
/**
* test_author_kobi
*/
it("doRedMark和unRedMark", () => {
it("doRedMark和unRedMark", function () {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "要标红的AAA",
});
textNode.doRedMark("AAA");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark();
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_kobi
*/
it("Click点击触发事件", done => {
it("Click点击触发事件", function (done) {
var textNode = BI.Test.createWidget({
type: "bi.text_node",
text: "AAA",
@ -95,7 +95,7 @@ describe("TextNodeTest", () => {
});
BI.nextTick(function () {
textNode.element.click();
expect(textNode.element.children(".bi-text").text()).toBe("click");
expect(textNode.element.children(".bi-text").text()).to.equal("click");
textNode.destroy();
done();
});

10
packages/fineui/src/base/single/html/__test__/html.test.js

@ -4,16 +4,16 @@
* Created by windy on 2020/3/10
*/
describe("HtmlTest", () => {
describe("HtmlTest", function () {
/**
* test_author_windy
*/
it("html_h1", () => {
it("html_h1", function () {
var a = BI.Test.createWidget({
type: "bi.html",
text: "<h1>在bi.html标签中使用html原生标签</h1>",
});
expect(a.element.find("h1").length).toBe(1);
expect(a.element.find("h1").length).to.equal(1);
a.destroy();
});
@ -21,7 +21,7 @@ describe("HtmlTest", () => {
/**
* test_author_windy
*/
it("html测试属性方法", () => {
it("html测试属性方法", function () {
var a = BI.Test.createWidget({
type: "bi.html",
text: "<h1>在bi.html标签中使用html原生标签</h1>",
@ -35,7 +35,7 @@ describe("HtmlTest", () => {
});
a.setValue("DDDDD");
a.setStyle({ "background-color": "red" });
expect(a.text.element.css("background-color")).toBe("rgb(255, 0, 0)");
expect(a.text.element.css("background-color")).to.equal("rgb(255, 0, 0)");
a.destroy();
});
});

4
packages/fineui/src/base/single/iframe/__test__/iframe.test.js

@ -4,11 +4,11 @@
* Created by windy on 2020/3/17
*/
describe("IframeTest", () => {
describe("IframeTest", function () {
/**
* test_author_windy
*/
it("directionPager", () => {
it("directionPager", function () {
var a = BI.Test.createWidget({
type: "bi.iframe",
});

8
packages/fineui/src/base/single/img/__test__/img.test.js

@ -4,19 +4,19 @@
* Created by windy on 2020/3/17
*/
describe("ImgTest", () => {
describe("ImgTest", function () {
/**
* test_author_windy
*/
it("img", () => {
it("img", function () {
var a = BI.Test.createWidget({
type: "bi.img",
iconWidth: 36,
iconHeight: 36,
});
a.setSrc("test.png");
expect(a.element.attr("src")).toBe("test.png");
expect(a.getSrc()).toBe("test.png");
expect(a.element.attr("src")).to.equal("test.png");
expect(a.getSrc()).to.equal("test.png");
a.destroy();
});
});

6
packages/fineui/src/base/single/link/__test__/link.test.js

@ -4,15 +4,15 @@
* Created by windy on 2020/3/17
*/
describe("LinkTest", () => {
describe("LinkTest", function () {
/**
* test_author_windy
*/
it("link", () => {
it("link", function () {
var a = BI.Test.createWidget({
type: "bi.link",
});
expect(a.element.is("a")).toBe(true);
expect(a.element.is("a")).to.equal(true);
a.destroy();
});
});

5
packages/fineui/src/base/tree/customtree.js

@ -16,7 +16,8 @@ import {
isNull,
createWidget,
Controller,
Events
Events,
omit,
} from "@/core";
/**
@ -104,7 +105,7 @@ export class CustomTree extends Widget {
return itemsCreator.apply(this, args);
};
isNull(item.popup.el) && (item.popup.el = deepClone(this.options.el));
isNull(item.popup.el) && (item.popup.el = deepClone(omit(this.options.el, "node")));
item.popup.el.node = item.el;
items.push(item);
} else {

24
packages/fineui/src/case/button/node/__test__/node.arrow.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.arrow", () => {
describe("test node.arrow", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.arrow_group_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.arrow_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".expander-down-font").length).not.toBe(0);
expect(widget.element.find(".expander-down-font").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-right-font").length).not.toBe(0);
expect(widget.element.find(".expander-right-font").length).to.not.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.arrow", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.arrow_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-down-font").length).not.toBe(0);
expect(widget.element.find(".expander-down-font").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-right-font").length).not.toBe(0);
expect(widget.element.find(".expander-right-font").length).to.not.equal(0);
widget.destroy();
done();
});
@ -67,13 +67,13 @@ describe("test node.arrow", () => {
/**
* test_author_kobi
**/
it("setText", () => {
it("setText", function () {
var widget = BI.Test.createWidget({
type: "bi.arrow_group_node",
text: "AAA",
});
widget.setText("BBB");
expect(widget.element.find(".bi-text").text()).toBe("BBB");
expect(widget.element.find(".bi-text").text()).to.equal("BBB");
widget.destroy();
});
});

20
packages/fineui/src/case/button/node/__test__/node.first.plus.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.first.plus", () => {
describe("test node.first.plus", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.first_plus_group_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.first_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type2").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type2").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type2").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type2").length).to.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.first.plus", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.first_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type2").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type2").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type2").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type2").length).to.equal(0);
widget.destroy();
done();
});

20
packages/fineui/src/case/button/node/__test__/node.icon.arrow.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.icon.arrow", () => {
describe("test node.icon.arrow", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.icon_arrow_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.icon_arrow_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".expander-down-font").length).not.toBe(0);
expect(widget.element.find(".expander-down-font").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-right-font").length).not.toBe(0);
expect(widget.element.find(".expander-right-font").length).to.not.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.icon.arrow", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.icon_arrow_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-down-font").length).not.toBe(0);
expect(widget.element.find(".expander-down-font").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".expander-right-font").length).not.toBe(0);
expect(widget.element.find(".expander-right-font").length).to.not.equal(0);
widget.destroy();
done();
});

20
packages/fineui/src/case/button/node/__test__/node.last.plus.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.last.plus", () => {
describe("test node.last.plus", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.last_plus_group_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.last_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type4").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type4").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type4").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type4").length).to.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.last.plus", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.last_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type4").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type4").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type4").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type4").length).to.equal(0);
widget.destroy();
done();
});

20
packages/fineui/src/case/button/node/__test__/node.mid.plus.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.mid.plus", () => {
describe("test node.mid.plus", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.mid_plus_group_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.mid_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type3").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type3").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type3").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type3").length).to.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.mid.plus", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.mid_plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type3").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type3").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type3").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type3").length).to.equal(0);
widget.destroy();
done();
});

24
packages/fineui/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js

@ -3,44 +3,44 @@
* @date 2020/5/12
*/
describe("test node.multilayer.icon.arrow", () => {
describe("test node.multilayer.icon.arrow", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.multilayer_icon_arrow_node",
text: "要标红的AAA",
layer: 3,
});
expect(widget.isOnce()).toBe(true);
expect(widget.isOnce()).to.equal(true);
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("isSelected 和 setSelected", () => {
it("isSelected 和 setSelected", function () {
var widget = BI.Test.createWidget({
type: "bi.multilayer_icon_arrow_node",
text: "AAA",
layer: 3,
});
widget.setSelected(true);
expect(widget.element.find(".active").length).not.toBe(0);
expect(widget.isSelected()).toBe(true);
expect(widget.element.find(".active").length).to.not.equal(0);
expect(widget.isSelected()).to.equal(true);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.multilayer_icon_arrow_node",
text: "AAA",
@ -48,7 +48,7 @@ describe("test node.multilayer.icon.arrow", () => {
});
BI.nextTick(function () {
widget.element.click();
expect(widget.isSelected()).toBe(true);
expect(widget.isSelected()).to.equal(true);
widget.destroy();
done();
});
@ -57,7 +57,7 @@ describe("test node.multilayer.icon.arrow", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.multilayer_icon_arrow_node",
text: "AAA",
@ -65,7 +65,7 @@ describe("test node.multilayer.icon.arrow", () => {
});
BI.nextTick(function () {
widget.node.element.click();
expect(widget.element.find(".expander-down-font").length).not.toBe(0);
expect(widget.element.find(".expander-down-font").length).to.not.equal(0);
widget.destroy();
done();
});

20
packages/fineui/src/case/button/node/__test__/node.plus.test.js

@ -3,38 +3,38 @@
* @date 2020/5/12
*/
describe("test node.plus", () => {
describe("test node.plus", function () {
/**
* test_author_kobi
**/
it("doRedMark 和 unRedMark", () => {
it("doRedMark 和 unRedMark", function () {
var widget = BI.Test.createWidget({
type: "bi.plus_group_node",
text: "要标红的AAA",
});
widget.doRedMark("AAA");
expect(widget.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
widget.unRedMark();
expect(widget.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(widget.element.find(".bi-keyword-red-mark").length).to.equal(0);
widget.destroy();
});
/**
* test_author_kobi
**/
it("doClick", done => {
it("doClick", function (done) {
var widget = BI.Test.createWidget({
type: "bi.plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type1").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type1").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.element.click();
expect(widget.element.find(".tree-expand-icon-type1").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type1").length).to.equal(0);
widget.destroy();
done();
});
@ -45,18 +45,18 @@ describe("test node.plus", () => {
/**
* test_author_kobi
**/
it("点击图标", done => {
it("点击图标", function (done) {
var widget = BI.Test.createWidget({
type: "bi.plus_group_node",
text: "AAA",
});
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type1").length).not.toBe(0);
expect(widget.element.find(".tree-expand-icon-type1").length).to.not.equal(0);
BI.delay(function () {
BI.nextTick(function () {
widget.checkbox.element.click();
expect(widget.element.find(".tree-expand-icon-type1").length).toBe(0);
expect(widget.element.find(".tree-expand-icon-type1").length).to.equal(0);
widget.destroy();
done();
});

98
packages/fineui/src/case/button/treeitem/__test__/item.treeleaf.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/8
*/
describe("leafTest", () => {
describe("leafTest", function () {
/**
* test_author_windy
*/
it("标红与高亮", () => {
it("标红与高亮", function () {
var textNode = BI.Test.createWidget({
type: "bi.first_tree_leaf_item",
id: "1",
@ -19,27 +19,27 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function", () => {
it("function", function () {
var textNode = BI.Test.createWidget({
type: "bi.first_tree_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});
@ -47,7 +47,7 @@ describe("leafTest", () => {
/**
* test_author_windy
*/
it("标红与高亮1", () => {
it("标红与高亮1", function () {
var textNode = BI.Test.createWidget({
type: "bi.last_tree_leaf_item",
id: "1",
@ -58,27 +58,27 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function1", () => {
it("function1", function () {
var textNode = BI.Test.createWidget({
type: "bi.last_tree_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});
@ -86,7 +86,7 @@ describe("leafTest", () => {
/**
* test_author_windy
*/
it("标红与高亮12", () => {
it("标红与高亮12", function () {
var textNode = BI.Test.createWidget({
type: "bi.mid_tree_leaf_item",
id: "1",
@ -97,34 +97,34 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function12", () => {
it("function12", function () {
var textNode = BI.Test.createWidget({
type: "bi.mid_tree_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});
/**
* test_author_windy
*/
it("标红与高亮123", () => {
it("标红与高亮123", function () {
var textNode = BI.Test.createWidget({
type: "bi.icon_tree_leaf_item",
id: "1",
@ -135,27 +135,27 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function123", () => {
it("function123", function () {
var textNode = BI.Test.createWidget({
type: "bi.icon_tree_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});
@ -163,7 +163,7 @@ describe("leafTest", () => {
/**
* test_author_windy
*/
it("标红与高亮1234", () => {
it("标红与高亮1234", function () {
var textNode = BI.Test.createWidget({
type: "bi.multilayer_icon_tree_leaf_item",
id: "1",
@ -174,27 +174,27 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function1234", () => {
it("function1234", function () {
var textNode = BI.Test.createWidget({
type: "bi.multilayer_icon_tree_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});
@ -202,7 +202,7 @@ describe("leafTest", () => {
/**
* test_author_windy
*/
it("标红与高亮12345", () => {
it("标红与高亮12345", function () {
var textNode = BI.Test.createWidget({
type: "bi.tree_text_leaf_item",
id: "1",
@ -213,27 +213,27 @@ describe("leafTest", () => {
keyword: "B"
});
textNode.doRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).not.toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.not.equal(0);
textNode.unRedMark("C");
expect(textNode.element.find(".bi-keyword-red-mark").length).toBe(0);
expect(textNode.element.find(".bi-keyword-red-mark").length).to.equal(0);
textNode.doHighLight("C");
expect(textNode.element.find(".bi-high-light").length).not.toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.not.equal(0);
textNode.unHighLight("C");
expect(textNode.element.find(".bi-high-light").length).toBe(0);
expect(textNode.element.find(".bi-high-light").length).to.equal(0);
textNode.destroy();
});
/**
* test_author_windy
*/
it("function12345", () => {
it("function12345", function () {
var textNode = BI.Test.createWidget({
type: "bi.tree_text_leaf_item",
id: "1",
pId: "-1"
});
expect(textNode.getId()).toBe("1");
expect(textNode.getPId()).toBe("-1");
expect(textNode.getId()).to.equal("1");
expect(textNode.getPId()).to.equal("-1");
textNode.destroy();
});

14
packages/fineui/src/case/colorchooser/__test__/colorchooser.test.js

@ -4,25 +4,25 @@
* Created by windy on 2020/3/3
*/
describe("color_chooser_test", () => {
describe("color_chooser_test", function () {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.color_chooser",
height: 24
});
widget.setValue("#69821b");
expect(widget.getValue()).toBe("#69821b");
expect(widget.getValue()).to.equal("#69821b");
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.color_chooser",
height: 24
@ -31,7 +31,7 @@ describe("color_chooser_test", () => {
BI.delay(function () {
// 等300ms, button有debounce
widget.element.find(".bi-color-picker .bi-color-picker-button:nth-child(3)").click();
expect(widget.getValue()).toBe("#e5e5e5");
expect(widget.getValue()).to.equal("#e5e5e5");
widget.destroy();
done();
}, 300);
@ -40,13 +40,13 @@ describe("color_chooser_test", () => {
/**
* test_author_windy
**/
it("默认值", () => {
it("默认值", function () {
var widget = BI.Test.createWidget({
type: "bi.color_chooser",
height: 24,
value: "#69821b"
});
expect(widget.getValue()).toBe("#69821b");
expect(widget.getValue()).to.equal("#69821b");
widget.destroy();
});
});

6
packages/fineui/src/case/colorchooser/farbtastic/__test__/farbtastic.test.js

@ -3,19 +3,19 @@
* @version 2.0
* Created by windy on 2020/3/20
*/
describe("FarbtasticTest", () => {
describe("FarbtasticTest", function () {
/**
* test_author_windy
*/
it("Farbtastic", () => {
it("Farbtastic", function () {
var a = BI.Test.createWidget({
type: "bi.farbtastic",
height: 200,
width: 200
});
a.setValue("#d56c6c");
expect(a.getValue()).toBe("#d56c6c");
expect(a.getValue()).to.equal("#d56c6c");
a.destroy();
});
});

18
packages/fineui/src/case/combo/bubblecombo/__test__/combo.bubble.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/3/2
*/
describe("bubble_combo", () => {
describe("bubble_combo", function () {
/**
* test_author_windy
*/
it("测试弹出收起", done => {
it("测试弹出收起", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -34,7 +34,7 @@ describe("bubble_combo", () => {
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).toBe("block");
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block");
bubbleCombo.destroy();
done();
})
@ -43,7 +43,7 @@ describe("bubble_combo", () => {
/**
* test_author_windy
*/
it("测试弹出收起", done => {
it("测试弹出收起", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -68,7 +68,7 @@ describe("bubble_combo", () => {
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).toBe("block");
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block");
bubbleCombo.destroy();
done();
})
@ -78,7 +78,7 @@ describe("bubble_combo", () => {
/**
* test_author_windy
*/
it("bubble_bar_popup_view", done => {
it("bubble_bar_popup_view", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -96,7 +96,7 @@ describe("bubble_combo", () => {
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).toBe(1);
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1);
bubbleCombo.destroy();
done();
})
@ -106,7 +106,7 @@ describe("bubble_combo", () => {
/**
* test_author_windy
*/
it("text_bubble_bar_popup_view", done => {
it("text_bubble_bar_popup_view", function (done) {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -124,7 +124,7 @@ describe("bubble_combo", () => {
});
BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).toBe(1);
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1);
bubbleCombo.destroy();
done();
})

8
packages/fineui/src/case/combo/editoriconcheckcombo/__test__/combo.editiconcheck.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/3/2
*/
describe("edit_icon_check_combo", () => {
describe("edit_icon_check_combo", function () {
/**
* test_author_windy
*/
it("测试弹出收起", done => {
it("测试弹出收起", function (done) {
var combo = BI.Test.createWidget({
type: "bi.editor_icon_check_combo",
watermark: "默认值",
@ -30,7 +30,7 @@ describe("edit_icon_check_combo", () => {
BI.nextTick(function () {
combo.element.find(".bi-editor-trigger").click();
combo.element.find(".bi-text-icon-popup .bi-single-select-item").click();
expect(combo.getValue()[0]).toBe("3");
expect(combo.getValue()[0]).to.equal("3");
combo.populate([{
text: "MVC-1",
value: "4"
@ -42,7 +42,7 @@ describe("edit_icon_check_combo", () => {
value: "6"
}]);
combo.setValue("4");
expect(combo.getValue()[0]).toBe("4");
expect(combo.getValue()[0]).to.equal("4");
combo.destroy();
done();
})

10
packages/fineui/src/case/combo/icontextvaluecombo/__test__/combo.icontextvalue.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/3/2
*/
describe("icontextvaluecombo", () => {
describe("icontextvaluecombo", function () {
/**
* test_author_windy
*/
it("测试setValue", () => {
it("测试setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.icon_text_value_combo",
text: "默认值",
@ -30,14 +30,14 @@ describe("icontextvaluecombo", () => {
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
/**
* test_author_windy
*/
it("测试populate", () => {
it("测试populate", function () {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
@ -58,7 +58,7 @@ describe("icontextvaluecombo", () => {
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
});

20
packages/fineui/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js

@ -4,10 +4,10 @@
* Created by windy on 2020/3/3
*/
describe("search_text_value_combo", () => {
describe("search_text_value_combo", function () {
var items;
beforeAll(() => {
before(function () {
items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
text: idx,
@ -20,7 +20,7 @@ describe("search_text_value_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.search_text_value_combo",
width: 220,
@ -28,28 +28,28 @@ describe("search_text_value_combo", () => {
items: items
});
widget.setValue(2);
expect(widget.getValue()[0]).toBe(2);
expect(widget.getValue()[0]).to.equal(2);
widget.destroy();
});
/**
* test_author_windy
**/
it("getValue", () => {
it("getValue", function () {
var widget = BI.Test.createWidget({
type: "bi.search_text_value_combo",
width: 220,
items: items,
value: 2
});
expect(widget.getValue()[0]).toBe(2);
expect(widget.getValue()[0]).to.equal(2);
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.search_text_value_combo",
width: 220,
@ -59,7 +59,7 @@ describe("search_text_value_combo", () => {
// 为什么要delay 300呢,因为按钮有debounce
BI.delay(function () {
widget.element.find(".bi-single-select-item:contains(10)").click();
expect(widget.getValue()[0]).toBe(10);
expect(widget.getValue()[0]).to.equal(10);
widget.destroy();
done();
}, 300);
@ -68,7 +68,7 @@ describe("search_text_value_combo", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.search_text_value_combo",
width: 220,
@ -81,7 +81,7 @@ describe("search_text_value_combo", () => {
BI.Test.triggerKeyDown(widget.element.find(".bi-search-text-value-trigger .bi-input"), "2", 50, function () {
BI.nextTick(function () {
widget.element.find(".bi-search-text-value-popup .bi-single-select-item")[0].click();
expect(widget.getValue()[0]).toEqual(2);
expect(widget.getValue()[0]).to.deep.equal(2);
widget.destroy();
done();
});

14
packages/fineui/src/case/combo/textvaluecheckcombo/__test__/combo.textvaluecheck.test.js

@ -4,7 +4,7 @@
* Created by windy on 2020/3/5
*/
describe("text_value_check_combo", () => {
describe("text_value_check_combo", function () {
var items = BI.map(BI.makeArray(11, null), function(idx, v) {
return {
@ -17,7 +17,7 @@ describe("text_value_check_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.text_value_check_combo",
width: 220,
@ -25,28 +25,28 @@ describe("text_value_check_combo", () => {
items: items
});
widget.setValue(2);
expect(widget.getValue()[0]).toBe(2);
expect(widget.getValue()[0]).to.equal(2);
widget.destroy();
});
/**
* test_author_windy
**/
it("getValue", () => {
it("getValue", function () {
var widget = BI.Test.createWidget({
type: "bi.text_value_check_combo",
width: 220,
items: items,
value: 2
});
expect(widget.getValue()[0]).toBe(2);
expect(widget.getValue()[0]).to.equal(2);
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.text_value_check_combo",
width: 220,
@ -56,7 +56,7 @@ describe("text_value_check_combo", () => {
// 为什么要delay 300呢,因为按钮有debounce
BI.delay(function () {
widget.element.find(".bi-single-select-item:contains(10)").click();
expect(widget.getValue()[0]).toBe(10);
expect(widget.getValue()[0]).to.equal(10);
widget.destroy();
done();
}, 300);

18
packages/fineui/src/case/combo/textvaluecombo/__test__/combo.textvalue.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/3/2
*/
describe("textvaluecombo", () => {
describe("textvaluecombo", function () {
/**
* test_author_windy
*/
it("测试setValue", () => {
it("测试setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
@ -30,14 +30,14 @@ describe("textvaluecombo", () => {
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
/**
* test_author_windy
*/
it("测试populate", () => {
it("测试populate", function () {
var combo = BI.Test.createWidget({
type: "bi.text_value_combo",
text: "默认值",
@ -58,14 +58,14 @@ describe("textvaluecombo", () => {
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
/**
* test_author_windy
*/
it("测试small_setValue", () => {
it("测试small_setValue", function () {
var combo = BI.Test.createWidget({
type: "bi.small_text_value_combo",
text: "默认值",
@ -86,14 +86,14 @@ describe("textvaluecombo", () => {
}]
});
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
/**
* test_author_windy
*/
it("测试small_populate", () => {
it("测试small_populate", function () {
var combo = BI.Test.createWidget({
type: "bi.small_text_value_combo",
text: "默认值",
@ -114,7 +114,7 @@ describe("textvaluecombo", () => {
value: 3
}]);
combo.setValue(2);
expect(combo.getValue()[0]).toBe(2);
expect(combo.getValue()[0]).to.equal(2);
combo.destroy();
});
});

26
packages/fineui/src/case/editor/__test__/editor.clear.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("clear_editor", () => {
describe("clear_editor", function () {
/**
* test_author_windy
*/
it("clear-editor", done => {
it("clear-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
@ -20,11 +20,11 @@ describe("clear_editor", () => {
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).toBe("AAAAA");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -33,7 +33,7 @@ describe("clear_editor", () => {
/**
* test_author_windy
*/
it("clear", done => {
it("clear", function (done) {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
@ -46,7 +46,7 @@ describe("clear_editor", () => {
});
BI.nextTick(function () {
editor.element.find(".search-close-h-font").click();
expect(editor.element.find(".bi-input").val()).toBe("");
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
@ -55,7 +55,7 @@ describe("clear_editor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
@ -66,7 +66,7 @@ describe("clear_editor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -74,7 +74,7 @@ describe("clear_editor", () => {
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
@ -85,14 +85,14 @@ describe("clear_editor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue1", () => {
it("getValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.clear_editor",
width: 300,
@ -103,7 +103,7 @@ describe("clear_editor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346 7890");
expect(editor.getValue()).to.equal("12346 7890");
editor.destroy();
});

18
packages/fineui/src/case/editor/__test__/editor.sign.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("sign_editor", () => {
describe("sign_editor", function () {
/**
* test_author_windy
*/
it("sign-editor", done => {
it("sign-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
@ -20,11 +20,11 @@ describe("sign_editor", () => {
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).toBe("AAAAA");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -33,7 +33,7 @@ describe("sign_editor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
@ -44,7 +44,7 @@ describe("sign_editor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -52,7 +52,7 @@ describe("sign_editor", () => {
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.sign_editor",
width: 300,
@ -63,7 +63,7 @@ describe("sign_editor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});

18
packages/fineui/src/case/editor/__test__/editor.state.simple.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("simple_state_editor", () => {
describe("simple_state_editor", function () {
/**
* test_author_windy
*/
it("state-editor", done => {
it("state-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
@ -20,11 +20,11 @@ describe("simple_state_editor", () => {
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).toBe("AAAAA");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -33,7 +33,7 @@ describe("simple_state_editor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
@ -44,7 +44,7 @@ describe("simple_state_editor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -52,7 +52,7 @@ describe("simple_state_editor", () => {
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.simple_state_editor",
width: 300,
@ -63,7 +63,7 @@ describe("simple_state_editor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});

18
packages/fineui/src/case/editor/__test__/editor.state.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/13
*/
describe("state_editor", () => {
describe("state_editor", function () {
/**
* test_author_windy
*/
it("state-editor", done => {
it("state-editor", function (done) {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
@ -20,11 +20,11 @@ describe("state_editor", () => {
}
});
editor.setWaterMark("AAAAA");
expect(editor.element.find(".bi-water-mark").text()).toBe("AAAAA");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("AAAAA");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -33,7 +33,7 @@ describe("state_editor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
@ -44,7 +44,7 @@ describe("state_editor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -52,7 +52,7 @@ describe("state_editor", () => {
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.state_editor",
width: 300,
@ -63,7 +63,7 @@ describe("state_editor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});

16
packages/fineui/src/case/loader/__test__/loader.lazy.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/4/3
*/
describe("lazy_loader", () => {
describe("lazy_loader", function () {
/**
* test_author_windy
**/
it("setValue", done => {
it("setValue", function (done) {
var items = BI.map(BI.range(0, 100), function (idx, v) {
return {
type: "bi.single_select_item",
@ -28,7 +28,7 @@ describe("lazy_loader", () => {
items: items
});
BI.nextTick(function () {
expect(widget.getAllButtons().length).toBe(100);
expect(widget.getAllButtons().length).to.equal(100);
widget.addItems([{
type: "bi.single_select_item",
text: 102,
@ -38,13 +38,13 @@ describe("lazy_loader", () => {
text: 103,
value: 103
}]);
expect(widget.getAllLeaves().length).toBe(102);
expect(widget.getAllLeaves().length).to.equal(102);
widget.setValue(102);
expect(widget.getValue()[0]).toBe(102);
expect(widget.getSelectedButtons().length).toBe(1);
expect(widget.getValue()[0]).to.equal(102);
expect(widget.getSelectedButtons().length).to.equal(1);
widget.setNotSelectedValue(102);
expect(widget.getNotSelectedValue()[0]).toBe(102);
expect(widget.getNotSelectedButtons().length).toBe(1);
expect(widget.getNotSelectedValue()[0]).to.equal(102);
expect(widget.getNotSelectedButtons().length).to.equal(1);
widget.destroy();
done();
});

16
packages/fineui/src/case/loader/__test__/loader.list.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/4/3
*/
describe("list_loader", () => {
describe("list_loader", function () {
/**
* test_author_windy
**/
it("setValue", done => {
it("setValue", function (done) {
var items = BI.map(BI.range(0, 100), function (idx, v) {
return {
type: "bi.single_select_item",
@ -28,7 +28,7 @@ describe("list_loader", () => {
items: items
});
BI.nextTick(function () {
expect(widget.getAllButtons().length).toBe(100);
expect(widget.getAllButtons().length).to.equal(100);
widget.addItems([{
type: "bi.single_select_item",
text: 102,
@ -38,13 +38,13 @@ describe("list_loader", () => {
text: 103,
value: 103
}]);
expect(widget.getAllLeaves().length).toBe(102);
expect(widget.getAllLeaves().length).to.equal(102);
widget.setValue(102);
expect(widget.getValue()[0]).toBe(102);
expect(widget.getSelectedButtons().length).toBe(1);
expect(widget.getValue()[0]).to.equal(102);
expect(widget.getSelectedButtons().length).to.equal(1);
widget.setNotSelectedValue(102);
expect(widget.getNotSelectedValue()[0]).toBe(102);
expect(widget.getNotSelectedButtons().length).toBe(1);
expect(widget.getNotSelectedValue()[0]).to.equal(102);
expect(widget.getNotSelectedButtons().length).to.equal(1);
widget.destroy();
done();
});

40
packages/fineui/src/case/pager/__test__/pager.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/3/17
*/
describe("PagerTest", () => {
describe("PagerTest", function () {
/**
* test_author_windy
*/
it("allCountPager", () => {
it("allCountPager", function () {
var a = BI.Test.createWidget({
type: "bi.all_count_pager",
pages: 3,
@ -17,17 +17,17 @@ describe("PagerTest", () => {
count: 1000
});
a.setCount(888);
expect(a.element.find(".row-count").text()).toBe("888");
expect(a.element.find(".row-count").text()).to.equal("888");
a.setAllPages(777);
a.setValue(4);
expect(a.element.find(".bi-input").val()).toBe("4");
expect(a.getCurrentPage()).toBe(4);
expect(a.hasPrev()).toBe(false);
expect(a.hasNext()).toBe(true);
expect(a.element.find(".bi-input").val()).to.equal("4");
expect(a.getCurrentPage()).to.equal(4);
expect(a.hasPrev()).to.equal(false);
expect(a.hasNext()).to.equal(true);
a.populate();
expect(a.element.find(".bi-input").val()).toBe("4");
expect(a.element.find(".bi-input").val()).to.equal("4");
a.setPagerVisible(false);
expect(a.element.find(".bi-pager").css("display")).toBe("none");
expect(a.element.find(".bi-pager").css("display")).to.equal("none");
a.destroy();
});
@ -35,7 +35,7 @@ describe("PagerTest", () => {
/**
* test_author_windy
*/
it("directionPager", () => {
it("directionPager", function () {
var a = BI.Test.createWidget({
type: "bi.direction_pager",
horizontal: {
@ -65,16 +65,16 @@ describe("PagerTest", () => {
});
a.populate();
a.setVPage(2);
expect(a.getVPage()).toBe(1);
expect(a.getVPage()).to.equal(1);
a.setHPage(2);
expect(a.getHPage()).toBe(1);
expect(a.hasVNext()).toBe(true);
expect(a.hasHNext()).toBe(true);
expect(a.hasVPrev()).toBe(false);
expect(a.hasHPrev()).toBe(false);
expect(a.getHPage()).to.equal(1);
expect(a.hasVNext()).to.equal(true);
expect(a.hasHNext()).to.equal(true);
expect(a.hasVPrev()).to.equal(false);
expect(a.hasHPrev()).to.equal(false);
a.setHPagerVisible(false)
a.setVPagerVisible(false)
expect(a.element.find(".bi-pager").css("display")).toBe("none");
expect(a.element.find(".bi-pager").css("display")).to.equal("none");
a.clear();
a.destroy();
});
@ -82,7 +82,7 @@ describe("PagerTest", () => {
/**
* test_author_windy
*/
it("detail_Pager", () => {
it("detail_Pager", function () {
var a = BI.Test.createWidget({
type: "bi.detail_pager",
pages: 100
@ -90,8 +90,8 @@ describe("PagerTest", () => {
a.setAllPages(200);
a.populate();
a.setValue(200);
expect(a.hasPrev(200)).toBe(true);
expect(a.hasNext(200)).toBe(false);
expect(a.hasPrev(200)).to.equal(true);
expect(a.hasNext(200)).to.equal(false);
a.destroy();
});
});

8
packages/fineui/src/case/segment/__test__/segment.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/3/17
*/
describe("SegmentTest", () => {
describe("SegmentTest", function () {
/**
* test_author_windy
*/
it("segment", () => {
it("segment", function () {
var a = BI.Test.createWidget({
type: "bi.segment",
items: [{
@ -23,11 +23,11 @@ describe("SegmentTest", () => {
}]
});
a.setValue(2);
expect(a.getValue()[0]).toBe(2);
expect(a.getValue()[0]).to.equal(2);
a.setEnable(false);
a.setEnabledValue(3);
a.setValue(3);
expect(a.getValue()[0]).toBe(3);
expect(a.getValue()[0]).to.equal(3);
a.destroy();
});
});

10
packages/fineui/src/component/allvaluechooser/__test__/combo.allvaluechooser.test.js

@ -4,7 +4,7 @@
* Created by windy on 2020/3/4
*/
describe("all_value_chooser_combo", () => {
describe("all_value_chooser_combo", function () {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -29,7 +29,7 @@ describe("all_value_chooser_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.all_value_chooser_combo",
width: 220,
@ -38,14 +38,14 @@ describe("all_value_chooser_combo", () => {
}
});
widget.setValue([1, 2]);
expect(widget.getValue()).toEqual([1, 2]);
expect(widget.getValue()).to.deep.equal([1, 2]);
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.all_value_chooser_combo",
width: 220,
@ -60,7 +60,7 @@ describe("all_value_chooser_combo", () => {
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual([0, 1, 2]);
expect(widget.getValue()).to.deep.equal([0, 1, 2]);
done();
}, 300);
});

6
packages/fineui/src/component/allvaluemultitextvaluecombo/__test__/allvalue.multitextvalue.combo.test.js

@ -4,7 +4,7 @@
* Created by windy on 2020/3/4
*/
describe("all_value_multi_text_value_combo", () => {
describe("all_value_multi_text_value_combo", function () {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -17,14 +17,14 @@ describe("all_value_multi_text_value_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.all_value_multi_text_value_combo",
width: 220,
items: items
});
widget.setValue([1, 2]);
expect(widget.getValue()).toEqual([1, 2]);
expect(widget.getValue()).to.deep.equal([1, 2]);
widget.destroy();
});
});

30
packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.insert.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2019/9/23
*/
describe("value_chooser_insert_combo", () => {
describe("value_chooser_insert_combo", function () {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -28,7 +28,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -40,7 +40,7 @@ describe("value_chooser_insert_combo", () => {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [1, 2]
});
@ -50,7 +50,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("getValue", () => {
it("getValue", function () {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -62,7 +62,7 @@ describe("value_chooser_insert_combo", () => {
value: [1, 2, 3]
}
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 2,
value: [1, 2, 3]
});
@ -72,7 +72,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -94,7 +94,7 @@ describe("value_chooser_insert_combo", () => {
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 2,
value: [0, 1, 2]
});
@ -107,7 +107,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -124,7 +124,7 @@ describe("value_chooser_insert_combo", () => {
BI.each(searchItemSelectorGetter([1,2]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [2, 12]
});
@ -139,7 +139,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("新增值", done => {
it("新增值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -154,7 +154,7 @@ describe("value_chooser_insert_combo", () => {
BI.Test.triggerKeyDown(widget.element.find(".bi-multi-select-trigger .bi-input"), "z", 50, function () {
BI.nextTick(function () {
widget.element.find(".bi-text-button:contains(+点击新增\"z\")").click();
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: ["z"]
});
@ -169,7 +169,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("查看已选", done => {
it("查看已选", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -184,7 +184,7 @@ describe("value_chooser_insert_combo", () => {
BI.nextTick(function () {
widget.element.find(".bi-multi-select-check-selected-button").click();
BI.delay(function () {
expect(widget.element.find(".display-list-item").length).toBe(2);
expect(widget.element.find(".display-list-item").length).to.equal(2);
widget.destroy();
done();
}, 300);
@ -194,7 +194,7 @@ describe("value_chooser_insert_combo", () => {
/**
* test_author_windy
**/
it("BI-64399", done => {
it("BI-64399", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_insert_combo",
width: 220,
@ -227,7 +227,7 @@ describe("value_chooser_insert_combo", () => {
BI.nextTick(function () {
BI.Test.triggerKeyDown(widget.element.find(".bi-multi-select-trigger .bi-input"), "A", 65, function () {
BI.nextTick(function () {
expect(widget.element.find(".bi-multi-select-search-pane .multi-select-toolbar").css("display")).toBe("block");
expect(widget.element.find(".bi-multi-select-search-pane .multi-select-toolbar").css("display")).to.equal("block");
widget.destroy();
done();
});

22
packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2019/9/23
*/
describe("value_chooser_combo", () => {
describe("value_chooser_combo", function () {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -28,7 +28,7 @@ describe("value_chooser_combo", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_combo",
width: 220,
@ -40,7 +40,7 @@ describe("value_chooser_combo", () => {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [1, 2]
});
@ -50,7 +50,7 @@ describe("value_chooser_combo", () => {
/**
* test_author_windy
**/
it("getValue", () => {
it("getValue", function () {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_combo",
width: 220,
@ -62,7 +62,7 @@ describe("value_chooser_combo", () => {
value: [1, 2, 3]
}
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 2,
value: [1, 2, 3]
});
@ -72,7 +72,7 @@ describe("value_chooser_combo", () => {
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_combo",
width: 220,
@ -94,7 +94,7 @@ describe("value_chooser_combo", () => {
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 2,
value: [0, 1, 2]
});
@ -107,7 +107,7 @@ describe("value_chooser_combo", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_combo",
width: 220,
@ -124,7 +124,7 @@ describe("value_chooser_combo", () => {
BI.each(searchItemSelectorGetter([1,2]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [2, 12]
});
@ -139,7 +139,7 @@ describe("value_chooser_combo", () => {
/**
* test_author_windy
**/
it("查看已选", done => {
it("查看已选", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_combo",
width: 220,
@ -154,7 +154,7 @@ describe("value_chooser_combo", () => {
BI.nextTick(function () {
widget.element.find(".bi-multi-select-check-selected-button").click();
BI.delay(function () {
expect(widget.element.find(".display-list-item").length).toBe(2);
expect(widget.element.find(".display-list-item").length).to.equal(2);
widget.destroy();
done();
}, 300);

14
packages/fineui/src/component/valuechooser/__test__/pane.valuechooser.test.js

@ -4,7 +4,7 @@
* Created by windy on 2019/9/23
*/
describe("value_chooser_pane", () => {
describe("value_chooser_pane", function () {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -29,7 +29,7 @@ describe("value_chooser_pane", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_pane",
width: 220,
@ -41,7 +41,7 @@ describe("value_chooser_pane", () => {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [1, 2]
});
@ -51,7 +51,7 @@ describe("value_chooser_pane", () => {
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_pane",
width: 220,
@ -69,7 +69,7 @@ describe("value_chooser_pane", () => {
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 2,
value: [0, 1, 2]
});
@ -82,7 +82,7 @@ describe("value_chooser_pane", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.value_chooser_pane",
width: 220,
@ -98,7 +98,7 @@ describe("value_chooser_pane", () => {
BI.each(searchItemSelectorGetter([1,2]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [2, 12]
});

8
packages/fineui/src/core/1.lodash.js

@ -14,7 +14,7 @@
var undefined;
/** Used as the semantic version number. */
var VERSION = '4.17.5';
var VERSION = '4.17.21';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@ -899,7 +899,7 @@
}
/**
* Gets the value at `key`, unless `key` is "__proto__".
* Gets the value at `key`, unless `key` is "__proto__" or "constructor".
*
* @private
* @param {Object} object The object to query.
@ -907,6 +907,10 @@
* @returns {*} Returns the property value.
*/
function safeGet(object, key) {
if (key === 'constructor' && typeof object[key] === 'function') {
return;
}
return key == '__proto__'
? undefined
: object[key];

2
packages/fineui/src/core/5.inject.js

@ -427,7 +427,7 @@ const providers = {},
export const Providers = {
getProvider: (type, config) => {
if (!providerInjection[type]) {
_global.console && console.error(`provider: [${type}] undefined`);
_global.console && console.warn(`provider: [${type}] undefined`);
}
runConfigFunction(type);
if (!providers[type]) {

110
packages/fineui/src/core/__test__/alias.test.js

@ -1,9 +1,9 @@
/**
* Created by windy on 2018/01/23.
*/
describe("aliasFunctionTest", () => {
describe("aliasFunctionTest", function () {
beforeAll(() => {
before(function () {
BI.specialCharsMap = {
"\\\\": "0",
".": "1",
@ -14,39 +14,39 @@ describe("aliasFunctionTest", () => {
/**
* test_author_windy
*/
it("htmlEncode和htmlDecode", () => {
it("htmlEncode和htmlDecode", function () {
var targetString = "<a>1 2&</a>";
var encodeString = BI.htmlEncode(targetString);
expect(encodeString).toBe("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).toBe(targetString);
expect(encodeString).to.equal("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).to.equal(targetString);
});
/**
* test_author_windy
*/
it("encodeURIComponent和decodeURIComponent", () => {
it("encodeURIComponent和decodeURIComponent", function () {
var targetString = "tableName./\\";
var encodeString = BI.encodeURIComponent(targetString);
expect(encodeString).toBe("tableName120");
expect(BI.decodeURIComponent(encodeString)).toBe(targetString);
expect(encodeString).to.equal("tableName120");
expect(BI.decodeURIComponent(encodeString)).to.equal(targetString);
});
/**
* test_author_kobi
**/
it("cjkEncode 和 cjkDecode ", () => {
expect(BI.cjkEncode("测试")).toEqual("[6d4b][8bd5]");
expect(BI.cjkEncode(123)).toEqual(123);
expect(BI.cjkDecode("[6d4b][8bd5]")).toEqual("测试");
expect(BI.cjkDecode("6d4b 8bd5")).toEqual("6d4b 8bd5");
expect(BI.cjkDecode(null)).toEqual("");
it("cjkEncode 和 cjkDecode ", function () {
expect(BI.cjkEncode("测试")).to.eql("[6d4b][8bd5]");
expect(BI.cjkEncode(123)).to.eql(123);
expect(BI.cjkDecode("[6d4b][8bd5]")).to.eql("测试");
expect(BI.cjkDecode("6d4b 8bd5")).to.eql("6d4b 8bd5");
expect(BI.cjkDecode(null)).to.eql("");
});
/**
* test_author_kobi
**/
it("jsonEncode 和 jsonDecode", () => {
it("jsonEncode 和 jsonDecode", function () {
var jsonString = '{"a":1,"b":"测\\"试","c":[5,6],"d":null,"e":false}';
var obj = {
a: 1,
@ -55,81 +55,81 @@ describe("aliasFunctionTest", () => {
d: null,
e: false,
};
expect(BI.jsonEncode(obj)).toEqual(jsonString);
expect(BI.jsonDecode(jsonString)).toEqual(obj);
expect(BI.jsonEncode(obj)).to.eql(jsonString);
expect(BI.jsonDecode(jsonString)).to.eql(obj);
expect(BI.jsonEncode({ a: function(){return 1} })).toEqual('{"a":function(){return 1}}');
expect(BI.jsonDecode("{__time__:878313600000}")).toEqual(new Date(878313600000));
expect(BI.jsonEncode({ a: function(){return 1} })).to.eql('{"a":function(){return 1}}');
expect(BI.jsonDecode("{__time__:878313600000}")).to.eql(new Date(878313600000));
});
/**
* test_author_kobi
**/
it("getEncodeURL", () => {
expect(BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"})).toEqual("design/A/a");
it("getEncodeURL", function () {
expect(BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"})).to.eql("design/A/a");
});
/**
* test_author_kobi
**/
it("contentFormat", () => {
expect(BI.contentFormat("", "DTyyyy-MM-dd")).toEqual("");
expect(BI.contentFormat(878313600000, "")).toEqual("878313600000");
expect(BI.contentFormat("test", "T")).toEqual("test");
expect(BI.contentFormat(878313600000, "E")).toEqual("9E11");
expect(BI.contentFormat(1000.23456789, "0,000.####")).toEqual("1,000.2346");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).toEqual("1997-11-09");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd HH:mm:ss a")).toEqual("1997-11-09 13:00:00 pm");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd hh:mm:ss a")).toEqual("1997-11-09 01:00:00 pm");
expect(BI.contentFormat(879051600000, "DTyyy-M-d H:m:s a")).toEqual("97-11-9 13:0:0 pm");
expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a")).toEqual("97-11-9 12:0:0 pm");
it("contentFormat", function () {
expect(BI.contentFormat("", "DTyyyy-MM-dd")).to.eql("");
expect(BI.contentFormat(878313600000, "")).to.eql("878313600000");
expect(BI.contentFormat("test", "T")).to.eql("test");
expect(BI.contentFormat(878313600000, "E")).to.eql("9E11");
expect(BI.contentFormat(1000.23456789, "0,000.####")).to.eql("1,000.2346");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).to.eql("1997-11-09");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd HH:mm:ss a")).to.eql("1997-11-09 13:00:00 pm");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd hh:mm:ss a")).to.eql("1997-11-09 01:00:00 pm");
expect(BI.contentFormat(879051600000, "DTyyy-M-d H:m:s a")).to.eql("97-11-9 13:0:0 pm");
expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a")).to.eql("97-11-9 12:0:0 pm");
});
/**
* test_author_kobi
**/
it("parseFmt", () => {
expect(BI.parseFmt("yyyy-MM-dd HH:mm:ss")).toEqual("%Y-%X-%d %H:%M:%S");
expect(BI.parseFmt("yyyy-MM-d hh:mm:ss")).toEqual("%Y-%X-%e %I:%M:%S");
expect(BI.parseFmt("")).toEqual("");
it("parseFmt", function () {
expect(BI.parseFmt("yyyy-MM-dd HH:mm:ss")).to.eql("%Y-%X-%d %H:%M:%S");
expect(BI.parseFmt("yyyy-MM-d hh:mm:ss")).to.eql("%Y-%X-%e %I:%M:%S");
expect(BI.parseFmt("")).to.eql("");
});
/**
* test_author_kobi
**/
it("str2Date", () => {
expect(BI.str2Date('2013-12-12', 'yyyy-MM-dd')).toEqual(new Date(2013, 11, 12));
expect(BI.str2Date('2013-12-12', 123)).toBeNull();
it("str2Date", function () {
expect(BI.str2Date('2013-12-12', 'yyyy-MM-dd')).to.eql(new Date(2013, 11, 12));
expect(BI.str2Date('2013-12-12', 123)).to.eql(null);
});
/**
* test_author_kobi
**/
it("object2Number", () => {
expect(BI.object2Number(null)).toEqual(0);
expect(BI.object2Number(123)).toEqual(123);
expect(BI.object2Number("1.23")).toEqual(1.23);
expect(BI.object2Number({ a: 2 })).toEqual(NaN);
it("object2Number", function () {
expect(BI.object2Number(null)).to.eql(0);
expect(BI.object2Number(123)).to.eql(123);
expect(BI.object2Number("1.23")).to.eql(1.23);
expect(BI.object2Number({ a: 2 })).to.eql(NaN);
});
/**
* test_author_kobi
**/
it("object2Date", () => {
expect(BI.object2Date(null)).toEqual(new Date());
expect(BI.object2Date(new Date(1997, 10, 9))).toEqual(new Date(1997, 10, 9));
expect(BI.object2Date(879051600000)).toEqual(new Date(879051600000));
expect(BI.object2Time("1997-11-09")).toEqual(new Date(1997, 10, 9));
expect(BI.object2Date({ a: 2 })).toEqual(new Date());
it("object2Date", function () {
expect(BI.object2Date(null)).to.eql(new Date());
expect(BI.object2Date(new Date(1997, 10, 9))).to.eql(new Date(1997, 10, 9));
expect(BI.object2Date(879051600000)).to.eql(new Date(879051600000));
expect(BI.object2Time("1997-11-09")).to.eql(new Date(1997, 10, 9));
expect(BI.object2Date({ a: 2 })).to.eql(new Date());
});
/**
* test_author_kobi
**/
it("object2Time", () => {
expect(BI.object2Time(null)).toEqual(new Date());
expect(BI.object2Time(new Date(1997, 11, 9))).toEqual(new Date(1997, 11, 9));
expect(BI.object2Time("1997-11-09 13:00:00")).toEqual(new Date(1997, 10, 9, 13, 0, 0));
expect(BI.object2Time("13:00:00")).toEqual(new Date(1970, 0, 1, 13, 0, 0));
it("object2Time", function () {
expect(BI.object2Time(null)).to.eql(new Date());
expect(BI.object2Time(new Date(1997, 11, 9))).to.eql(new Date(1997, 11, 9));
expect(BI.object2Time("1997-11-09 13:00:00")).to.eql(new Date(1997, 10, 9, 13, 0, 0));
expect(BI.object2Time("13:00:00")).to.eql(new Date(1970, 0, 1, 13, 0, 0));
});
});

280
packages/fineui/src/core/__test__/base.test.js

@ -1,16 +1,16 @@
/**
* Created by windy on 2018/01/24.
*/
describe("baseFunctionTest", () => {
describe("baseFunctionTest", function () {
beforeAll(() => {
before(function () {
});
/**
* test_author_windy
*/
it("formatEl和stripEL", () => {
it("formatEl和stripEL", function () {
var obj1 = {
type: "a",
pro: {},
@ -24,53 +24,53 @@ describe("baseFunctionTest", () => {
items: []
}
};
expect(BI.formatEL(obj1)).toEqual(obj2);
expect(BI.formatEL(obj2)).toEqual(obj2);
expect(BI.stripEL(obj1)).toEqual(obj1);
expect(BI.stripEL(obj2)).toEqual(obj1);
expect(BI.formatEL(obj1)).to.deep.equal(obj2);
expect(BI.formatEL(obj2)).to.deep.equal(obj2);
expect(BI.stripEL(obj1)).to.deep.equal(obj1);
expect(BI.stripEL(obj2)).to.deep.equal(obj1);
});
/**
* test_author_windy
*/
it("encodeURIComponent和decodeURIComponent", () => {
it("encodeURIComponent和decodeURIComponent", function () {
var targetString = "tableName./\\";
var encodeString = BI.encodeURIComponent(targetString);
expect(encodeString).toBe("tableName120");
expect(BI.decodeURIComponent(encodeString)).toBe(targetString);
expect(encodeString).to.equal("tableName120");
expect(BI.decodeURIComponent(encodeString)).to.equal(targetString);
});
/**
* test_author_windy
*/
it("count", () => {
it("count", function () {
var a = [];
expect(BI.count(1, 100)).toBe(99);
expect(BI.count(1, 100)).to.equal(99);
BI.count(0, 100, function (v) {
a[v] = 0;
});
expect(a.length).toBe(100);
expect(a.length).to.equal(100);
});
/**
* test_author_windy
*/
it("concat", () => {
expect(BI.concat([1], [2])).toEqual([1, 2]);
expect(BI.concat(1, 2)).toBe("12");
expect(BI.concat("1", "2")).toBe("12");
expect(BI.concat({a: 1}, {b: 1})).toEqual({a: 1, b: 1});
it("concat", function () {
expect(BI.concat([1], [2])).to.deep.equal([1, 2]);
expect(BI.concat(1, 2)).to.equal("12");
expect(BI.concat("1", "2")).to.equal("12");
expect(BI.concat({a: 1}, {b: 1})).to.deep.equal({a: 1, b: 1});
});
/**
* test_author_windy
*/
it("remove", () => {
it("remove", function () {
var a = [1, 2, 3, 4, 5, 6];
BI.remove(a, function (i, v) {
return v === 4;
});
expect(a).toEqual([1, 2, 3, 5, 6]);
expect(a).to.deep.equal([1, 2, 3, 5, 6]);
var b = {
a: 1,
b: 2
@ -78,7 +78,7 @@ describe("baseFunctionTest", () => {
BI.remove(b, function (key) {
return key === "a";
});
expect(b).toEqual({
expect(b).to.deep.equal({
b: 2
});
});
@ -86,16 +86,16 @@ describe("baseFunctionTest", () => {
/**
* test_author_windy
*/
it("removeAt", () => {
it("removeAt", function () {
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9];
BI.removeAt(a, 2);
expect(a).toEqual([1, 2, 4, 5, 6, 7, 8, 9]);
expect(a).to.deep.equal([1, 2, 4, 5, 6, 7, 8, 9]);
var b = {
a: 1,
b: 2
};
BI.removeAt(b, "a");
expect(b).toEqual({
expect(b).to.deep.equal({
b: 2
});
});
@ -103,27 +103,27 @@ describe("baseFunctionTest", () => {
/**
* test_author_windy
*/
it("makeArray", () => {
it("makeArray", function () {
var a = BI.makeArray(2, 1);
expect(a).toEqual([1, 1]);
expect(a).to.deep.equal([1, 1]);
});
/**
* test_author_windy
*/
it("concat-string", () => {
it("concat-string", function () {
// concat-string
expect(BI.concat("a", "b", "c")).toBe("abc");
expect(BI.concat("a", "b", "c")).to.equal("abc");
// concat-array
expect(BI.concat([1], [2], [3])).toEqual([1, 2, 3]);
expect(BI.concat([1], [2], [3])).to.deep.equal([1, 2, 3]);
// concat-object-array
expect(BI.concat([{text: 1, value: 1}], [{text: 2, value: 2}], [{text: 3, value: 3}])).toEqual([{text: 1, value: 1}, {text: 2, value: 2}, {text: 3, value: 3}]);
expect(BI.concat([{text: 1, value: 1}], [{text: 2, value: 2}], [{text: 3, value: 3}])).to.deep.equal([{text: 1, value: 1}, {text: 2, value: 2}, {text: 3, value: 3}]);
// concat-object
expect(BI.concat({a: 1}, {b: 2}, {c: 3})).toEqual({
expect(BI.concat({a: 1}, {b: 2}, {c: 3})).to.deep.equal({
a: 1,
b: 2,
c: 3
@ -133,11 +133,11 @@ describe("baseFunctionTest", () => {
/**
* test_author_windy
*/
it("assert-warning", () => {
expect(BI.assert("a", "a")).toBe(true);
it("assert-warning", function () {
expect(BI.assert("a", "a")).to.equal(true);
expect(BI.assert("a", function (v) {
return v === "a";
})).toBe(true);
})).to.equal(true);
var test = "";
try {
BI.assert("a", function (v) {
@ -146,13 +146,13 @@ describe("baseFunctionTest", () => {
} catch (e) {
test = true;
}
expect(test).toBe(true);
expect(test).to.equal(true);
});
/**
* test_author_windy
*/
it("packageItems", () => {
it("packageItems", function () {
expect(BI.packageItems([{
type: "a",
text: "b"
@ -163,7 +163,7 @@ describe("baseFunctionTest", () => {
type: "bi.vertical"
}, {
type: "bi.center_adapt"
}])).toEqual([{
}])).to.deep.equal([{
type: "bi.vertical",
items: [{
el: {
@ -195,29 +195,29 @@ describe("baseFunctionTest", () => {
/**
* test_author_windy
*/
it("inverse", () => {
expect(BI.inverse(7, 1)).toBe(6);
it("inverse", function () {
expect(BI.inverse(7, 1)).to.equal(6);
});
/**
* test_author_windy
*/
it("key", () => {
it("key", function () {
var a = {
c: 1,
d: 2
};
expect(BI.firstKey(a)).toBe("c");
expect(BI.lastKey(a)).toBe("d");
expect(BI.firstObject(a)).toBe(1);
expect(BI.lastObject(a)).toBe(2);
expect(BI.firstKey(a)).to.equal("c");
expect(BI.lastKey(a)).to.equal("d");
expect(BI.firstObject(a)).to.equal(1);
expect(BI.lastObject(a)).to.equal(2);
});
/**
* test_author_windy
*/
it("back", () => {
it("back", function () {
var a = [{
c: 1,
d: 2
@ -232,147 +232,147 @@ describe("baseFunctionTest", () => {
BI.backEach(a, function (idx, v) {
c.push(v.d);
});
expect(c).toEqual([6, 4, 2]);
expect(c).to.deep.equal([6, 4, 2]);
expect(BI.backEvery(a, function (idx, v) {
return v.c = 1;
})).toBe(true);
})).to.equal(true);
expect(BI.backFindKey({
c: 5,
d: 6
}, function (value, key) {
return key === "c";
})).toBe("c");
})).to.equal("c");
expect(BI.backFind({
c: 5,
d: 6
}, function (v, key) {
return v === 5;
})).toEqual(5);
})).to.deep.equal(5);
});
/**
* test_author_windy
*/
it("others", () => {
expect(BI.abc2Int("B")).toBe(2);
expect(BI.int2Abc(2)).toBe("B");
expect(BI.has({a: "1", b: "2"}, "a")).toBe(true);
expect(Object.isFrozen(BI.freeze({a: "1", b: "2"}))).toBe(true);
expect(BI.isCapitalEqual("A", "a")).toBe(true);
expect(BI.isEmptyString("a")).toBe(false);
expect(BI.isNotEmptyString("a")).toBe(true);
expect(BI.isWindow("a")).toBe(false);
it("others", function () {
expect(BI.abc2Int("B")).to.equal(2);
expect(BI.int2Abc(2)).to.equal("B");
expect(BI.has({a: "1", b: "2"}, "a")).to.equal(true);
expect(Object.isFrozen(BI.freeze({a: "1", b: "2"}))).to.equal(true);
expect(BI.isCapitalEqual("A", "a")).to.equal(true);
expect(BI.isEmptyString("a")).to.equal(false);
expect(BI.isNotEmptyString("a")).to.equal(true);
expect(BI.isWindow("a")).to.equal(false);
});
/**
* test_author_windy
*/
it("deepFunc", () => {
expect(BI.isDeepMatch({b: {c: {e: 3}}, d:2}, {b: {c: {e: 3}}, d:2})).toBe(true);
expect(BI.deepIndexOf([{a: 1}, {b: 2}, {c: 3}], {c: 3})).toBe(2);
it("deepFunc", function () {
expect(BI.isDeepMatch({b: {c: {e: 3}}, d:2}, {b: {c: {e: 3}}, d:2})).to.equal(true);
expect(BI.deepIndexOf([{a: 1}, {b: 2}, {c: 3}], {c: 3})).to.equal(2);
var remove = [{a: 1}, {b: 2}, {c: 3}];
BI.deepRemove(remove, {c: 3});
expect(remove).toEqual([{a: 1}, {b: 2}]);
expect(BI.deepWithout([{a: 1}, {b: 2}, {c: 3}], {c: 3})).toEqual([{a: 1}, {b: 2}]);
expect(BI.deepUnique([{c: 3}, {a: 1}, {b: 2}, {c: 3}, {c: 3}])).toEqual([{c: 3}, {a: 1}, {b: 2}]);
expect(BI.deepDiff({a: 1, b: 2}, {a: 1, c: 2})).toEqual(["b", "c"]);
expect(remove).to.deep.equal([{a: 1}, {b: 2}]);
expect(BI.deepWithout([{a: 1}, {b: 2}, {c: 3}], {c: 3})).to.deep.equal([{a: 1}, {b: 2}]);
expect(BI.deepUnique([{c: 3}, {a: 1}, {b: 2}, {c: 3}, {c: 3}])).to.deep.equal([{c: 3}, {a: 1}, {b: 2}]);
expect(BI.deepDiff({a: 1, b: 2}, {a: 1, c: 2})).to.deep.equal(["b", "c"]);
});
/**
* test_author_windy
*/
it("number", () => {
expect(BI.parseSafeInt(9007199254740992)).toBe(9007199254740991);
expect(BI.isNegativeInteger(-3)).toBe(true);
expect(BI.isFloat(1.2)).toBe(true);
expect(BI.isOdd(1)).toBe(true);
expect(BI.isOdd("a")).toBe(false);
expect(BI.isEven("a")).toBe(false);
expect(BI.isEven(2)).toBe(true);
expect(BI.sum([1, 2, 3, 4, 5, 6, 7])).toBe(28);
expect(BI.average([1, 2, 3, 4, 5, 6, 7])).toBe(4);
it("number", function () {
expect(BI.parseSafeInt(9007199254740992)).to.equal(9007199254740991);
expect(BI.isNegativeInteger(-3)).to.equal(true);
expect(BI.isFloat(1.2)).to.equal(true);
expect(BI.isOdd(1)).to.equal(true);
expect(BI.isOdd("a")).to.equal(false);
expect(BI.isEven("a")).to.equal(false);
expect(BI.isEven(2)).to.equal(true);
expect(BI.sum([1, 2, 3, 4, 5, 6, 7])).to.equal(28);
expect(BI.average([1, 2, 3, 4, 5, 6, 7])).to.equal(4);
});
/**
* test_author_windy
*/
it("string", () => {
expect(BI.toLowerCase("AAAAA")).toBe("aaaaa");
expect(BI.isLiteral("AAAAA")).toBe(false);
expect(BI.stripQuotes("AAAAA")).toBe("AAAAA");
expect(BI.camelize("background-color")).toBe("backgroundColor");
expect(BI.escape("'\\")).toBe("\\'\\\\");
expect(BI.leftPad("123", 5, "0")).toBe("00123");
it("string", function () {
expect(BI.toLowerCase("AAAAA")).to.equal("aaaaa");
expect(BI.isLiteral("AAAAA")).to.equal(false);
expect(BI.stripQuotes("AAAAA")).to.equal("AAAAA");
expect(BI.camelize("background-color")).to.equal("backgroundColor");
expect(BI.escape("'\\")).to.equal("\\'\\\\");
expect(BI.leftPad("123", 5, "0")).to.equal("00123");
const cls = "my-class", text = "Some text";
expect(BI.format("<div class=\"{0}\">{1}</div>", cls, text)).toBe("<div class=\"my-class\">Some text</div>");
expect(BI.format("<div class=\"{0}\">{1}</div>", cls, text)).to.equal("<div class=\"my-class\">Some text</div>");
});
/**
* test_author_kobi
**/
it("checkDateVoid", () => {
it("checkDateVoid", function () {
const minDate = "1900-02-02";
const maxDate = "2099-11-29";
expect(BI.checkDateVoid(1899, 2, 2, minDate, maxDate)).toEqual(["y"]);
expect(BI.checkDateVoid(2100, 2, 2, minDate, maxDate)).toEqual(["y", 1]);
expect(BI.checkDateVoid(1900, 1, 2, minDate, maxDate)).toEqual(["m"]);
expect(BI.checkDateVoid(2099, 12, 2, minDate, maxDate)).toEqual(["m", 1]);
expect(BI.checkDateVoid(1900, 2, 1, minDate, maxDate)).toEqual(["d"]);
expect(BI.checkDateVoid(2099, 11, 30, minDate, maxDate)).toEqual(["d", 1]);
expect(BI.checkDateVoid(1899, 2, 2, minDate, maxDate)).to.eql(["y"]);
expect(BI.checkDateVoid(2100, 2, 2, minDate, maxDate)).to.eql(["y", 1]);
expect(BI.checkDateVoid(1900, 1, 2, minDate, maxDate)).to.eql(["m"]);
expect(BI.checkDateVoid(2099, 12, 2, minDate, maxDate)).to.eql(["m", 1]);
expect(BI.checkDateVoid(1900, 2, 1, minDate, maxDate)).to.eql(["d"]);
expect(BI.checkDateVoid(2099, 11, 30, minDate, maxDate)).to.eql(["d", 1]);
});
/**
* test_author_kobi
**/
it("parseDateTime", () => {
expect(BI.parseDateTime("19971109", "%y%x%d")).toEqual(BI.getDate(1997, 10, 9));
expect(BI.parseDateTime("12:34:56", "%H:%M:%S")).toEqual(BI.getDate(1935, 0, 25, 12, 34, 56));
expect(BI.parseDateTime("1997-11-09 3:23:23 pm", "%y-%x-%d %H:%M:%S %P")).toEqual(BI.getDate(1997, 10, 9, 15, 23, 23));
expect(BI.parseDateTime("1997-11-09 15:23:23 am", "%y-%x-%d %H:%M:%S %P")).toEqual(BI.getDate(1997, 10, 9, 3, 23, 23));
expect(BI.parseDateTime("a-b-c d:e:f", "%y-%x-%d %H:%M:%S").toString()).toEqual(BI.getDate().toString());
it("parseDateTime", function () {
expect(BI.parseDateTime("19971109", "%y%x%d")).to.eql(BI.getDate(1997, 10, 9));
expect(BI.parseDateTime("12:34:56", "%H:%M:%S")).to.eql(BI.getDate(1935, 0, 25, 12, 34, 56));
expect(BI.parseDateTime("1997-11-09 3:23:23 pm", "%y-%x-%d %H:%M:%S %P")).to.eql(BI.getDate(1997, 10, 9, 15, 23, 23));
expect(BI.parseDateTime("1997-11-09 15:23:23 am", "%y-%x-%d %H:%M:%S %P")).to.eql(BI.getDate(1997, 10, 9, 3, 23, 23));
expect(BI.parseDateTime("a-b-c d:e:f", "%y-%x-%d %H:%M:%S").toString()).to.eql(BI.getDate().toString());
});
/**
* test_author_kobi
**/
it("getDate 和 getTime", () => {
expect(BI.getDate().toString()).toEqual(new Date().toString());
expect(BI.getDate(1997)).toEqual(new Date(1997));
expect(BI.getDate(1997, 10)).toEqual(new Date(1997, 10));
expect(BI.getDate(1997, 10, 9)).toEqual(new Date(1997, 10, 9));
expect(BI.getDate(1997, 10, 9, 12)).toEqual(new Date(1997, 10, 9, 12));
expect(BI.getDate(1997, 10, 9, 12, 34)).toEqual(new Date(1997, 10, 9, 12, 34));
expect(BI.getDate(1997, 10, 9, 12, 34, 56)).toEqual(new Date(1997, 10, 9, 12, 34, 56));
expect(BI.getDate(1997, 10, 9, 12, 34, 56, 78)).toEqual(new Date(1997, 10, 9, 12, 34, 56, 78));
expect(BI.getTime()).toEqual(new Date().getTime());
expect(BI.getTime(1997)).toEqual(new Date(1997).getTime());
expect(BI.getTime(1997, 10)).toEqual(new Date(1997, 10).getTime());
expect(BI.getTime(1997, 10, 9)).toEqual(new Date(1997, 10, 9).getTime());
expect(BI.getTime(1997, 10, 9, 12)).toEqual(new Date(1997, 10, 9, 12).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34)).toEqual(new Date(1997, 10, 9, 12, 34).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34, 56)).toEqual(new Date(1997, 10, 9, 12, 34, 56).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34, 56, 78)).toEqual(new Date(1997, 10, 9, 12, 34, 56, 78).getTime());
it("getDate 和 getTime", function () {
expect(BI.getDate().toString()).to.eql(new Date().toString());
expect(BI.getDate(1997)).to.eql(new Date(1997));
expect(BI.getDate(1997, 10)).to.eql(new Date(1997, 10));
expect(BI.getDate(1997, 10, 9)).to.eql(new Date(1997, 10, 9));
expect(BI.getDate(1997, 10, 9, 12)).to.eql(new Date(1997, 10, 9, 12));
expect(BI.getDate(1997, 10, 9, 12, 34)).to.eql(new Date(1997, 10, 9, 12, 34));
expect(BI.getDate(1997, 10, 9, 12, 34, 56)).to.eql(new Date(1997, 10, 9, 12, 34, 56));
expect(BI.getDate(1997, 10, 9, 12, 34, 56, 78)).to.eql(new Date(1997, 10, 9, 12, 34, 56, 78));
expect(BI.getTime()).to.eql(new Date().getTime());
expect(BI.getTime(1997)).to.eql(new Date(1997).getTime());
expect(BI.getTime(1997, 10)).to.eql(new Date(1997, 10).getTime());
expect(BI.getTime(1997, 10, 9)).to.eql(new Date(1997, 10, 9).getTime());
expect(BI.getTime(1997, 10, 9, 12)).to.eql(new Date(1997, 10, 9, 12).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34)).to.eql(new Date(1997, 10, 9, 12, 34).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34, 56)).to.eql(new Date(1997, 10, 9, 12, 34, 56).getTime());
expect(BI.getTime(1997, 10, 9, 12, 34, 56, 78)).to.eql(new Date(1997, 10, 9, 12, 34, 56, 78).getTime());
});
/**
* test_author_kobi
**/
it("数字相关方法补充", () => {
it("数字相关方法补充", function () {
const iteratee = function (a, b) {
return a > b ? a : b;
};
expect(BI.isNaturalNumber(1.25)).toEqual(false);
expect(BI.isPositiveInteger(-15)).toEqual(false);
expect(BI.isNegativeInteger(+15)).toEqual(false);
expect(BI.isFloat(15)).toEqual(false);
expect(BI.sum([4, 3, 2, 1], iteratee)).toEqual(12);
expect(BI.isNaturalNumber(1.25)).to.eql(false);
expect(BI.isPositiveInteger(-15)).to.eql(false);
expect(BI.isNegativeInteger(+15)).to.eql(false);
expect(BI.isFloat(15)).to.eql(false);
expect(BI.sum([4, 3, 2, 1], iteratee)).to.eql(12);
});
/**
* test_author_kobi
**/
it("集合相关方法补充", () => {
it("集合相关方法补充", function () {
const array = [{
user: "barney",
active: true,
@ -383,39 +383,39 @@ describe("baseFunctionTest", () => {
user: "pebbles",
active: false,
}];
expect(BI.backEvery(array, (index, value) => value.user === "kobi")).toEqual(false);
expect(BI.backFind(array, ["active", false])).toEqual(array[2]);
expect(BI.abc2Int("ABCD999")).toEqual(0);
expect(BI.int2Abc(0)).toEqual("");
expect(BI.int2Abc(26)).toEqual("Z");
expect(BI.backEvery(array, (index, value) => value.user === "kobi")).to.eql(false);
expect(BI.backFind(array, ["active", false])).to.eql(array[2]);
expect(BI.abc2Int("ABCD999")).to.eql(0);
expect(BI.int2Abc(0)).to.eql("");
expect(BI.int2Abc(26)).to.eql("Z");
});
/**
* test_author_kobi
**/
it("数组相关方法补充", () => {
expect(BI.makeArrayByArray([], 5)).toEqual([]);
expect(BI.uniq(null, true, (a, b) => a > b)).toEqual([]);
it("数组相关方法补充", function () {
expect(BI.makeArrayByArray([], 5)).to.eql([]);
expect(BI.uniq(null, true, (a, b) => a > b)).to.eql([]);
});
/**
* test_author_kobi
**/
it("对象相关方法补充", () => {
it("对象相关方法补充", function () {
var obj = {
a: 1,
b: 2,
c: 3,
};
expect(BI.has(obj, [])).toEqual(false);
expect(BI.has(obj, ["a", "b"])).toEqual(true);
expect(BI.freeze("1")).toEqual("1");
expect(BI.has(obj, [])).to.eql(false);
expect(BI.has(obj, ["a", "b"])).to.eql(true);
expect(BI.freeze("1")).to.eql("1");
});
/**
* test_author_kobi
**/
it("deep方法补充", () => {
it("deep方法补充", function () {
var obj = {
a: 1,
b: 2,
@ -426,19 +426,19 @@ describe("baseFunctionTest", () => {
},
},
};
expect(BI.isDeepMatch(null, { d: 3, e: { f: 4 } })).toEqual(false);
expect(BI.isDeepMatch(obj, { d: 3, e: { f: 5 } })).toEqual(false);
expect(BI.deepIndexOf(obj, { d: 3, e: { f: 5 } })).toEqual(-1);
expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).toEqual(true);
expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).toEqual({ a: 1, b: 2 });
expect(BI.isDeepMatch(null, { d: 3, e: { f: 4 } })).to.eql(false);
expect(BI.isDeepMatch(obj, { d: 3, e: { f: 5 } })).to.eql(false);
expect(BI.deepIndexOf(obj, { d: 3, e: { f: 5 } })).to.eql(-1);
expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).to.eql(true);
expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).to.eql({ a: 1, b: 2 });
});
/**
* test_author_teller
* 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒
*/
it("parseDateTime2", () => {
it("parseDateTime2", function () {
var date = BI.getDate();
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).toEqual(BI.getDate(date.getFullYear(), date.getMonth(), 14, 14, 13, 16).getTime());
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).to.eql(BI.getDate(date.getFullYear(), date.getMonth(), 14, 14, 13, 16).getTime());
});
});

24
packages/fineui/src/core/__test__/context.test.js

@ -1,15 +1,15 @@
/**
* Created by guy on 2018/01/23.
*/
describe("contextTest", () => {
describe("contextTest", function () {
beforeAll(() => {
before(function () {
});
/**
* test_author_guy
*/
it("context测试", () => {
it("context测试", function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
@ -70,9 +70,9 @@ describe("contextTest", () => {
type: "demo.demo"
});
expect(demo.child.model.currContext).toBe("默认context");
expect(demo.child.model.currContext).to.equal("默认context");
demo.child.store.changeContext();
expect(demo.model.context).toBe("改变后的context");
expect(demo.model.context).to.equal("改变后的context");
demo.destroy();
});
@ -80,7 +80,7 @@ describe("contextTest", () => {
/**
* test_author_guy
*/
it("异步context测试-loader的populate测试", done => {
it("异步context测试-loader的populate测试", function (done) {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
@ -167,7 +167,7 @@ describe("contextTest", () => {
demo.child.populate();
setTimeout(function () {
expect(demo.labels[0].model.currContext).toBe("默认context");
expect(demo.labels[0].model.currContext).to.equal("默认context");
demo.destroy();
done();
}, 0);
@ -176,7 +176,7 @@ describe("contextTest", () => {
/**
* test_author_guy
*/
it("异步context测试-beforeInit测试", done => {
it("异步context测试-beforeInit测试", function (done) {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
@ -242,7 +242,7 @@ describe("contextTest", () => {
});
setTimeout(function () {
expect(demo.child.model.currContext).toBe("默认context");
expect(demo.child.model.currContext).to.equal("默认context");
demo.destroy();
done();
}, 0);
@ -251,7 +251,7 @@ describe("contextTest", () => {
/**
* test_author_guy
*/
it("inject测试", () => {
it("inject测试", function () {
var ParentStore = BI.inherit(Fix.Model, {
state: function () {
@ -312,9 +312,9 @@ describe("contextTest", () => {
type: "demo.demo"
});
expect(demo.child.model.currContext).toBe("默认context");
expect(demo.child.model.currContext).to.equal("默认context");
demo.child.store.changeContext();
expect(demo.model.context).toBe("默认context");
expect(demo.model.context).to.equal("默认context");
demo.destroy();
});

8
packages/fineui/src/core/__test__/widget.test.js

@ -1,15 +1,15 @@
/**
* Created by guy on 2018/01/23.
*/
describe("widgetTest", () => {
describe("widgetTest", function () {
beforeAll(() => {
before(function () {
});
/**
* test_author_guy
*/
it("widget生命周期测试", () => {
it("widget生命周期测试", function () {
var Demo = BI.inherit(BI.Widget, {
render: function () {
@ -31,7 +31,7 @@ describe("widgetTest", () => {
}
});
expect(demo.element.text()).toBe("new");
expect(demo.element.text()).to.equal("new");
demo.destroy();
});

11
packages/fineui/src/core/constant/writable.var.js

@ -138,4 +138,13 @@ addDescriptor("DOM", {
addDescriptor("nextTick", {
get: () => nextTick,
set: setNextTick,
});
});
export let PasteLimit = 2000;
export const setPasteLimit = v => {
PasteLimit = v;
};
addDescriptor("PasteLimit", {
get: () => PasteLimit,
set: setPasteLimit,
});

2
packages/fineui/src/core/controller/controller.layer.js

@ -108,7 +108,7 @@ export class LayerController extends Controller {
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "",
};
const { top, left, scaleY, scaleX } = getPositionRelativeContainingBlockRect(layout.element[0]);
const { top, left, scaleY, scaleX } = getPositionRelativeContainingBlockRect(layout.element[0].parentNode || layout.element[0]);
css.top = (css.top - top) / scaleY;
css.left = (css.left - left) / scaleX;

38
packages/fineui/src/core/func/__test__/date.test.js

@ -1,31 +1,31 @@
/**
* Created by windy on 2018/01/23.
*/
describe("dateFunctionTest", () => {
describe("dateFunctionTest", function () {
beforeAll(() => {
before(function () {
});
/**
* test_author_windy
*/
it("getWeekNumber", () => {
expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).toBe("2004-53");
expect(BI.print(BI.getDate(2005, 0, 2), "%Y-%W")).toBe("2004-53");
expect(BI.print(BI.getDate(2005, 11, 31), "%Y-%W")).toBe("2005-52");
expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).toBe("2007-01");
expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).toBe("2007-52");
expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).toBe("2008-01");
expect(BI.print(BI.getDate(2008, 0, 1), "%Y-%W")).toBe("2008-01");
expect(BI.print(BI.getDate(2008, 11, 28), "%Y-%W")).toBe("2008-52");
expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).toBe("2009-01");
expect(BI.print(BI.getDate(2008, 11, 30), "%Y-%W")).toBe("2009-01");
expect(BI.print(BI.getDate(2008, 11, 31), "%Y-%W")).toBe("2009-01");
expect(BI.print(BI.getDate(2009, 0, 1), "%Y-%W")).toBe("2009-01");
expect(BI.print(BI.getDate(2009, 11, 31), "%Y-%W")).toBe("2009-53");
expect(BI.print(BI.getDate(2010, 0, 1), "%Y-%W")).toBe("2009-53");
expect(BI.print(BI.getDate(2010, 0, 2), "%Y-%W")).toBe("2009-53");
expect(BI.print(BI.getDate(2010, 0, 3), "%Y-%W")).toBe("2009-53");
it("getWeekNumber", function () {
expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).to.equal("2004-53");
expect(BI.print(BI.getDate(2005, 0, 2), "%Y-%W")).to.equal("2004-53");
expect(BI.print(BI.getDate(2005, 11, 31), "%Y-%W")).to.equal("2005-52");
expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).to.equal("2007-01");
expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).to.equal("2007-52");
expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).to.equal("2008-01");
expect(BI.print(BI.getDate(2008, 0, 1), "%Y-%W")).to.equal("2008-01");
expect(BI.print(BI.getDate(2008, 11, 28), "%Y-%W")).to.equal("2008-52");
expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).to.equal("2009-01");
expect(BI.print(BI.getDate(2008, 11, 30), "%Y-%W")).to.equal("2009-01");
expect(BI.print(BI.getDate(2008, 11, 31), "%Y-%W")).to.equal("2009-01");
expect(BI.print(BI.getDate(2009, 0, 1), "%Y-%W")).to.equal("2009-01");
expect(BI.print(BI.getDate(2009, 11, 31), "%Y-%W")).to.equal("2009-53");
expect(BI.print(BI.getDate(2010, 0, 1), "%Y-%W")).to.equal("2009-53");
expect(BI.print(BI.getDate(2010, 0, 2), "%Y-%W")).to.equal("2009-53");
expect(BI.print(BI.getDate(2010, 0, 3), "%Y-%W")).to.equal("2009-53");
});
});

14
packages/fineui/src/core/func/__test__/function.test.js

@ -3,22 +3,22 @@
* @Maintainers: lei.wang
* @Date: 2019-04-16
*/
describe("core-function-test", () => {
describe("core-function-test", function () {
/**
* test_author_lei.wang
*/
it("createDistinctName-支持字符串数组", () => {
it("createDistinctName-支持字符串数组", function () {
const names = ["name", "name1"];
expect(BI.Func.createDistinctName(names, "name")).toBe("name2");
expect(BI.Func.createDistinctName(names, "name2")).toBe("name2");
expect(BI.Func.createDistinctName(names, "name")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2");
});
/**
* test_author_lei.wang
*/
it("createDistinctName-支持对象数组数组", () => {
it("createDistinctName-支持对象数组数组", function () {
const names = [{ name: "name" }, { name: "name1" }];
expect(BI.Func.createDistinctName(names, "name")).toBe("name2");
expect(BI.Func.createDistinctName(names, "name2")).toBe("name2");
expect(BI.Func.createDistinctName(names, "name")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2");
});
});

10
packages/fineui/src/core/func/__test__/string.test.js

@ -3,17 +3,17 @@
* @version 2.0
* Created by windy on 2020/6/5
*/
describe("dateFunctionTest", () => {
describe("dateFunctionTest", function () {
beforeAll(() => {
before(function () {
});
/**
* test_author_windy
*/
it("getWeekNumber", () => {
expect(BI.replaceAll(null, "A", "b")).toBeNull();
expect(BI.replaceAll("A", "A", "b")).toBe("b");
it("getWeekNumber", function () {
expect(BI.replaceAll(null, "A", "b")).to.equal(null);
expect(BI.replaceAll("A", "A", "b")).to.equal("b");
});
});

7
packages/fineui/src/core/func/alias.js

@ -9,7 +9,8 @@ import {
leftPad,
parseDateTime,
values,
isArray
isArray,
getDate
} from "../2.base";
import { replaceAll } from "./string";
import { getFullDayName, getMonthName, getTimezone } from "./date";
@ -680,10 +681,10 @@ export const contentFormat = function(cv, fmt) {
if (!(cv instanceof Date)) {
if (typeof cv === "number") {
// 毫秒数类型
cv = new Date(cv);
cv = getDate(cv);
} else {
// 字符串类型转化为date类型
cv = new Date(Date.parse((`${cv}`).replace(/-|\./g, "/")));
cv = getDate(Date.parse((`${cv}`).replace(/-|\./g, "/")));
}
}
if (!isInvalidDate(cv) && !isNull(cv)) {

36
packages/fineui/src/core/platform/web/jquery/__test__/fn.test.js

@ -4,79 +4,73 @@
* Created by windy on 2019/12/9
*/
describe("标红test", () => {
describe("标红test", function () {
/**
* test_author_windy
*/
it("无多音字标红", () => {
it("无多音字标红", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("无多音字", "w");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">无</span>多音字");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">无</span>多音字");
a.destroy();
});
/**
* test_author_windy
*/
it("含有多音字标红", () => {
it("含有多音字标红", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("长期协议", "z");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">长</span>期协议");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">长</span>期协议");
a.element.__textKeywordMarked__("长期协议", "c");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">长</span>期协议");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">长</span>期协议");
a.destroy();
});
/**
* test_author_windy
*/
it("多音字错位标红", () => {
it("多音字错位标红", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("呵呵呵", "h");
expect(a.element.html()).toBe(
"<span class=\"bi-keyword-red-mark\">呵</span><span class=\"bi-keyword-red-mark\">呵</span><span class=\"bi-keyword-red-mark\">呵</span>"
);
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">呵</span><span class=\"bi-keyword-red-mark\">呵</span><span class=\"bi-keyword-red-mark\">呵</span>");
a.element.__textKeywordMarked__("呵呵呵", "hh");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">呵呵</span>呵");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">呵呵</span>呵");
a.element.__textKeywordMarked__("呵呵呵", "hhh");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">呵呵呵</span>");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">呵呵呵</span>");
a.destroy();
});
/**
* test_author_windy
*/
it("原文和拼音都匹配标红", () => {
it("原文和拼音都匹配标红", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("啊a", "a");
expect(a.element.html()).toBe(
"<span class=\"bi-keyword-red-mark\">啊</span><span class=\"bi-keyword-red-mark\">a</span>"
);
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">啊</span><span class=\"bi-keyword-red-mark\">a</span>");
a.element.__textKeywordMarked__("a啊", "a");
expect(a.element.html()).toBe(
"<span class=\"bi-keyword-red-mark\">a</span><span class=\"bi-keyword-red-mark\">啊</span>"
);
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">a</span><span class=\"bi-keyword-red-mark\">啊</span>");
a.destroy();
});
/**
* test_author_windy
*/
it("中文拼音", () => {
it("中文拼音", function () {
var a = BI.Test.createWidget({
type: "bi.layout",
});
a.element.__textKeywordMarked__("日期", "日期");
expect(a.element.html()).toBe("<span class=\"bi-keyword-red-mark\">日期</span>");
expect(a.element.html()).to.equal("<span class=\"bi-keyword-red-mark\">日期</span>");
a.destroy();
});
});

10
packages/fineui/src/core/utils/__test__/aes.test.js

@ -4,23 +4,23 @@
* @LastEditor: fay
* @LastEditTime: 2020-03-02 16:56:43
*/
describe("aesDecrypt", () => {
describe("aesDecrypt", function () {
/**
* test_author_fay
*/
it("aesEncrypt", () => {
it("aesEncrypt", function () {
var text = "test";
expect(BI.aesEncrypt(text, "0123456789ABCDEF")).toEqual("0No4i/uz2cfoo6zQMHaL1A==");
expect(BI.aesEncrypt(text, "0123456789ABCDEF")).to.eql("0No4i/uz2cfoo6zQMHaL1A==");
});
/**
* test_author_fay
*/
it("aesDecrypt", () => {
it("aesDecrypt", function () {
var text = "0No4i/uz2cfoo6zQMHaL1A==";
expect(BI.aesDecrypt(text, "0123456789ABCDEF")).toEqual("test");
expect(BI.aesDecrypt(text, "0123456789ABCDEF")).to.eql("test");
});
});

9
packages/fineui/src/core/utils/dom.js

@ -744,10 +744,11 @@ export function getComboPosition(combo, popup, extraWidth, extraHeight, needAdap
if (needAdaptHeight === true && popup.resetHeight) {
const comboRect = combo.element[0].getBoundingClientRect();
const relativeOffset = positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0;
if (position.top < comboRect.top) {
popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, comboRect.top, maxHeight));
} else if (position.top >= comboRect.bottom) {
popup.resetHeight(Math.min(viewportBounds.height - position.top - relativeOffset, viewportBounds.height - comboRect.bottom, maxHeight));
const positionTop = position.top + relativeOffset;
if (positionTop < comboRect.top) {
popup.resetHeight(Math.min(viewportBounds.height - positionTop, comboRect.top, maxHeight));
} else if (positionTop >= comboRect.bottom) {
popup.resetHeight(Math.min(viewportBounds.height - positionTop, viewportBounds.height - comboRect.bottom, maxHeight));
}
}

8
packages/fineui/src/less/base/colorchooser/colorpicker/button.colorshow.less

@ -4,4 +4,12 @@
&.active, &:active {
border-color: @color-bi-border-active-chooser-show-button;
}
}
.bi-theme-dark {
.bi-color-chooser-show-button {
&.active, &:active {
border-color: @color-bi-border-active-chooser-show-button-theme-dark;
}
}
}

12
packages/fineui/src/less/base/single/button/button.less

@ -578,6 +578,8 @@ body .bi-button, #body .bi-button {
.bi-theme-dark, #body .bi-theme-dark {
.bi-button {
background-color: @color-bi-background-button-theme-dark;
&.button-ignore {
background-color: @color-bi-background-ignore-button-theme-dark;
@ -643,5 +645,15 @@ body .bi-button, #body .bi-button {
}
}
}
&.button-common {
&.light {
background-color: @color-bi-background-common-light-button-theme-dark;
&, & .b-font:before {
color: @color-bi-text-common-light-button-theme-dark;
}
}
}
}
}

2
packages/fineui/src/less/base/single/button/switch.less

@ -25,7 +25,7 @@
.bi-switch {
background-color: @color-bi-background-switch-theme-dark;
&.active {
background-color: @color-bi-background-active-switch;
background-color: @color-bi-background-active-switch-theme-dark;
}
}
}

6
packages/fineui/src/less/core/utils/common.less

@ -104,6 +104,10 @@
.bi-theme-dark {
.bi-focus-shadow {
&:focus, &:hover {
border-color: @color-bi-border-highlight-theme-dark;
}
&.disabled {
&:hover {
border-color: @border-color-line-theme-dark;
@ -142,7 +146,7 @@
.bi-theme-dark {
.bi-background {
background-color: @color-bi-background-normal-theme-dark;
background-color: @color-bi-background-theme-dark;
color: @color-bi-text-background-theme-dark;
& .bi-input {

6
packages/fineui/src/less/core/utils/list-item.less

@ -161,12 +161,12 @@
}
}
&.active, &:active {
color: @color-bi-text-highlight;
color: @color-bi-text-highlight-theme-dark;
& .bi-input {
color: @color-bi-text-highlight;
color: @color-bi-text-highlight-theme-dark;
}
& .bi-textarea {
color: @color-bi-text-highlight;
color: @color-bi-text-highlight-theme-dark;
}
}
&.disabled {

3
packages/fineui/src/less/lib/colors.less

@ -38,6 +38,7 @@
//基本提亮颜色
@color-bi-text-highlight: @font-color-highlight;
@color-bi-text-highlight-theme-dark: @font-color-highlight;
//标红色
@color-bi-text-redmark: @font-color-warning;
@ -50,6 +51,7 @@
@color-bi-background-normal: @background-color-normal;
//深色主题普通背景
@color-bi-background-normal-theme-dark: @background-color-normal-theme-dark;
@color-bi-background-theme-dark: @background-color-normal-theme-dark;
//默认背景
@color-bi-background-default: @background-color-default;
//深色主题默认背景
@ -132,5 +134,6 @@
@color-bi-border-warning: @border-color-warning;
//边框提亮
@color-bi-border-highlight: @border-color-highlight;
@color-bi-border-highlight-theme-dark: @border-color-highlight;
@color-bi-alert-warning: @color-bi-orange;

4
packages/fineui/src/less/lib/theme.less

@ -62,6 +62,7 @@
// 按钮
@color-bi-border-button: @color-bi-border-highlight;
@color-bi-background-button: @color-bi-background-highlight;
@color-bi-background-button-theme-dark: @color-bi-background-highlight;
@color-bi-text-common-button: @color-bi-text;
@color-bi-text-common-clear-button: @color-bi-text-highlight;
@color-bi-text-common-plain-button: @color-bi-text-highlight;
@ -75,7 +76,9 @@
@color-bi-background-hover-common-ghost-button-theme-dark: @color-bi-background-default;
@color-bi-text-common-light-button: @color-bi-text-highlight;
@color-bi-text-common-light-button-theme-dark: @color-bi-text-highlight;
@color-bi-background-common-light-button: @color-bi-background-light-blue;
@color-bi-background-common-light-button-theme-dark: @color-bi-background-light-blue;
@color-bi-background-hover-common-light-button: @color-bi-background-light-blue;
@color-bi-background-active-common-light-button: @color-bi-background-light-blue;
@color-bi-background-hover-plain-button: @color-black-5;
@ -202,6 +205,7 @@
@color-bi-border-picker-button-mask: @color-bi-border-black;
@color-bi-border-picker-button-mask-theme-dark: @color-bi-border-default;
@color-bi-border-active-chooser-show-button: @color-bi-border-highlight;
@color-bi-border-active-chooser-show-button-theme-dark: @color-bi-border-highlight;
@color-bi-background-disabled-chooser-popup-mask: @color-bi-background-default;
// combo
@color-bi-border-hover-combo: @color-bi-border-highlight;

32
packages/fineui/src/widget/datepane/__test__/datepane.test.js

@ -4,12 +4,12 @@
* Created by windy on 2019/9/2
*/
describe("DatePane", () => {
describe("DatePane", function () {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
@ -21,16 +21,16 @@ describe("DatePane", () => {
}
},
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).toBe("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setStaticValue", () => {
it("setStaticValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
});
@ -42,16 +42,16 @@ describe("DatePane", () => {
day: 11
}
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).toBe("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setDynamicValue", () => {
it("setDynamicValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
});
@ -65,7 +65,7 @@ describe("DatePane", () => {
day: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.setValue({
type: 2,
@ -73,14 +73,14 @@ describe("DatePane", () => {
workDay: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.destroy();
});
/**
* test_author_windy
*/
it("getStaticValue", done => {
it("getStaticValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
@ -97,7 +97,7 @@ describe("DatePane", () => {
datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click();
BI.nextTick(function () {
datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
expect(datePane.getValue()).toEqual({
expect(datePane.getValue()).to.deep.equal({
type: 1,
value: {
year: 2019,
@ -114,7 +114,7 @@ describe("DatePane", () => {
/**
* test_author_windy
*/
it("getDynamicValue", done => {
it("getDynamicValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane",
value: {
@ -129,7 +129,7 @@ describe("DatePane", () => {
BI.nextTick(function () {
datePane.element.find(".bi-multi-select-item.active").click();
datePane.element.find(".bi-multi-select-item").click();
expect(datePane.getValue()).toEqual({
expect(datePane.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -0

16
packages/fineui/src/widget/datetime/__test__/datetime.test.js

@ -4,9 +4,9 @@
* Created by windy on 2019/9/6
*/
describe("DateTime", () => {
describe("DateTime", function () {
beforeAll(() => {
before(function () {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("DateTime", () => {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.date_time_combo",
value: {
@ -28,14 +28,14 @@ describe("DateTime", () => {
second: 12
}
});
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).toBe("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
});
/**
* test_author_windy
*/
it("点击确定选值", done => {
it("点击确定选值", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.date_time_combo",
value: {
@ -51,7 +51,7 @@ describe("DateTime", () => {
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).toBe("2018-02-16 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-16 12:12:12");
dateCombo.destroy();
done();
})
@ -61,7 +61,7 @@ describe("DateTime", () => {
/**
* test_author_windy
*/
it("点击取消不选值", done => {
it("点击取消不选值", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.date_time_combo",
value: {
@ -77,7 +77,7 @@ describe("DateTime", () => {
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(16)").parent().click();
dateCombo.element.find(".bi-date-time-popup .bi-text:contains(取消)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).toBe("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
done();
})

32
packages/fineui/src/widget/datetimepane/__test__/datetimepane.test.js

@ -9,12 +9,12 @@
* Created by windy on 2019/9/2
*/
describe("DateTimePane", () => {
describe("DateTimePane", function () {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
@ -26,16 +26,16 @@ describe("DateTimePane", () => {
}
},
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).toBe("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setStaticValue", () => {
it("setStaticValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
});
@ -47,16 +47,16 @@ describe("DateTimePane", () => {
day: 11
}
});
expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).toBe("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12");
expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).to.equal("11");
datePane.destroy();
});
/**
* test_author_windy
*/
it("setDynamicValue", () => {
it("setDynamicValue", function () {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
});
@ -70,7 +70,7 @@ describe("DateTimePane", () => {
day: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.setValue({
type: 2,
@ -78,14 +78,14 @@ describe("DateTimePane", () => {
workDay: 1
}
});
expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间");
datePane.destroy();
});
/**
* test_author_windy
*/
it("getStaticValue", done => {
it("getStaticValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
@ -103,7 +103,7 @@ describe("DateTimePane", () => {
BI.nextTick(function () {
datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
datePane.element.find(".bi-date-time-select .bi-number-editor .top-button").get(0).click();
expect(datePane.getValue()).toEqual({
expect(datePane.getValue()).to.deep.equal({
type: 1,
value: {
year: 2019,
@ -123,7 +123,7 @@ describe("DateTimePane", () => {
/**
* test_author_windy
*/
it("getDynamicValue", done => {
it("getDynamicValue", function (done) {
var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_time_pane",
value: {
@ -138,7 +138,7 @@ describe("DateTimePane", () => {
BI.nextTick(function () {
datePane.element.find(".bi-multi-select-item.active").click();
datePane.element.find(".bi-multi-select-item").click();
expect(datePane.getValue()).toEqual({
expect(datePane.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -0

14
packages/fineui/src/widget/downlist/__test__/downlist.test.js

@ -4,19 +4,19 @@
* Created by windy on 2019/9/3
*/
describe("DownListCombo", () => {
describe("DownListCombo", function () {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var downListCombo = BI.Test.createWidget({
type: "bi.down_list_combo",
adjustLength: 10,
items: [[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":12},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}],[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":11},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}]]
});
downListCombo.setValue([{value: 12, childValue: 21}]);
expect(downListCombo.getValue()).toEqual([ { childValue: 21, value: 12 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]);
downListCombo.destroy();
});
@ -24,7 +24,7 @@ describe("DownListCombo", () => {
/**
* test_author_windy
*/
it("点击父亲选值", done => {
it("点击父亲选值", function (done) {
var downListCombo = BI.Test.createWidget({
type: "bi.down_list_combo",
height: 30,
@ -34,7 +34,7 @@ describe("DownListCombo", () => {
downListCombo.element.children(".pull-down-font").click();
BI.nextTick(function () {
downListCombo.element.find(".bi-down-list-group:last-child .bi-down-list-item").click();
expect(downListCombo.getValue()).toEqual([ { value: 33 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { value: 33 } ]);
downListCombo.destroy();
done();
});
@ -44,7 +44,7 @@ describe("DownListCombo", () => {
/**
* test_author_windy
*/
it("点击儿子选值", done => {
it("点击儿子选值", function (done) {
var downListCombo = BI.Test.createWidget({
type: "bi.down_list_combo",
height: 30,
@ -55,7 +55,7 @@ describe("DownListCombo", () => {
BI.Test.triggerMouseover(downListCombo.element.find(".bi-down-list-group:first-child .bi-down-list-group-item"), function () {
BI.nextTick(function () {
downListCombo.element.find(".child-down-list-item:first-child").click();
expect(downListCombo.getValue()).toEqual([ { childValue: 21, value: 12 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]);
downListCombo.destroy();
done();
});

46
packages/fineui/src/widget/dynamicdate/__test__/dynamicdate.test.js

@ -4,9 +4,9 @@
* Created by windy on 2019/9/4
*/
describe("DateCombo", () => {
describe("DateCombo", function () {
beforeAll(() => {
before(function () {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
value: {
@ -28,14 +28,14 @@ describe("DateCombo", () => {
}
}
});
expect(dateCombo.element.find(".bi-date-trigger .bi-label").text()).toBe("2018-02-23");
expect(dateCombo.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-02-23");
dateCombo.destroy();
});
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", done => {
it("测试输入值收起下拉清空值下拉出现", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -54,11 +54,11 @@ describe("DateCombo", () => {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "8", 56, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).toBe(0);
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).toBe("block");
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").css("display")).to.equal("block");
dateCombo.destroy();
done();
});
@ -72,7 +72,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", done => {
it("trigger的confirm-下拉面板选值confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -82,7 +82,7 @@ describe("DateCombo", () => {
dateCombo.element.find(".bi-date-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(5)").parent().click();
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).toBe(0);
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
})
@ -92,7 +92,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", done => {
it("下拉后直接点击外部的触发的confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -105,7 +105,7 @@ describe("DateCombo", () => {
var input = dateCombo.element.find(".bi-date-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).toBe(0);
expect(dateCombo.element.find(".bi-date-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
}, 300);
@ -118,7 +118,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("点击清空", done => {
it("点击清空", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -135,7 +135,7 @@ describe("DateCombo", () => {
dateCombo.element.find(".bi-date-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(清除)").parent().click();
expect(BI.isNull(dateCombo.getValue())).toBe(true);
expect(BI.isNull(dateCombo.getValue())).to.equal(true);
dateCombo.destroy();
done();
})
@ -144,7 +144,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("点击今天", done => {
it("点击今天", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -162,7 +162,7 @@ describe("DateCombo", () => {
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(今天)").parent().click();
var date = BI.getDate();
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 1,
value: {
year: date.getFullYear(),
@ -179,7 +179,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("点击确定", done => {
it("点击确定", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -196,7 +196,7 @@ describe("DateCombo", () => {
dateCombo.element.find(".bi-date-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 1,
value: {
year: 2018,
@ -212,7 +212,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("测试动态默认值", () => {
it("测试动态默认值", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -229,7 +229,7 @@ describe("DateCombo", () => {
}
}
});
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 2,
value: {
year: -1,
@ -246,7 +246,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("测试工作日动态默认值", () => {
it("测试工作日动态默认值", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -258,7 +258,7 @@ describe("DateCombo", () => {
}
}
});
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -1
@ -271,7 +271,7 @@ describe("DateCombo", () => {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", done => {
it("trigger的输入日期后confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_combo",
width: 220,
@ -292,7 +292,7 @@ describe("DateCombo", () => {
input.val("2017-1-1");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-date-trigger .bi-text-button").text()).toBe("2017-01-01");
expect(dateCombo.element.find(".bi-date-trigger .bi-text-button").text()).to.equal("2017-01-01");
dateCombo.destroy();
done();
}, 300);

46
packages/fineui/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js

@ -4,9 +4,9 @@
* Created by windy on 2019/9/4
*/
describe("DateTimeCombo", () => {
describe("DateTimeCombo", function () {
beforeAll(() => {
before(function () {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("defaultValue", done => {
it("defaultValue", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
value: {
@ -32,7 +32,7 @@ describe("DateTimeCombo", () => {
}
});
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).toBe("2018-02-23 12:12:12");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-02-23 12:12:12");
dateCombo.destroy();
done();
})
@ -41,7 +41,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", done => {
it("测试输入值收起下拉清空值下拉出现", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -63,11 +63,11 @@ describe("DateTimeCombo", () => {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "8", 56, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).toBe(0);
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).to.equal(0);
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).toBe("block");
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).to.equal("block");
dateCombo.destroy();
done();
});
@ -81,7 +81,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", done => {
it("trigger的confirm-下拉面板选值confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -92,7 +92,7 @@ describe("DateTimeCombo", () => {
BI.nextTick(function () {
dateCombo.element.find(".bi-calendar:visible .bi-list-item-select :contains(5)").parent().click();
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).toBe("block");
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").css("display")).to.equal("block");
dateCombo.destroy();
done();
})
@ -102,7 +102,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", done => {
it("下拉后直接点击外部的触发的confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -115,7 +115,7 @@ describe("DateTimeCombo", () => {
var input = dateCombo.element.find(".bi-date-time-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).toBe(0);
expect(dateCombo.element.find(".bi-date-time-trigger + .bi-popup-view").length).to.equal(0);
dateCombo.destroy();
done();
}, 300);
@ -128,7 +128,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("点击清空", done => {
it("点击清空", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -148,7 +148,7 @@ describe("DateTimeCombo", () => {
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-time-popup .bi-text:contains(清除)").parent().click();
expect(BI.isNull(dateCombo.getValue())).toBe(true);
expect(BI.isNull(dateCombo.getValue())).to.equal(true);
dateCombo.destroy();
done();
})
@ -157,7 +157,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("点击今天", done => {
it("点击今天", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -178,7 +178,7 @@ describe("DateTimeCombo", () => {
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-time-popup .bi-text:contains(今天)").parent().click();
var date = BI.getDate();
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 1,
value: {
year: date.getFullYear(),
@ -198,7 +198,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("点击确定", done => {
it("点击确定", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -218,7 +218,7 @@ describe("DateTimeCombo", () => {
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-dynamic-date-time-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 1,
value: {
year: 2018,
@ -237,7 +237,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("测试动态默认值", () => {
it("测试动态默认值", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -255,7 +255,7 @@ describe("DateTimeCombo", () => {
}
});
dateCombo.element.find(".bi-date-time-trigger .bi-basic-button").click();
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 2,
value: {
year: -1,
@ -272,7 +272,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("测试工作日动态默认值", () => {
it("测试工作日动态默认值", function () {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -284,7 +284,7 @@ describe("DateTimeCombo", () => {
}
}
});
expect(dateCombo.getValue()).toEqual({
expect(dateCombo.getValue()).to.deep.equal({
type: 2,
value: {
workDay: -1
@ -297,7 +297,7 @@ describe("DateTimeCombo", () => {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", done => {
it("trigger的输入日期后confirm", function (done) {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_date_time_combo",
width: 220,
@ -318,7 +318,7 @@ describe("DateTimeCombo", () => {
input.val("2017-1-1");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-date-time-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).toBe("2017-01-01 00:00:00");
expect(dateCombo.element.find(".bi-date-time-trigger .bi-text-button").text()).to.equal("2017-01-01 00:00:00");
dateCombo.destroy();
done();
}, 300);

50
packages/fineui/src/widget/editor/__test__/editor.search.test.js

@ -4,12 +4,12 @@
* Created by windy on 2019/9/9
*/
describe("searchEditor", () => {
describe("searchEditor", function () {
/**
* test_author_windy
*/
it("defaultValue", done => {
it("defaultValue", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
@ -20,11 +20,11 @@ describe("searchEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).toBe("添加合法性判断");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -33,7 +33,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("clear", done => {
it("clear", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
@ -46,7 +46,7 @@ describe("searchEditor", () => {
});
BI.nextTick(function () {
editor.element.find(".close-font").click();
expect(editor.element.find(".bi-input").val()).toBe("");
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
@ -55,7 +55,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
@ -66,7 +66,7 @@ describe("searchEditor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -74,7 +74,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300,
@ -85,21 +85,21 @@ describe("searchEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
/**
* test_author_windy
*/
it("getKeywords", done => {
it("getKeywords", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300
});
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8 8", 56, function () {
expect(editor.getKeywords()).toEqual(["8", "8"]);
expect(editor.getKeywords()).to.deep.equal(["8", "8"]);
editor.destroy();
done();
})
@ -109,7 +109,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("defaultValue1", done => {
it("defaultValue1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
@ -120,11 +120,11 @@ describe("searchEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).toBe("添加合法性判断");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -133,7 +133,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("clear1", done => {
it("clear1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
@ -146,7 +146,7 @@ describe("searchEditor", () => {
});
BI.nextTick(function () {
editor.element.find(".close-font").click();
expect(editor.element.find(".bi-input").val()).toBe("");
expect(editor.element.find(".bi-input").val()).to.equal("");
editor.destroy();
done();
});
@ -155,7 +155,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("setValue1", () => {
it("setValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
@ -166,7 +166,7 @@ describe("searchEditor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -174,7 +174,7 @@ describe("searchEditor", () => {
/**
* test_author_windy
*/
it("getValue1", () => {
it("getValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_search_editor",
width: 300,
@ -185,21 +185,21 @@ describe("searchEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
/**
* test_author_windy
*/
it("getKeywords1", done => {
it("getKeywords1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.search_editor",
width: 300
});
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8 8", 56, function () {
expect(editor.getKeywords()).toEqual(["8", "8"]);
expect(editor.getKeywords()).to.deep.equal(["8", "8"]);
editor.destroy();
done();
})

42
packages/fineui/src/widget/editor/__test__/editor.text.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2019/9/9
*/
describe("textEditor", () => {
describe("textEditor", function () {
/**
* test_author_windy
*/
it("defaultValue", done => {
it("defaultValue", function (done) {
var editor = BI.Test.createWidget({
type: "bi.text_editor",
width: 300,
@ -19,11 +19,11 @@ describe("textEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).toBe("添加合法性判断");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -32,7 +32,7 @@ describe("textEditor", () => {
/**
* test_author_windy
*/
it("setValue", () => {
it("setValue", function () {
var editor = BI.Test.createWidget({
type: "bi.text_editor",
width: 300,
@ -43,14 +43,14 @@ describe("textEditor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
/**
* test_author_windy
*/
it("setErrorText", done => {
it("setErrorText", function (done) {
var editor = BI.Test.createWidget({
type: "bi.text_editor",
width: 300,
@ -63,7 +63,7 @@ describe("textEditor", () => {
editor.setErrorText("xin_error");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("xin_error");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("xin_error");
editor.destroy();
done();
});
@ -72,7 +72,7 @@ describe("textEditor", () => {
/**
* test_author_windy
*/
it("setWatermark", () => {
it("setWatermark", function () {
var editor = BI.Test.createWidget({
type: "bi.text_editor",
width: 300,
@ -83,14 +83,14 @@ describe("textEditor", () => {
}
});
editor.setWaterMark("xin_water");
expect(editor.element.find(".bi-water-mark").text()).toBe("xin_water");
expect(editor.element.find(".bi-water-mark").text()).to.equal("xin_water");
editor.destroy();
});
/**
* test_author_windy
*/
it("getValue", () => {
it("getValue", function () {
var editor = BI.Test.createWidget({
type: "bi.text_editor",
width: 300,
@ -101,7 +101,7 @@ describe("textEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});
@ -109,7 +109,7 @@ describe("textEditor", () => {
/**
* test_author_windy
*/
it("defaultValue1", done => {
it("defaultValue1", function (done) {
var editor = BI.Test.createWidget({
type: "bi.small_text_editor",
width: 300,
@ -120,11 +120,11 @@ describe("textEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.element.find(".bi-water-mark").text()).toBe("添加合法性判断");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-water-mark").text()).to.equal("添加合法性判断");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.focus();
BI.Test.triggerKeyDown(editor.element.find(".bi-input"), "8", 56, function () {
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).toBe("长度必须大于4");
expect(editor.element.find(".bi-bubble .bubble-text:first-child").text()).to.equal("长度必须大于4");
editor.destroy();
done();
})
@ -133,7 +133,7 @@ describe("textEditor", () => {
/**
* test_author_windy
*/
it("setValue1", () => {
it("setValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_text_editor",
width: 300,
@ -144,7 +144,7 @@ describe("textEditor", () => {
}
});
editor.setValue("12345");
expect(editor.element.find(".bi-input").val()).toBe("12345");
expect(editor.element.find(".bi-input").val()).to.equal("12345");
editor.destroy();
});
@ -152,7 +152,7 @@ describe("textEditor", () => {
/**
* test_author_windy
*/
it("getValue1", () => {
it("getValue1", function () {
var editor = BI.Test.createWidget({
type: "bi.small_text_editor",
width: 300,
@ -163,7 +163,7 @@ describe("textEditor", () => {
return this.getValue().length > 4;
}
});
expect(editor.getValue()).toBe("12346");
expect(editor.getValue()).to.equal("12346");
editor.destroy();
});

26
packages/fineui/src/widget/intervalslider/__test__/accuratecalculation.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2020/5/14
*/
describe("accuratecalculation", () => {
describe("accuratecalculation", function () {
/**
* test_author_windy
*/
it("add", () => {
it("add", function () {
var calculation = new BI.AccurateCalculationModel();
@ -17,31 +17,31 @@ describe("accuratecalculation", () => {
/**
* test_author_windy
*/
it("sub", () => {
it("sub", function () {
var calculation = new BI.AccurateCalculationModel();
expect(calculation.accurateSubtraction(0.124, 2345.678)).toBe(-2345.554);
expect(calculation.accurateSubtraction(-0.124, -2345.678)).toBe(2345.554);
expect(calculation.accurateSubtraction(0.124, -2345.678)).toBe(2345.802);
expect(calculation.accurateSubtraction(-2345.678, 0.124)).toBe(-2345.802);
expect(calculation.accurateSubtraction(0.124, 2345.678)).to.equal(-2345.554);
expect(calculation.accurateSubtraction(-0.124, -2345.678)).to.equal(2345.554);
expect(calculation.accurateSubtraction(0.124, -2345.678)).to.equal(2345.802);
expect(calculation.accurateSubtraction(-2345.678, 0.124)).to.equal(-2345.802);
});
/**
* test_author_windy
*/
it("mul", () => {
it("mul", function () {
var calculation = new BI.AccurateCalculationModel();
expect(calculation.accurateSubtraction(0.124, 2345.678)).toBe(-2345.554);
expect(calculation.accurateSubtraction(-0.124, -2345.678)).toBe(2345.554);
expect(calculation.accurateSubtraction(0.124, -2345.678)).toBe(2345.802);
expect(calculation.accurateSubtraction(-2345.678, 0.124)).toBe(-2345.802);
expect(calculation.accurateSubtraction(0.124, 2345.678)).to.equal(-2345.554);
expect(calculation.accurateSubtraction(-0.124, -2345.678)).to.equal(2345.554);
expect(calculation.accurateSubtraction(0.124, -2345.678)).to.equal(2345.802);
expect(calculation.accurateSubtraction(-2345.678, 0.124)).to.equal(-2345.802);
});
/**
* test_author_windy
*/
it("div", () => {
it("div", function () {
var calculation = new BI.AccurateCalculationModel();

22
packages/fineui/src/widget/intervalslider/__test__/intervalslider.test.js

@ -3,12 +3,12 @@
* @version 2.0
* Created by windy on 2019/9/12
*/
describe("intervalSlider", () => {
describe("intervalSlider", function () {
/**
* test_author_windy
*/
it("defaultValue", done => {
it("defaultValue", function (done) {
var intervalSliderLabel = BI.Test.createWidget({
type: "bi.interval_slider",
width: 300,
@ -26,8 +26,8 @@ describe("intervalSlider", () => {
});
intervalSliderLabel.populate();
BI.nextTick(function () {
expect(intervalSliderLabel.element.find(".sign-editor-text").get(0).innerHTML).toBe("10.0px");
expect(intervalSliderLabel.element.find(".sign-editor-text").get(1).innerHTML).toBe("120.0px");
expect(intervalSliderLabel.element.find(".sign-editor-text").get(0).innerHTML).to.equal("10.0px");
expect(intervalSliderLabel.element.find(".sign-editor-text").get(1).innerHTML).to.equal("120.0px");
intervalSliderLabel.destroy();
done();
});
@ -37,7 +37,7 @@ describe("intervalSlider", () => {
/**
* test_author_windy
*/
it("reset", () => {
it("reset", function () {
var intervalSliderLabel = BI.Test.createWidget({
type: "bi.interval_slider",
width: 300,
@ -54,7 +54,7 @@ describe("intervalSlider", () => {
});
intervalSliderLabel.reset();
intervalSliderLabel.populate();
expect(intervalSliderLabel.getValue()).toEqual({
expect(intervalSliderLabel.getValue()).eql({
min: "",
max: ""
});
@ -64,7 +64,7 @@ describe("intervalSlider", () => {
/**
* test_author_windy
*/
it("测试拖拽", () => {
it("测试拖拽", function () {
var intervalSliderLabel = BI.Test.createWidget({
type: "bi.interval_slider",
width: 300,
@ -81,7 +81,7 @@ describe("intervalSlider", () => {
});
intervalSliderLabel.reset();
intervalSliderLabel.populate();
expect(intervalSliderLabel.getValue()).toEqual({
expect(intervalSliderLabel.getValue()).eql({
min: "",
max: ""
});
@ -91,7 +91,7 @@ describe("intervalSlider", () => {
/**
* test_author_windy
*/
it("BI-65178", () => {
it("BI-65178", function () {
var intervalSliderLabel = BI.Test.createWidget({
type: "bi.interval_slider",
width: 300,
@ -102,8 +102,8 @@ describe("intervalSlider", () => {
min: -2,
max: 237939882
});
expect(intervalSliderLabel._getValueByPercent(0)).toBe(-2);
expect(intervalSliderLabel._getValueByPercent(100)).toBe(237939882);
expect(intervalSliderLabel._getValueByPercent(0)).to.equal(-2);
expect(intervalSliderLabel._getValueByPercent(100)).to.equal(237939882);
intervalSliderLabel.destroy();
});
});

14
packages/fineui/src/widget/multilayerdownlist/__test__/downlist.test.js

@ -3,18 +3,18 @@
* @version 2.0
* Created by windy on 2019/9/18
*/
describe("multi_layer_down_list_combo", () => {
describe("multi_layer_down_list_combo", function () {
/**
* test_author_windy
*/
it("defaultValue", () => {
it("defaultValue", function () {
var downListCombo = BI.Test.createWidget({
type: "bi.multi_layer_down_list_combo",
items: [[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":12},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font"},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}],[{"el":{"text":"column 1111","iconCls1":"dot-e-font","value":11},"children":[{"text":"column 1.1","value":21,"cls":"dot-e-font", children: [{"text":"column 1.1","value":21,"cls":"dot-e-font"}]},{"text":"column 1.2","value":22,"cls":"dot-e-font"}]}]]
});
downListCombo.setValue([{value: 12, childValue: 21}]);
expect(downListCombo.getValue()).toEqual([ { childValue: 21, value: 12 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]);
downListCombo.destroy();
});
@ -22,7 +22,7 @@ describe("multi_layer_down_list_combo", () => {
/**
* test_author_windy
*/
it("点击父亲选值", done => {
it("点击父亲选值", function (done) {
var downListCombo = BI.Test.createWidget({
type: "bi.multi_layer_down_list_combo",
height: 30,
@ -32,7 +32,7 @@ describe("multi_layer_down_list_combo", () => {
downListCombo.element.children(".pull-down-font").click();
BI.nextTick(function () {
downListCombo.element.find(".bi-down-list-group:last-child .bi-down-list-item").click();
expect(downListCombo.getValue()).toEqual([ { value: 33 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { value: 33 } ]);
done();
});
});
@ -41,7 +41,7 @@ describe("multi_layer_down_list_combo", () => {
/**
* test_author_windy
*/
it("点击儿子选值", done => {
it("点击儿子选值", function (done) {
var downListCombo = BI.Test.createWidget({
type: "bi.multi_layer_down_list_combo",
height: 30,
@ -52,7 +52,7 @@ describe("multi_layer_down_list_combo", () => {
BI.Test.triggerMouseover(downListCombo.element.find(".bi-down-list-group:first-child .bi-down-list-group-item"), function () {
BI.nextTick(function () {
downListCombo.element.find(".child-down-list-item:first-child").click();
expect(downListCombo.getValue()).toEqual([ { childValue: 21, value: 12 } ]);
expect(downListCombo.getValue()).to.deep.equal([ { childValue: 21, value: 12 } ]);
downListCombo.destroy();
done();
});

10
packages/fineui/src/widget/multilayerselecttree/__test__/multilayerselecttree.combo.test.js

@ -39,7 +39,7 @@ describe("multilayer_select_tree", () => {
items: BI.deepClone(items),
value: "第一级目录2",
});
expect(tree.getValue()).toBe("第一级目录2");
expect(tree.getValue()).to.equal("第一级目录2");
tree.destroy();
});
@ -54,7 +54,7 @@ describe("multilayer_select_tree", () => {
items: BI.deepClone(items),
value: "第一级目录2",
});
expect(tree.getValue()).toBe("第一级目录2");
expect(tree.getValue()).to.equal("第一级目录2");
tree.destroy();
});
@ -73,7 +73,7 @@ describe("multilayer_select_tree", () => {
tree.element.find(".bi-multi-layer-select-tree-trigger").click();
BI.nextTick(() => {
tree.element.find(".bi-select-tree-plus-group-node").click();
expect(tree.getValue()[0]).toBe("根目录");
expect(tree.getValue()[0]).to.equal("根目录");
tree.destroy();
done();
});
@ -97,7 +97,7 @@ describe("multilayer_select_tree", () => {
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-select-tree-trigger .bi-input"), "2", 50, () => {
BI.nextTick(() => {
tree.element.find(".bi-select-tree-mid-plus-group-node").click();
expect(tree.getValue()[0]).toBe("第一级目录2");
expect(tree.getValue()[0]).to.equal("第一级目录2");
tree.destroy();
done();
});
@ -125,7 +125,7 @@ describe("multilayer_select_tree", () => {
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-select-tree-trigger .bi-input"), "z", 50, () => {
BI.nextTick(() => {
tree.element.find(".bi-text-button:contains(+点击新增\"z\")").click();
expect(tree.getValue()[0]).toBe("z");
expect(tree.getValue()[0]).to.equal("z");
tree.destroy();
done();
});

22
packages/fineui/src/widget/multilayersingletree/__test__/multilayersingletree.combo.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2019/9/18
*/
describe("multilayer_single_tree", () => {
describe("multilayer_single_tree", function () {
var items = [{id: -1, pId: -2, value: "根目录", text: "根目录", open: true},
{id: 1, pId: -1, value: "第一级目录1", text: "第一级目录1", open: true},
@ -28,7 +28,7 @@ describe("multilayer_single_tree", () => {
/**
* test_author_windy
**/
it("defaultValue_allowEdit", () => {
it("defaultValue_allowEdit", function () {
var tree = BI.Test.createWidget({
type: "bi.multilayer_single_tree_combo",
width: 300,
@ -37,14 +37,14 @@ describe("multilayer_single_tree", () => {
items: BI.deepClone(items),
value: "第二级文件1"
});
expect(tree.getValue()).toBe("第二级文件1");
expect(tree.getValue()).to.equal("第二级文件1");
tree.destroy();
});
/**
* test_author_windy
**/
it("defaultValue_not_allowEdit", () => {
it("defaultValue_not_allowEdit", function () {
var tree = BI.Test.createWidget({
type: "bi.multilayer_single_tree_combo",
width: 300,
@ -52,14 +52,14 @@ describe("multilayer_single_tree", () => {
items: BI.deepClone(items),
value: "第二级文件1"
});
expect(tree.getValue()).toBe("第二级文件1");
expect(tree.getValue()).to.equal("第二级文件1");
tree.destroy();
});
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var tree = BI.Test.createWidget({
type: "bi.multilayer_single_tree_combo",
width: 300,
@ -70,7 +70,7 @@ describe("multilayer_single_tree", () => {
tree.element.find(".bi-multi-layer-single-tree-trigger").click();
BI.nextTick(function () {
tree.element.find(".bi-multilayer-single-tree-mid-tree-leaf-item").click();
expect(tree.getValue()[0]).toBe("第二级文件1");
expect(tree.getValue()[0]).to.equal("第二级文件1");
tree.destroy();
done();
});
@ -79,7 +79,7 @@ describe("multilayer_single_tree", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var tree = BI.Test.createWidget({
type: "bi.multilayer_single_tree_combo",
width: 300,
@ -94,7 +94,7 @@ describe("multilayer_single_tree", () => {
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-single-tree-trigger .bi-input"), "2", 50, function () {
BI.nextTick(function () {
tree.element.find(".bi-multilayer-single-tree-mid-tree-leaf-item").click();
expect(tree.getValue()[0]).toBe("第二级文件1");
expect(tree.getValue()[0]).to.equal("第二级文件1");
tree.destroy();
done();
});
@ -106,7 +106,7 @@ describe("multilayer_single_tree", () => {
/**
* test_author_windy
**/
it("新增值", done => {
it("新增值", function (done) {
var tree = BI.Test.createWidget({
type: "bi.multilayer_single_tree_combo",
width: 300,
@ -122,7 +122,7 @@ describe("multilayer_single_tree", () => {
BI.Test.triggerKeyDown(tree.element.find(".bi-multi-layer-single-tree-trigger .bi-input"), "z", 50, function () {
BI.nextTick(function () {
tree.element.find(".bi-text-button:contains(+点击新增\"z\")").click();
expect(tree.getValue()[0]).toBe("z");
expect(tree.getValue()[0]).to.equal("z");
tree.destroy();
done();
});

24
packages/fineui/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js

@ -6,7 +6,7 @@
describe("multi_select_no_bar_series", () => {
let _getItemsByTimes, _itemsCreator, itemSelectorGetter, searchItemSelectorGetter, _hasNextByTimes, items;
beforeAll(() => {
before(() => {
_getItemsByTimes = function (items, times) {
const res = [];
for (let i = (times - 1) * 100; items[i] && i < times * 100; i++) {
@ -77,7 +77,7 @@ describe("multi_select_no_bar_series", () => {
itemsCreator: _itemsCreator,
});
widget.setValue([1, 2]);
expect(widget.getValue()).toEqual([1, 2]);
expect(widget.getValue()).to.deep.equal([1, 2]);
widget.destroy();
});
@ -91,7 +91,7 @@ describe("multi_select_no_bar_series", () => {
itemsCreator: _itemsCreator,
value: [1, 2, 3],
});
expect(widget.getValue()).toEqual([1, 2, 3]);
expect(widget.getValue()).to.deep.equal([1, 2, 3]);
widget.destroy();
});
@ -116,7 +116,7 @@ describe("multi_select_no_bar_series", () => {
BI.each(itemSelectorGetter([1, 2]), (idx, selector) => {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual([2]);
expect(widget.getValue()).to.deep.equal([2]);
widget.destroy();
done();
}, 300);
@ -141,7 +141,7 @@ describe("multi_select_no_bar_series", () => {
BI.each(searchItemSelectorGetter([1, 2]), (idx, selector) => {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual([2, 12]);
expect(widget.getValue()).to.deep.equal([2, 12]);
widget.destroy();
done();
});
@ -168,7 +168,7 @@ describe("multi_select_no_bar_series", () => {
BI.nextTick(() => {
widget.element.find(".bi-multi-select-check-selected-button").click();
BI.delay(() => {
expect(widget.element.find(".display-list-item").length).toBe(2);
expect(widget.element.find(".display-list-item").length).to.equal(2);
widget.destroy();
done();
}, 300);
@ -185,7 +185,7 @@ describe("multi_select_no_bar_series", () => {
itemsCreator: _itemsCreator,
});
widget.setValue([1, 2]);
expect(widget.getValue()).toEqual([1, 2]);
expect(widget.getValue()).to.deep.equal([1, 2]);
widget.destroy();
});
@ -199,7 +199,7 @@ describe("multi_select_no_bar_series", () => {
itemsCreator: _itemsCreator,
value: [1, 2, 3],
});
expect(widget.getValue()).toEqual([1, 2, 3]);
expect(widget.getValue()).to.deep.equal([1, 2, 3]);
widget.destroy();
});
@ -225,7 +225,7 @@ describe("multi_select_no_bar_series", () => {
BI.each(itemSelectorGetter([1, 2]), (idx, selector) => {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual([2]);
expect(widget.getValue()).to.deep.equal([2]);
widget.destroy();
done();
}, 300);
@ -250,7 +250,7 @@ describe("multi_select_no_bar_series", () => {
BI.each(searchItemSelectorGetter([1, 2]), (idx, selector) => {
widget.element.find(selector).click();
});
expect(widget.getValue()).toEqual([2, 12]);
expect(widget.getValue()).to.deep.equal([2, 12]);
widget.destroy();
done();
});
@ -275,7 +275,7 @@ describe("multi_select_no_bar_series", () => {
BI.Test.triggerKeyDown(widget.element.find(".bi-multi-select-trigger .bi-input"), "z", 50, () => {
BI.nextTick(() => {
widget.element.find(".bi-text-button:contains(+点击新增\"z\")").click();
expect(widget.getValue()).toEqual(["z"]);
expect(widget.getValue()).to.deep.equal(["z"]);
widget.destroy();
done();
});
@ -300,7 +300,7 @@ describe("multi_select_no_bar_series", () => {
BI.nextTick(() => {
widget.element.find(".bi-multi-select-check-selected-button").click();
BI.delay(() => {
expect(widget.element.find(".display-list-item").length).toBe(2);
expect(widget.element.find(".display-list-item").length).to.equal(2);
widget.destroy();
done();
}, 300);

6
packages/fineui/src/widget/multiselect/loader.js

@ -74,7 +74,7 @@ export class MultiSelectInnerLoader extends Widget {
this.next.setLoaded();
const items = this._composeItems(this.cachItems.slice(0, 100));
this.cachItems = this.cachItems.slice(100);
this.addItems(items);
this.addItems(items, true);
return;
}
@ -183,7 +183,7 @@ export class MultiSelectInnerLoader extends Widget {
]);
}
addItems(items) {
addItems(items, isFromCache = false) {
this.count += items.length;
if (isObject(this.next)) {
if (this.hasNext()) {
@ -194,7 +194,7 @@ export class MultiSelectInnerLoader extends Widget {
}
}
// cacheGroup渲染的是全量的,如果这次加载更多add的items是从cacheItems里面拿的,那不用再add了
if (this.cachItems.length > 0) {
if (isFromCache) {
this.button_group.addItems(...arguments);
return;
}

5
packages/fineui/src/widget/multiselect/multiselect.insert.combo.js

@ -33,6 +33,7 @@ import {
SIZE_CONSANTS,
BlankSplitChar,
size,
PasteLimit,
} from "@/core";
import { Single, Combo, Msg } from "@/base";
import { MultiSelectBar, TriggerIconButton } from "@/case";
@ -146,8 +147,8 @@ export class MultiSelectInsertCombo extends Single {
}
self._dataChange = true;
});
this.getSearcher().getKeywordsLength() > 2000 &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
this.getSearcher().getKeywordsLength() > PasteLimit &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit));
}
self.fireEvent(MultiSelectInsertCombo.EVENT_SEARCHING);
});

7
packages/fineui/src/widget/multiselect/multiselect.insert.combo.nobar.js

@ -29,7 +29,8 @@ import {
pushDistinct,
Selection,
BlankSplitChar,
SIZE_CONSANTS
SIZE_CONSANTS,
PasteLimit,
} from "@/core";
import { Single, Combo, Msg } from "@/base";
import { MultiSelectInsertTrigger } from "./multiselect.insert.trigger";
@ -134,8 +135,8 @@ export class MultiSelectInsertNoBarCombo extends Single {
}
self._dataChange = true;
});
this.getSearcher().getKeywordsLength() > 2000 &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Too_Much_Value_Get_Two_Thousand"));
this.getSearcher().getKeywordsLength() > PasteLimit &&
Msg.alert(i18nText("BI-Basic_Prompt"), i18nText("BI-Basic_Paste_Too_Much_Value", PasteLimit));
}
});

7
packages/fineui/src/widget/multiselect/trigger/searcher.multiselect.insert.js

@ -10,7 +10,8 @@ import {
size,
each,
BlankSplitChar,
Selection
Selection,
PasteLimit,
} from "@/core";
import { MultiSelectEditor } from "./editor.multiselect";
import { Searcher } from "@/base";
@ -123,7 +124,7 @@ export class MultiSelectInsertSearcher extends Widget {
const keywords = this.getKeywords();
self.fireEvent(
MultiSelectInsertSearcher.EVENT_SEARCHING,
keywords.length > 2000 ? keywords.slice(0, 2000).concat([BlankSplitChar]) : keywords.slice(0, 2000)
keywords.length > PasteLimit ? keywords.slice(0, PasteLimit).concat([BlankSplitChar]) : keywords.slice(0, PasteLimit)
);
});
if (isNotNull(o.value)) {
@ -150,7 +151,7 @@ export class MultiSelectInsertSearcher extends Widget {
}
getKeyword() {
let keywords = this.editor.getKeywords().slice(0, 2000);
let keywords = this.editor.getKeywords().slice(0, PasteLimit);
if (keywords[keywords.length - 1] === BlankSplitChar) {
keywords = keywords.slice(0, keywords.length - 1);
}

2
packages/fineui/src/widget/multiselect/trigger/switcher.checkselected.js

@ -10,6 +10,7 @@ export class MultiSelectCheckSelectedSwitcher extends Widget {
static EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE";
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
static EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
static EVENT_TRIGGER_COMBO = "EVENT_TRIGGER_COMBO";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
@ -48,6 +49,7 @@ export class MultiSelectCheckSelectedSwitcher extends Widget {
itemsCreator: o.itemsCreator,
onClickContinueSelect() {
self.switcher.hideView();
self.fireEvent(MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_COMBO);
},
ref(_ref) {
self.checkPane = _ref;

14
packages/fineui/src/widget/multiselectlist/__test__/multiselect.insert.nobar.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2020/6/2
*/
describe("multi_list_insert_no_bar_pane", () => {
describe("multi_list_insert_no_bar_pane", function () {
var items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
@ -28,7 +28,7 @@ describe("multi_list_insert_no_bar_pane", () => {
/**
* test_author_windy
**/
it("setValue", () => {
it("setValue", function () {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_no_bar_list",
width: 220,
@ -40,7 +40,7 @@ describe("multi_list_insert_no_bar_pane", () => {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).toEqual({
expect(widget.getValue()).to.deep.equal({
type: 1,
value: [1, 2]
});
@ -50,7 +50,7 @@ describe("multi_list_insert_no_bar_pane", () => {
/**
* test_author_windy
**/
it("点选选值", done => {
it("点选选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_no_bar_list",
width: 220,
@ -74,7 +74,7 @@ describe("multi_list_insert_no_bar_pane", () => {
});
var value = widget.getValue();
delete value.assist;
expect(value).toEqual([]);
expect(value).to.deep.equal([]);
widget.destroy();
done();
}, 300);
@ -84,7 +84,7 @@ describe("multi_list_insert_no_bar_pane", () => {
/**
* test_author_windy
**/
it("搜索选值", done => {
it("搜索选值", function (done) {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_no_bar_list",
width: 220,
@ -120,7 +120,7 @@ describe("multi_list_insert_no_bar_pane", () => {
});
var value = widget.getValue();
delete value.assist;
expect(value).toEqual(["2", "12"]);
expect(value).to.deep.equal(["2", "12"]);
widget.destroy();
done();
});

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save