Compare commits

..

4 Commits

Author SHA1 Message Date
Zoupers.Zou-邹清原 4fc41d599e Pull request #3747: 重新打通单测流程 && 将mocha单测用例转为jest单测 6 months ago
Zoupers cfe8ce1d6c 修复单测问题 && 优化tsconfig.json配置 6 months ago
Zoupers d8448dcd38 jest流程打通,mocha用例转为jest用例,但是karma配置暂时还保留 6 months ago
Zoupers feca9ef16b karma单测配置 6 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. 9
      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_host=https://npm.taobao.org/mirrors PUPPETEER_DOWNLOAD_BASE_URL=https://cdn.npmmirror.com/binaries/chrome-for-testing
@fui:registry=https://npm.fineres.com/ @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 = { window.BI.i18n = {
'BI-Multi_Date_Quarter_End': '季度末', 'BI-Multi_Date_Quarter_End': '季度末',
'BI-Multi_Date_Month_Begin': '月初', 'BI-Multi_Date_Month_Begin': '月初',

2
packages/fineui/.gitignore vendored

@ -0,0 +1,2 @@
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-border-disabled-radio": "rgba(9, 30, 64, 0.19)",
"@color-bi-background-active-radio-content": "#2C60DB", "@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-border-checkbox-theme-dark": "rgba(255, 255, 255, 0.37)", "@color-bi-border-checkbox-theme-dark": "rgba(255, 255, 255, 0.37)",
"@color-bi-border-hover-active-radio-theme-dark": "#497FFD", "@color-bi-border-hover-active-radio-theme-dark": "#3869DC",
"@color-bi-background-active-radio-content-theme-dark": "#497FFD", "@color-bi-background-active-radio-content-theme-dark": "#3869DC",
"@color-bi-background-disabled-active-radio-content": "#FFFFFF", "@color-bi-background-disabled-active-radio-content": "#FFFFFF",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479", "@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF", "@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
@ -48,17 +48,5 @@
"@font-solid-bottom": "e905", "@font-solid-bottom": "e905",
"@font-solid-right": "e906", "@font-solid-right": "e906",
"@font-dot": "e762", "@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.1 MiB

After

Width:  |  Height:  |  Size: 1.0 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

@ -0,0 +1,51 @@
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

@ -0,0 +1,167 @@
// 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,7 +30,9 @@
"tsc": "tsc", "tsc": "tsc",
"link": "pnpm link --global", "link": "pnpm link --global",
"build:biCss": "cross-env LESS_CONFIG_PATH=bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css", "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" "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"
}, },
"files": [ "files": [
"dist", "dist",
@ -57,7 +59,37 @@
"jquery": "3.6.3" "jquery": "3.6.3"
}, },
"devDependencies": { "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", "core-js": "^3.30.2",
"cross-env": "^7.0.3" "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"
} }
} }

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

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

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

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

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

@ -3,11 +3,11 @@
* @version 2.0 * @version 2.0
* Created by windy on 2020/3/20 * Created by windy on 2020/3/20
*/ */
describe("GridTest", function () { describe("GridTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("grid", function () { it("grid", () => {
var items = []; var items = [];
var rowCount = 1000, columnCount = 100; var rowCount = 1000, columnCount = 100;
for (var i = 0; i < rowCount; i++) { 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 * Created by windy on 2020/3/17
*/ */
describe("PopoverTest", function () { describe("PopoverTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("BarPopover", function (done) { it("BarPopover", done => {
var id = BI.UUID(); var id = BI.UUID();
BI.Popovers.remove(id); BI.Popovers.remove(id);
BI.Popovers.create(id, { BI.Popovers.create(id, {
@ -24,7 +24,7 @@ describe("PopoverTest", function () {
}, },
}).open(id); }).open(id);
BI.delay(function () { BI.delay(function () {
expect(BI.Widget._renderEngine.createElement("body").find(".bi-popup-view .bi-z-index-mask").length).to.equal(1); expect(BI.Widget._renderEngine.createElement("body").find(".bi-popup-view .bi-z-index-mask").length).toBe(1);
BI.Popovers.remove(id); BI.Popovers.remove(id);
done(); done();
}, 100); }, 100);

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

@ -5,11 +5,11 @@
*/ */
// TODO 展示类控件测什么没想好标记一下 // TODO 展示类控件测什么没想好标记一下
describe("ListView && VirtualList", function () { describe("ListView && VirtualList", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("ListView初始化测试", function () { it("ListView初始化测试", () => {
var a = BI.Test.createWidget({ var a = BI.Test.createWidget({
type: "bi.list_view", type: "bi.list_view",
el: { el: {
@ -31,7 +31,7 @@ describe("ListView && VirtualList", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("VirtualList初始化测试", function () { it("VirtualList初始化测试", () => {
var a = BI.Test.createWidget({ var a = BI.Test.createWidget({
type: "bi.virtual_list", type: "bi.virtual_list",
items: BI.map(BI.range(0, 100), function (i, item) { 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. * Created by windy on 2018/01/23.
*/ */
describe("TextTest", function () { describe("TextTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("setText", function () { it("setText", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
}); });
text.setText("AAA"); text.setText("AAA");
expect(text.element.text()).to.equal("AAA"); expect(text.element.text()).toBe("AAA");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("setStyle", function () { it("setStyle", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
}); });
text.setStyle({ "color": "red" }); text.setStyle({ "color": "red" });
expect(text.element.getStyle("color")).to.equal("rgb(255, 0, 0)"); expect(text.element.getStyle("color")).toBe("rgb(255, 0, 0)");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("高亮doHighlight", function () { it("高亮doHighlight", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "AAA", text: "AAA",
highLight: true, highLight: true,
}); });
expect(text.element.getStyle("color")).to.equal("rgb(54, 133, 242)"); expect(text.element.getStyle("color")).toBe("rgb(54, 133, 242)");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("标红doRedMark", function () { it("标红doRedMark", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是要标红的A", text: "我是要标红的A",
keyword: "A", keyword: "A",
}); });
expect(text.element.children(".bi-keyword-red-mark").length).to.not.equal(0); expect(text.element.children(".bi-keyword-red-mark").length).not.toBe(0);
text.destroy(); text.destroy();
}); });
@ -56,89 +56,89 @@ describe("TextTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("取消高亮undoHighlight", function () { it("取消高亮undoHighlight", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "AAA", text: "AAA",
highLight: true, highLight: true,
}); });
text.unHighLight(); text.unHighLight();
expect(text.element.getStyle("color")).to.not.equal("rgb(54, 133, 242)"); expect(text.element.getStyle("color")).not.toBe("rgb(54, 133, 242)");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("取消标红undoRedMark", function () { it("取消标红undoRedMark", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是要标红的A", text: "我是要标红的A",
keyword: "A", keyword: "A",
}); });
text.unRedMark(); text.unRedMark();
expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); expect(text.element.children(".bi-keyword-red-mark").length).toBe(0);
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("setValue", function () { it("setValue", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
value: "AAA", value: "AAA",
}); });
text.setValue("value"); text.setValue("value");
expect(text.element.text()).to.equal("value"); expect(text.element.text()).toBe("value");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("gap测试", function () { it("gap测试", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是要标红的A", text: "我是要标红的A",
vgap: 10, vgap: 10,
hgap: 10, hgap: 10,
}); });
expect(text.element.css("padding")).to.equal("10px"); expect(text.element.css("padding")).toBe("10px");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("空格测试", function () { it("空格测试", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是要标红的 A", text: "我是要标红的 A",
}); });
expect(text.element.text()).to.equal("我是要标红的 A"); expect(text.element.text()).toBe("我是要标红的 A");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("lineHeight和height", function () { it("lineHeight和height", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是A", text: "我是A",
lineHeight: 12, lineHeight: 12,
height: 24, height: 24,
}); });
expect(text.element.css("height")).to.equal("24px"); expect(text.element.css("height")).toBe("24px");
expect(text.element.css("line-height")).to.equal("12px"); expect(text.element.css("line-height")).toBe("12px");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("handler", function (done) { it("handler", done => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "我是A", text: "我是A",
@ -148,7 +148,7 @@ describe("TextTest", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
text.text.element.click(); text.text.element.click();
expect(text.text.element.text()).to.equal("handler"); expect(text.text.element.text()).toBe("handler");
text.destroy(); text.destroy();
done(); done();
}); });
@ -157,38 +157,38 @@ describe("TextTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("text的value属性", function () { it("text的value属性", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: "", text: "",
value: "aaaa", value: "aaaa",
}); });
expect(text.element.text()).to.equal(""); expect(text.element.text()).toBe("");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("text的value属性1", function () { it("text的value属性1", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
value: "aaaa", value: "aaaa",
}); });
expect(text.element.text()).to.equal("aaaa"); expect(text.element.text()).toBe("aaaa");
text.destroy(); text.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("text的value属性2", function () { it("text的value属性2", () => {
var text = BI.Test.createWidget({ var text = BI.Test.createWidget({
type: "bi.text", type: "bi.text",
text: null, text: null,
value: "aaaa", value: "aaaa",
}); });
expect(text.element.text()).to.equal(""); expect(text.element.text()).toBe("");
text.destroy(); text.destroy();
}); });
}); });

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

@ -1,23 +1,23 @@
/** /**
* Created by windy on 2018/01/23. * Created by windy on 2018/01/23.
*/ */
describe("ALinkTest", function () { describe("ALinkTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("A初始化测试", function () { it("A初始化测试", () => {
var a = BI.Test.createWidget({ var a = BI.Test.createWidget({
type: "bi.a", type: "bi.a",
text: "CCC", text: "CCC",
}); });
expect(a.element.is("a")).to.equal(true); expect(a.element.is("a")).toBe(true);
a.destroy(); a.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("A的el测试", function () { it("A的el测试", () => {
var a = BI.Test.createWidget({ var a = BI.Test.createWidget({
type: "bi.a", type: "bi.a",
text: "DDD", text: "DDD",
@ -25,7 +25,7 @@ describe("ALinkTest", function () {
type: "bi.label", type: "bi.label",
}, },
}); });
expect(a.element.is("a") && a.element.hasClass("bi-label")).to.equal(true); expect(a.element.is("a") && a.element.hasClass("bi-label")).toBe(true);
a.destroy(); 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. * Created by windy on 2018/01/23.
*/ */
describe("ButtonTest", function () { describe("ButtonTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("Click点击触发事件", function (done) { it("Click点击触发事件", done => {
var button = BI.Test.createWidget({ var button = BI.Test.createWidget({
type: "bi.button", type: "bi.button",
text: "CCC", text: "CCC",
@ -15,7 +15,7 @@ describe("ButtonTest", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
button.element.click(); button.element.click();
expect(button.element.children(".bi-text").text()).to.equal("click"); expect(button.element.children(".bi-text").text()).toBe("click");
button.destroy(); button.destroy();
done(); done();
}); });
@ -25,7 +25,7 @@ describe("ButtonTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("MouseDown触发事件", function (done) { it("MouseDown触发事件", done => {
var button = BI.Test.createWidget({ var button = BI.Test.createWidget({
type: "bi.button", type: "bi.button",
text: "CCC", text: "CCC",
@ -36,7 +36,7 @@ describe("ButtonTest", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
button.element.mousedown(); button.element.mousedown();
expect(button.element.children(".bi-text").text()).to.equal("click"); expect(button.element.children(".bi-text").text()).toBe("click");
button.destroy(); button.destroy();
done(); done();
}); });
@ -45,7 +45,7 @@ describe("ButtonTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("MouseUp触发事件", function (done) { it("MouseUp触发事件", done => {
var button = BI.Test.createWidget({ var button = BI.Test.createWidget({
type: "bi.button", type: "bi.button",
text: "CCC", text: "CCC",
@ -57,7 +57,7 @@ describe("ButtonTest", function () {
BI.nextTick(function () { BI.nextTick(function () {
button.element.mousedown(); button.element.mousedown();
button.element.mouseup(); button.element.mouseup();
expect(button.element.children(".bi-text").text()).to.equal("click"); expect(button.element.children(".bi-text").text()).toBe("click");
button.destroy(); button.destroy();
done(); done();
}); });
@ -66,7 +66,7 @@ describe("ButtonTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("doubleClick触发事件", function (done) { it("doubleClick触发事件", done => {
var button = BI.Test.createWidget({ var button = BI.Test.createWidget({
type: "bi.button", type: "bi.button",
text: "CCC", text: "CCC",
@ -77,7 +77,7 @@ describe("ButtonTest", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
button.element.dblclick(); button.element.dblclick();
expect(button.element.children(".bi-text").text()).to.equal("click"); expect(button.element.children(".bi-text").text()).toBe("click");
button.destroy(); button.destroy();
done(); done();
}); });
@ -86,7 +86,7 @@ describe("ButtonTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("LongClick触发事件", function (done) { it("LongClick触发事件", done => {
var clickNum = 0; var clickNum = 0;
var button = BI.Test.createWidget({ var button = BI.Test.createWidget({
type: "bi.button", type: "bi.button",
@ -102,7 +102,7 @@ describe("ButtonTest", function () {
BI.nextTick(function () { BI.nextTick(function () {
button.element.mousedown(); button.element.mousedown();
BI.delay(function () { BI.delay(function () {
expect(clickNum).to.equal(2); expect(clickNum).toBe(2);
button.destroy(); button.destroy();
done(); done();
}, 360); }, 360);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -3,19 +3,19 @@
* @version 2.0 * @version 2.0
* Created by windy on 2020/3/20 * Created by windy on 2020/3/20
*/ */
describe("FarbtasticTest", function () { describe("FarbtasticTest", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("Farbtastic", function () { it("Farbtastic", () => {
var a = BI.Test.createWidget({ var a = BI.Test.createWidget({
type: "bi.farbtastic", type: "bi.farbtastic",
height: 200, height: 200,
width: 200 width: 200
}); });
a.setValue("#d56c6c"); a.setValue("#d56c6c");
expect(a.getValue()).to.equal("#d56c6c"); expect(a.getValue()).toBe("#d56c6c");
a.destroy(); 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 * Created by windy on 2020/3/2
*/ */
describe("bubble_combo", function () { describe("bubble_combo", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("测试弹出收起", function (done) { it("测试弹出收起", done => {
var bubbleCombo = BI.Test.createWidget({ var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo", type: "bi.bubble_combo",
el: { el: {
@ -34,7 +34,7 @@ describe("bubble_combo", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click(); bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block"); expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).toBe("block");
bubbleCombo.destroy(); bubbleCombo.destroy();
done(); done();
}) })
@ -43,7 +43,7 @@ describe("bubble_combo", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("测试弹出收起", function (done) { it("测试弹出收起", done => {
var bubbleCombo = BI.Test.createWidget({ var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo", type: "bi.bubble_combo",
el: { el: {
@ -68,7 +68,7 @@ describe("bubble_combo", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click(); bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).to.equal("block"); expect(bubbleCombo.element.find(".bi-bubble-popup-view").css("display")).toBe("block");
bubbleCombo.destroy(); bubbleCombo.destroy();
done(); done();
}) })
@ -78,7 +78,7 @@ describe("bubble_combo", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("bubble_bar_popup_view", function (done) { it("bubble_bar_popup_view", done => {
var bubbleCombo = BI.Test.createWidget({ var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo", type: "bi.bubble_combo",
el: { el: {
@ -96,7 +96,7 @@ describe("bubble_combo", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click(); bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1); expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).toBe(1);
bubbleCombo.destroy(); bubbleCombo.destroy();
done(); done();
}) })
@ -106,7 +106,7 @@ describe("bubble_combo", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("text_bubble_bar_popup_view", function (done) { it("text_bubble_bar_popup_view", done => {
var bubbleCombo = BI.Test.createWidget({ var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo", type: "bi.bubble_combo",
el: { el: {
@ -124,7 +124,7 @@ describe("bubble_combo", function () {
}); });
BI.nextTick(function () { BI.nextTick(function () {
bubbleCombo.element.find(".bi-button").click(); bubbleCombo.element.find(".bi-button").click();
expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).to.equal(1); expect(bubbleCombo.element.find(".bi-text:contains(确定)").length).toBe(1);
bubbleCombo.destroy(); bubbleCombo.destroy();
done(); done();
}) })

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,9 +1,9 @@
/** /**
* Created by windy on 2018/01/23. * Created by windy on 2018/01/23.
*/ */
describe("aliasFunctionTest", function () { describe("aliasFunctionTest", () => {
before(function () { beforeAll(() => {
BI.specialCharsMap = { BI.specialCharsMap = {
"\\\\": "0", "\\\\": "0",
".": "1", ".": "1",
@ -14,39 +14,39 @@ describe("aliasFunctionTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("htmlEncode和htmlDecode", function () { it("htmlEncode和htmlDecode", () => {
var targetString = "<a>1 2&</a>"; var targetString = "<a>1 2&</a>";
var encodeString = BI.htmlEncode(targetString); var encodeString = BI.htmlEncode(targetString);
expect(encodeString).to.equal("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;"); expect(encodeString).toBe("&lt;a&gt;1&nbsp;2&amp;&lt;/a&gt;");
expect(BI.htmlDecode(encodeString)).to.equal(targetString); expect(BI.htmlDecode(encodeString)).toBe(targetString);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("encodeURIComponent和decodeURIComponent", function () { it("encodeURIComponent和decodeURIComponent", () => {
var targetString = "tableName./\\"; var targetString = "tableName./\\";
var encodeString = BI.encodeURIComponent(targetString); var encodeString = BI.encodeURIComponent(targetString);
expect(encodeString).to.equal("tableName120"); expect(encodeString).toBe("tableName120");
expect(BI.decodeURIComponent(encodeString)).to.equal(targetString); expect(BI.decodeURIComponent(encodeString)).toBe(targetString);
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("cjkEncode 和 cjkDecode ", function () { it("cjkEncode 和 cjkDecode ", () => {
expect(BI.cjkEncode("测试")).to.eql("[6d4b][8bd5]"); expect(BI.cjkEncode("测试")).toEqual("[6d4b][8bd5]");
expect(BI.cjkEncode(123)).to.eql(123); expect(BI.cjkEncode(123)).toEqual(123);
expect(BI.cjkDecode("[6d4b][8bd5]")).to.eql("测试"); expect(BI.cjkDecode("[6d4b][8bd5]")).toEqual("测试");
expect(BI.cjkDecode("6d4b 8bd5")).to.eql("6d4b 8bd5"); expect(BI.cjkDecode("6d4b 8bd5")).toEqual("6d4b 8bd5");
expect(BI.cjkDecode(null)).to.eql(""); expect(BI.cjkDecode(null)).toEqual("");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("jsonEncode 和 jsonDecode", function () { it("jsonEncode 和 jsonDecode", () => {
var jsonString = '{"a":1,"b":"测\\"试","c":[5,6],"d":null,"e":false}'; var jsonString = '{"a":1,"b":"测\\"试","c":[5,6],"d":null,"e":false}';
var obj = { var obj = {
a: 1, a: 1,
@ -55,81 +55,81 @@ describe("aliasFunctionTest", function () {
d: null, d: null,
e: false, e: false,
}; };
expect(BI.jsonEncode(obj)).to.eql(jsonString); expect(BI.jsonEncode(obj)).toEqual(jsonString);
expect(BI.jsonDecode(jsonString)).to.eql(obj); expect(BI.jsonDecode(jsonString)).toEqual(obj);
expect(BI.jsonEncode({ a: function(){return 1} })).to.eql('{"a":function(){return 1}}'); expect(BI.jsonEncode({ a: function(){return 1} })).toEqual('{"a":function(){return 1}}');
expect(BI.jsonDecode("{__time__:878313600000}")).to.eql(new Date(878313600000)); expect(BI.jsonDecode("{__time__:878313600000}")).toEqual(new Date(878313600000));
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("getEncodeURL", function () { it("getEncodeURL", () => {
expect(BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"})).to.eql("design/A/a"); expect(BI.getEncodeURL("design/{tableName}/{fieldName}",{tableName: "A", fieldName: "a"})).toEqual("design/A/a");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("contentFormat", function () { it("contentFormat", () => {
expect(BI.contentFormat("", "DTyyyy-MM-dd")).to.eql(""); expect(BI.contentFormat("", "DTyyyy-MM-dd")).toEqual("");
expect(BI.contentFormat(878313600000, "")).to.eql("878313600000"); expect(BI.contentFormat(878313600000, "")).toEqual("878313600000");
expect(BI.contentFormat("test", "T")).to.eql("test"); expect(BI.contentFormat("test", "T")).toEqual("test");
expect(BI.contentFormat(878313600000, "E")).to.eql("9E11"); expect(BI.contentFormat(878313600000, "E")).toEqual("9E11");
expect(BI.contentFormat(1000.23456789, "0,000.####")).to.eql("1,000.2346"); expect(BI.contentFormat(1000.23456789, "0,000.####")).toEqual("1,000.2346");
expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).to.eql("1997-11-09"); expect(BI.contentFormat(879051600000, "DTyyyy-MM-dd")).toEqual("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")).toEqual("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, "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")).to.eql("97-11-9 13:0:0 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")).to.eql("97-11-9 12:0:0 pm"); expect(BI.contentFormat(879048000000, "DTyyy-M-d h:m:s a")).toEqual("97-11-9 12:0:0 pm");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("parseFmt", function () { it("parseFmt", () => {
expect(BI.parseFmt("yyyy-MM-dd HH:mm:ss")).to.eql("%Y-%X-%d %H:%M:%S"); 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")).to.eql("%Y-%X-%e %I:%M:%S"); expect(BI.parseFmt("yyyy-MM-d hh:mm:ss")).toEqual("%Y-%X-%e %I:%M:%S");
expect(BI.parseFmt("")).to.eql(""); expect(BI.parseFmt("")).toEqual("");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("str2Date", function () { it("str2Date", () => {
expect(BI.str2Date('2013-12-12', 'yyyy-MM-dd')).to.eql(new Date(2013, 11, 12)); expect(BI.str2Date('2013-12-12', 'yyyy-MM-dd')).toEqual(new Date(2013, 11, 12));
expect(BI.str2Date('2013-12-12', 123)).to.eql(null); expect(BI.str2Date('2013-12-12', 123)).toBeNull();
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("object2Number", function () { it("object2Number", () => {
expect(BI.object2Number(null)).to.eql(0); expect(BI.object2Number(null)).toEqual(0);
expect(BI.object2Number(123)).to.eql(123); expect(BI.object2Number(123)).toEqual(123);
expect(BI.object2Number("1.23")).to.eql(1.23); expect(BI.object2Number("1.23")).toEqual(1.23);
expect(BI.object2Number({ a: 2 })).to.eql(NaN); expect(BI.object2Number({ a: 2 })).toEqual(NaN);
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("object2Date", function () { it("object2Date", () => {
expect(BI.object2Date(null)).to.eql(new Date()); expect(BI.object2Date(null)).toEqual(new Date());
expect(BI.object2Date(new Date(1997, 10, 9))).to.eql(new Date(1997, 10, 9)); expect(BI.object2Date(new Date(1997, 10, 9))).toEqual(new Date(1997, 10, 9));
expect(BI.object2Date(879051600000)).to.eql(new Date(879051600000)); expect(BI.object2Date(879051600000)).toEqual(new Date(879051600000));
expect(BI.object2Time("1997-11-09")).to.eql(new Date(1997, 10, 9)); expect(BI.object2Time("1997-11-09")).toEqual(new Date(1997, 10, 9));
expect(BI.object2Date({ a: 2 })).to.eql(new Date()); expect(BI.object2Date({ a: 2 })).toEqual(new Date());
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("object2Time", function () { it("object2Time", () => {
expect(BI.object2Time(null)).to.eql(new Date()); expect(BI.object2Time(null)).toEqual(new Date());
expect(BI.object2Time(new Date(1997, 11, 9))).to.eql(new Date(1997, 11, 9)); expect(BI.object2Time(new Date(1997, 11, 9))).toEqual(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("1997-11-09 13:00:00")).toEqual(new Date(1997, 10, 9, 13, 0, 0));
expect(BI.object2Time("13:00:00")).to.eql(new Date(1970, 0, 1, 13, 0, 0)); expect(BI.object2Time("13:00:00")).toEqual(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. * Created by windy on 2018/01/24.
*/ */
describe("baseFunctionTest", function () { describe("baseFunctionTest", () => {
before(function () { beforeAll(() => {
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("formatEl和stripEL", function () { it("formatEl和stripEL", () => {
var obj1 = { var obj1 = {
type: "a", type: "a",
pro: {}, pro: {},
@ -24,53 +24,53 @@ describe("baseFunctionTest", function () {
items: [] items: []
} }
}; };
expect(BI.formatEL(obj1)).to.deep.equal(obj2); expect(BI.formatEL(obj1)).toEqual(obj2);
expect(BI.formatEL(obj2)).to.deep.equal(obj2); expect(BI.formatEL(obj2)).toEqual(obj2);
expect(BI.stripEL(obj1)).to.deep.equal(obj1); expect(BI.stripEL(obj1)).toEqual(obj1);
expect(BI.stripEL(obj2)).to.deep.equal(obj1); expect(BI.stripEL(obj2)).toEqual(obj1);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("encodeURIComponent和decodeURIComponent", function () { it("encodeURIComponent和decodeURIComponent", () => {
var targetString = "tableName./\\"; var targetString = "tableName./\\";
var encodeString = BI.encodeURIComponent(targetString); var encodeString = BI.encodeURIComponent(targetString);
expect(encodeString).to.equal("tableName120"); expect(encodeString).toBe("tableName120");
expect(BI.decodeURIComponent(encodeString)).to.equal(targetString); expect(BI.decodeURIComponent(encodeString)).toBe(targetString);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("count", function () { it("count", () => {
var a = []; var a = [];
expect(BI.count(1, 100)).to.equal(99); expect(BI.count(1, 100)).toBe(99);
BI.count(0, 100, function (v) { BI.count(0, 100, function (v) {
a[v] = 0; a[v] = 0;
}); });
expect(a.length).to.equal(100); expect(a.length).toBe(100);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("concat", function () { it("concat", () => {
expect(BI.concat([1], [2])).to.deep.equal([1, 2]); expect(BI.concat([1], [2])).toEqual([1, 2]);
expect(BI.concat(1, 2)).to.equal("12"); expect(BI.concat(1, 2)).toBe("12");
expect(BI.concat("1", "2")).to.equal("12"); expect(BI.concat("1", "2")).toBe("12");
expect(BI.concat({a: 1}, {b: 1})).to.deep.equal({a: 1, b: 1}); expect(BI.concat({a: 1}, {b: 1})).toEqual({a: 1, b: 1});
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("remove", function () { it("remove", () => {
var a = [1, 2, 3, 4, 5, 6]; var a = [1, 2, 3, 4, 5, 6];
BI.remove(a, function (i, v) { BI.remove(a, function (i, v) {
return v === 4; return v === 4;
}); });
expect(a).to.deep.equal([1, 2, 3, 5, 6]); expect(a).toEqual([1, 2, 3, 5, 6]);
var b = { var b = {
a: 1, a: 1,
b: 2 b: 2
@ -78,7 +78,7 @@ describe("baseFunctionTest", function () {
BI.remove(b, function (key) { BI.remove(b, function (key) {
return key === "a"; return key === "a";
}); });
expect(b).to.deep.equal({ expect(b).toEqual({
b: 2 b: 2
}); });
}); });
@ -86,16 +86,16 @@ describe("baseFunctionTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("removeAt", function () { it("removeAt", () => {
var a = [1, 2, 3, 4, 5, 6, 7, 8, 9]; var a = [1, 2, 3, 4, 5, 6, 7, 8, 9];
BI.removeAt(a, 2); BI.removeAt(a, 2);
expect(a).to.deep.equal([1, 2, 4, 5, 6, 7, 8, 9]); expect(a).toEqual([1, 2, 4, 5, 6, 7, 8, 9]);
var b = { var b = {
a: 1, a: 1,
b: 2 b: 2
}; };
BI.removeAt(b, "a"); BI.removeAt(b, "a");
expect(b).to.deep.equal({ expect(b).toEqual({
b: 2 b: 2
}); });
}); });
@ -103,27 +103,27 @@ describe("baseFunctionTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("makeArray", function () { it("makeArray", () => {
var a = BI.makeArray(2, 1); var a = BI.makeArray(2, 1);
expect(a).to.deep.equal([1, 1]); expect(a).toEqual([1, 1]);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("concat-string", function () { it("concat-string", () => {
// concat-string // concat-string
expect(BI.concat("a", "b", "c")).to.equal("abc"); expect(BI.concat("a", "b", "c")).toBe("abc");
// concat-array // concat-array
expect(BI.concat([1], [2], [3])).to.deep.equal([1, 2, 3]); expect(BI.concat([1], [2], [3])).toEqual([1, 2, 3]);
// concat-object-array // concat-object-array
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}]); 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}]);
// concat-object // concat-object
expect(BI.concat({a: 1}, {b: 2}, {c: 3})).to.deep.equal({ expect(BI.concat({a: 1}, {b: 2}, {c: 3})).toEqual({
a: 1, a: 1,
b: 2, b: 2,
c: 3 c: 3
@ -133,11 +133,11 @@ describe("baseFunctionTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("assert-warning", function () { it("assert-warning", () => {
expect(BI.assert("a", "a")).to.equal(true); expect(BI.assert("a", "a")).toBe(true);
expect(BI.assert("a", function (v) { expect(BI.assert("a", function (v) {
return v === "a"; return v === "a";
})).to.equal(true); })).toBe(true);
var test = ""; var test = "";
try { try {
BI.assert("a", function (v) { BI.assert("a", function (v) {
@ -146,13 +146,13 @@ describe("baseFunctionTest", function () {
} catch (e) { } catch (e) {
test = true; test = true;
} }
expect(test).to.equal(true); expect(test).toBe(true);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("packageItems", function () { it("packageItems", () => {
expect(BI.packageItems([{ expect(BI.packageItems([{
type: "a", type: "a",
text: "b" text: "b"
@ -163,7 +163,7 @@ describe("baseFunctionTest", function () {
type: "bi.vertical" type: "bi.vertical"
}, { }, {
type: "bi.center_adapt" type: "bi.center_adapt"
}])).to.deep.equal([{ }])).toEqual([{
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
el: { el: {
@ -195,29 +195,29 @@ describe("baseFunctionTest", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("inverse", function () { it("inverse", () => {
expect(BI.inverse(7, 1)).to.equal(6); expect(BI.inverse(7, 1)).toBe(6);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("key", function () { it("key", () => {
var a = { var a = {
c: 1, c: 1,
d: 2 d: 2
}; };
expect(BI.firstKey(a)).to.equal("c"); expect(BI.firstKey(a)).toBe("c");
expect(BI.lastKey(a)).to.equal("d"); expect(BI.lastKey(a)).toBe("d");
expect(BI.firstObject(a)).to.equal(1); expect(BI.firstObject(a)).toBe(1);
expect(BI.lastObject(a)).to.equal(2); expect(BI.lastObject(a)).toBe(2);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("back", function () { it("back", () => {
var a = [{ var a = [{
c: 1, c: 1,
d: 2 d: 2
@ -232,147 +232,147 @@ describe("baseFunctionTest", function () {
BI.backEach(a, function (idx, v) { BI.backEach(a, function (idx, v) {
c.push(v.d); c.push(v.d);
}); });
expect(c).to.deep.equal([6, 4, 2]); expect(c).toEqual([6, 4, 2]);
expect(BI.backEvery(a, function (idx, v) { expect(BI.backEvery(a, function (idx, v) {
return v.c = 1; return v.c = 1;
})).to.equal(true); })).toBe(true);
expect(BI.backFindKey({ expect(BI.backFindKey({
c: 5, c: 5,
d: 6 d: 6
}, function (value, key) { }, function (value, key) {
return key === "c"; return key === "c";
})).to.equal("c"); })).toBe("c");
expect(BI.backFind({ expect(BI.backFind({
c: 5, c: 5,
d: 6 d: 6
}, function (v, key) { }, function (v, key) {
return v === 5; return v === 5;
})).to.deep.equal(5); })).toEqual(5);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("others", function () { it("others", () => {
expect(BI.abc2Int("B")).to.equal(2); expect(BI.abc2Int("B")).toBe(2);
expect(BI.int2Abc(2)).to.equal("B"); expect(BI.int2Abc(2)).toBe("B");
expect(BI.has({a: "1", b: "2"}, "a")).to.equal(true); expect(BI.has({a: "1", b: "2"}, "a")).toBe(true);
expect(Object.isFrozen(BI.freeze({a: "1", b: "2"}))).to.equal(true); expect(Object.isFrozen(BI.freeze({a: "1", b: "2"}))).toBe(true);
expect(BI.isCapitalEqual("A", "a")).to.equal(true); expect(BI.isCapitalEqual("A", "a")).toBe(true);
expect(BI.isEmptyString("a")).to.equal(false); expect(BI.isEmptyString("a")).toBe(false);
expect(BI.isNotEmptyString("a")).to.equal(true); expect(BI.isNotEmptyString("a")).toBe(true);
expect(BI.isWindow("a")).to.equal(false); expect(BI.isWindow("a")).toBe(false);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("deepFunc", function () { it("deepFunc", () => {
expect(BI.isDeepMatch({b: {c: {e: 3}}, d:2}, {b: {c: {e: 3}}, d:2})).to.equal(true); 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})).to.equal(2); expect(BI.deepIndexOf([{a: 1}, {b: 2}, {c: 3}], {c: 3})).toBe(2);
var remove = [{a: 1}, {b: 2}, {c: 3}]; var remove = [{a: 1}, {b: 2}, {c: 3}];
BI.deepRemove(remove, {c: 3}); BI.deepRemove(remove, {c: 3});
expect(remove).to.deep.equal([{a: 1}, {b: 2}]); expect(remove).toEqual([{a: 1}, {b: 2}]);
expect(BI.deepWithout([{a: 1}, {b: 2}, {c: 3}], {c: 3})).to.deep.equal([{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}])).to.deep.equal([{c: 3}, {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})).to.deep.equal(["b", "c"]); expect(BI.deepDiff({a: 1, b: 2}, {a: 1, c: 2})).toEqual(["b", "c"]);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("number", function () { it("number", () => {
expect(BI.parseSafeInt(9007199254740992)).to.equal(9007199254740991); expect(BI.parseSafeInt(9007199254740992)).toBe(9007199254740991);
expect(BI.isNegativeInteger(-3)).to.equal(true); expect(BI.isNegativeInteger(-3)).toBe(true);
expect(BI.isFloat(1.2)).to.equal(true); expect(BI.isFloat(1.2)).toBe(true);
expect(BI.isOdd(1)).to.equal(true); expect(BI.isOdd(1)).toBe(true);
expect(BI.isOdd("a")).to.equal(false); expect(BI.isOdd("a")).toBe(false);
expect(BI.isEven("a")).to.equal(false); expect(BI.isEven("a")).toBe(false);
expect(BI.isEven(2)).to.equal(true); expect(BI.isEven(2)).toBe(true);
expect(BI.sum([1, 2, 3, 4, 5, 6, 7])).to.equal(28); expect(BI.sum([1, 2, 3, 4, 5, 6, 7])).toBe(28);
expect(BI.average([1, 2, 3, 4, 5, 6, 7])).to.equal(4); expect(BI.average([1, 2, 3, 4, 5, 6, 7])).toBe(4);
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("string", function () { it("string", () => {
expect(BI.toLowerCase("AAAAA")).to.equal("aaaaa"); expect(BI.toLowerCase("AAAAA")).toBe("aaaaa");
expect(BI.isLiteral("AAAAA")).to.equal(false); expect(BI.isLiteral("AAAAA")).toBe(false);
expect(BI.stripQuotes("AAAAA")).to.equal("AAAAA"); expect(BI.stripQuotes("AAAAA")).toBe("AAAAA");
expect(BI.camelize("background-color")).to.equal("backgroundColor"); expect(BI.camelize("background-color")).toBe("backgroundColor");
expect(BI.escape("'\\")).to.equal("\\'\\\\"); expect(BI.escape("'\\")).toBe("\\'\\\\");
expect(BI.leftPad("123", 5, "0")).to.equal("00123"); expect(BI.leftPad("123", 5, "0")).toBe("00123");
const cls = "my-class", text = "Some text"; const cls = "my-class", text = "Some text";
expect(BI.format("<div class=\"{0}\">{1}</div>", cls, text)).to.equal("<div class=\"my-class\">Some text</div>"); expect(BI.format("<div class=\"{0}\">{1}</div>", cls, text)).toBe("<div class=\"my-class\">Some text</div>");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("checkDateVoid", function () { it("checkDateVoid", () => {
const minDate = "1900-02-02"; const minDate = "1900-02-02";
const maxDate = "2099-11-29"; const maxDate = "2099-11-29";
expect(BI.checkDateVoid(1899, 2, 2, minDate, maxDate)).to.eql(["y"]); expect(BI.checkDateVoid(1899, 2, 2, minDate, maxDate)).toEqual(["y"]);
expect(BI.checkDateVoid(2100, 2, 2, minDate, maxDate)).to.eql(["y", 1]); expect(BI.checkDateVoid(2100, 2, 2, minDate, maxDate)).toEqual(["y", 1]);
expect(BI.checkDateVoid(1900, 1, 2, minDate, maxDate)).to.eql(["m"]); expect(BI.checkDateVoid(1900, 1, 2, minDate, maxDate)).toEqual(["m"]);
expect(BI.checkDateVoid(2099, 12, 2, minDate, maxDate)).to.eql(["m", 1]); expect(BI.checkDateVoid(2099, 12, 2, minDate, maxDate)).toEqual(["m", 1]);
expect(BI.checkDateVoid(1900, 2, 1, minDate, maxDate)).to.eql(["d"]); expect(BI.checkDateVoid(1900, 2, 1, minDate, maxDate)).toEqual(["d"]);
expect(BI.checkDateVoid(2099, 11, 30, minDate, maxDate)).to.eql(["d", 1]); expect(BI.checkDateVoid(2099, 11, 30, minDate, maxDate)).toEqual(["d", 1]);
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("parseDateTime", function () { it("parseDateTime", () => {
expect(BI.parseDateTime("19971109", "%y%x%d")).to.eql(BI.getDate(1997, 10, 9)); expect(BI.parseDateTime("19971109", "%y%x%d")).toEqual(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("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")).to.eql(BI.getDate(1997, 10, 9, 15, 23, 23)); 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")).to.eql(BI.getDate(1997, 10, 9, 3, 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()).to.eql(BI.getDate().toString()); expect(BI.parseDateTime("a-b-c d:e:f", "%y-%x-%d %H:%M:%S").toString()).toEqual(BI.getDate().toString());
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("getDate 和 getTime", function () { it("getDate 和 getTime", () => {
expect(BI.getDate().toString()).to.eql(new Date().toString()); expect(BI.getDate().toString()).toEqual(new Date().toString());
expect(BI.getDate(1997)).to.eql(new Date(1997)); expect(BI.getDate(1997)).toEqual(new Date(1997));
expect(BI.getDate(1997, 10)).to.eql(new Date(1997, 10)); expect(BI.getDate(1997, 10)).toEqual(new Date(1997, 10));
expect(BI.getDate(1997, 10, 9)).to.eql(new Date(1997, 10, 9)); expect(BI.getDate(1997, 10, 9)).toEqual(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)).toEqual(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)).toEqual(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)).toEqual(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.getDate(1997, 10, 9, 12, 34, 56, 78)).toEqual(new Date(1997, 10, 9, 12, 34, 56, 78));
expect(BI.getTime()).to.eql(new Date().getTime()); expect(BI.getTime()).toEqual(new Date().getTime());
expect(BI.getTime(1997)).to.eql(new Date(1997).getTime()); expect(BI.getTime(1997)).toEqual(new Date(1997).getTime());
expect(BI.getTime(1997, 10)).to.eql(new Date(1997, 10).getTime()); expect(BI.getTime(1997, 10)).toEqual(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)).toEqual(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)).toEqual(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)).toEqual(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)).toEqual(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()); expect(BI.getTime(1997, 10, 9, 12, 34, 56, 78)).toEqual(new Date(1997, 10, 9, 12, 34, 56, 78).getTime());
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("数字相关方法补充", function () { it("数字相关方法补充", () => {
const iteratee = function (a, b) { const iteratee = function (a, b) {
return a > b ? a : b; return a > b ? a : b;
}; };
expect(BI.isNaturalNumber(1.25)).to.eql(false); expect(BI.isNaturalNumber(1.25)).toEqual(false);
expect(BI.isPositiveInteger(-15)).to.eql(false); expect(BI.isPositiveInteger(-15)).toEqual(false);
expect(BI.isNegativeInteger(+15)).to.eql(false); expect(BI.isNegativeInteger(+15)).toEqual(false);
expect(BI.isFloat(15)).to.eql(false); expect(BI.isFloat(15)).toEqual(false);
expect(BI.sum([4, 3, 2, 1], iteratee)).to.eql(12); expect(BI.sum([4, 3, 2, 1], iteratee)).toEqual(12);
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("集合相关方法补充", function () { it("集合相关方法补充", () => {
const array = [{ const array = [{
user: "barney", user: "barney",
active: true, active: true,
@ -383,39 +383,39 @@ describe("baseFunctionTest", function () {
user: "pebbles", user: "pebbles",
active: false, active: false,
}]; }];
expect(BI.backEvery(array, (index, value) => value.user === "kobi")).to.eql(false); expect(BI.backEvery(array, (index, value) => value.user === "kobi")).toEqual(false);
expect(BI.backFind(array, ["active", false])).to.eql(array[2]); expect(BI.backFind(array, ["active", false])).toEqual(array[2]);
expect(BI.abc2Int("ABCD999")).to.eql(0); expect(BI.abc2Int("ABCD999")).toEqual(0);
expect(BI.int2Abc(0)).to.eql(""); expect(BI.int2Abc(0)).toEqual("");
expect(BI.int2Abc(26)).to.eql("Z"); expect(BI.int2Abc(26)).toEqual("Z");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("数组相关方法补充", function () { it("数组相关方法补充", () => {
expect(BI.makeArrayByArray([], 5)).to.eql([]); expect(BI.makeArrayByArray([], 5)).toEqual([]);
expect(BI.uniq(null, true, (a, b) => a > b)).to.eql([]); expect(BI.uniq(null, true, (a, b) => a > b)).toEqual([]);
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("对象相关方法补充", function () { it("对象相关方法补充", () => {
var obj = { var obj = {
a: 1, a: 1,
b: 2, b: 2,
c: 3, c: 3,
}; };
expect(BI.has(obj, [])).to.eql(false); expect(BI.has(obj, [])).toEqual(false);
expect(BI.has(obj, ["a", "b"])).to.eql(true); expect(BI.has(obj, ["a", "b"])).toEqual(true);
expect(BI.freeze("1")).to.eql("1"); expect(BI.freeze("1")).toEqual("1");
}); });
/** /**
* test_author_kobi * test_author_kobi
**/ **/
it("deep方法补充", function () { it("deep方法补充", () => {
var obj = { var obj = {
a: 1, a: 1,
b: 2, b: 2,
@ -426,19 +426,19 @@ describe("baseFunctionTest", function () {
}, },
}, },
}; };
expect(BI.isDeepMatch(null, { d: 3, e: { f: 4 } })).to.eql(false); expect(BI.isDeepMatch(null, { d: 3, e: { f: 4 } })).toEqual(false);
expect(BI.isDeepMatch(obj, { d: 3, e: { f: 5 } })).to.eql(false); expect(BI.isDeepMatch(obj, { d: 3, e: { f: 5 } })).toEqual(false);
expect(BI.deepIndexOf(obj, { d: 3, e: { f: 5 } })).to.eql(-1); expect(BI.deepIndexOf(obj, { d: 3, e: { f: 5 } })).toEqual(-1);
expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).to.eql(true); expect(BI.deepRemove(obj, { d: 3, e: { f: 4 } })).toEqual(true);
expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).to.eql({ a: 1, b: 2 }); expect(BI.deepWithout(obj, { d: 3, e: { f: 4 } })).toEqual({ a: 1, b: 2 });
}); });
/** /**
* test_author_teller * test_author_teller
* 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒 * 只传一个时分秒format的时间进去后,在某些情况下,返回的是当前时间,然而想要的是返回正确的时分秒
*/ */
it("parseDateTime2", function () { it("parseDateTime2", () => {
var date = BI.getDate(); var date = BI.getDate();
expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).to.eql(BI.getDate(date.getFullYear(), date.getMonth(), 14, 14, 13, 16).getTime()); expect(BI.parseDateTime("14:13:16", "%H:%M:%S").getTime()).toEqual(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. * Created by guy on 2018/01/23.
*/ */
describe("contextTest", function () { describe("contextTest", () => {
before(function () { beforeAll(() => {
}); });
/** /**
* test_author_guy * test_author_guy
*/ */
it("context测试", function () { it("context测试", () => {
var ParentStore = BI.inherit(Fix.Model, { var ParentStore = BI.inherit(Fix.Model, {
state: function () { state: function () {
@ -70,9 +70,9 @@ describe("contextTest", function () {
type: "demo.demo" type: "demo.demo"
}); });
expect(demo.child.model.currContext).to.equal("默认context"); expect(demo.child.model.currContext).toBe("默认context");
demo.child.store.changeContext(); demo.child.store.changeContext();
expect(demo.model.context).to.equal("改变后的context"); expect(demo.model.context).toBe("改变后的context");
demo.destroy(); demo.destroy();
}); });
@ -80,7 +80,7 @@ describe("contextTest", function () {
/** /**
* test_author_guy * test_author_guy
*/ */
it("异步context测试-loader的populate测试", function (done) { it("异步context测试-loader的populate测试", done => {
var ParentStore = BI.inherit(Fix.Model, { var ParentStore = BI.inherit(Fix.Model, {
state: function () { state: function () {
@ -167,7 +167,7 @@ describe("contextTest", function () {
demo.child.populate(); demo.child.populate();
setTimeout(function () { setTimeout(function () {
expect(demo.labels[0].model.currContext).to.equal("默认context"); expect(demo.labels[0].model.currContext).toBe("默认context");
demo.destroy(); demo.destroy();
done(); done();
}, 0); }, 0);
@ -176,7 +176,7 @@ describe("contextTest", function () {
/** /**
* test_author_guy * test_author_guy
*/ */
it("异步context测试-beforeInit测试", function (done) { it("异步context测试-beforeInit测试", done => {
var ParentStore = BI.inherit(Fix.Model, { var ParentStore = BI.inherit(Fix.Model, {
state: function () { state: function () {
@ -242,7 +242,7 @@ describe("contextTest", function () {
}); });
setTimeout(function () { setTimeout(function () {
expect(demo.child.model.currContext).to.equal("默认context"); expect(demo.child.model.currContext).toBe("默认context");
demo.destroy(); demo.destroy();
done(); done();
}, 0); }, 0);
@ -251,7 +251,7 @@ describe("contextTest", function () {
/** /**
* test_author_guy * test_author_guy
*/ */
it("inject测试", function () { it("inject测试", () => {
var ParentStore = BI.inherit(Fix.Model, { var ParentStore = BI.inherit(Fix.Model, {
state: function () { state: function () {
@ -312,9 +312,9 @@ describe("contextTest", function () {
type: "demo.demo" type: "demo.demo"
}); });
expect(demo.child.model.currContext).to.equal("默认context"); expect(demo.child.model.currContext).toBe("默认context");
demo.child.store.changeContext(); demo.child.store.changeContext();
expect(demo.model.context).to.equal("默认context"); expect(demo.model.context).toBe("默认context");
demo.destroy(); demo.destroy();
}); });

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

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

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

@ -139,12 +139,3 @@ addDescriptor("nextTick", {
get: () => nextTick, get: () => nextTick,
set: setNextTick, 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)) || "", height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || "",
}; };
const { top, left, scaleY, scaleX } = getPositionRelativeContainingBlockRect(layout.element[0].parentNode || layout.element[0]); const { top, left, scaleY, scaleX } = getPositionRelativeContainingBlockRect(layout.element[0]);
css.top = (css.top - top) / scaleY; css.top = (css.top - top) / scaleY;
css.left = (css.left - left) / scaleX; 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. * Created by windy on 2018/01/23.
*/ */
describe("dateFunctionTest", function () { describe("dateFunctionTest", () => {
before(function () { beforeAll(() => {
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("getWeekNumber", function () { it("getWeekNumber", () => {
expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).to.equal("2004-53"); expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).toBe("2004-53");
expect(BI.print(BI.getDate(2005, 0, 2), "%Y-%W")).to.equal("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")).to.equal("2005-52"); expect(BI.print(BI.getDate(2005, 11, 31), "%Y-%W")).toBe("2005-52");
expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).to.equal("2007-01"); expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).toBe("2007-01");
expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).to.equal("2007-52"); expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).toBe("2007-52");
expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).to.equal("2008-01"); expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).toBe("2008-01");
expect(BI.print(BI.getDate(2008, 0, 1), "%Y-%W")).to.equal("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")).to.equal("2008-52"); expect(BI.print(BI.getDate(2008, 11, 28), "%Y-%W")).toBe("2008-52");
expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).to.equal("2009-01"); expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).toBe("2009-01");
expect(BI.print(BI.getDate(2008, 11, 30), "%Y-%W")).to.equal("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")).to.equal("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")).to.equal("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")).to.equal("2009-53"); expect(BI.print(BI.getDate(2009, 11, 31), "%Y-%W")).toBe("2009-53");
expect(BI.print(BI.getDate(2010, 0, 1), "%Y-%W")).to.equal("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")).to.equal("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")).to.equal("2009-53"); expect(BI.print(BI.getDate(2010, 0, 3), "%Y-%W")).toBe("2009-53");
}); });
}); });

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -5,11 +5,3 @@
border-color: @color-bi-border-active-chooser-show-button; 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,8 +578,6 @@ body .bi-button, #body .bi-button {
.bi-theme-dark, #body .bi-theme-dark { .bi-theme-dark, #body .bi-theme-dark {
.bi-button { .bi-button {
background-color: @color-bi-background-button-theme-dark;
&.button-ignore { &.button-ignore {
background-color: @color-bi-background-ignore-button-theme-dark; background-color: @color-bi-background-ignore-button-theme-dark;
@ -645,15 +643,5 @@ 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 { .bi-switch {
background-color: @color-bi-background-switch-theme-dark; background-color: @color-bi-background-switch-theme-dark;
&.active { &.active {
background-color: @color-bi-background-active-switch-theme-dark; background-color: @color-bi-background-active-switch;
} }
} }
} }

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

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

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

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

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

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

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

@ -62,7 +62,6 @@
// 按钮 // 按钮
@color-bi-border-button: @color-bi-border-highlight; @color-bi-border-button: @color-bi-border-highlight;
@color-bi-background-button: @color-bi-background-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-button: @color-bi-text;
@color-bi-text-common-clear-button: @color-bi-text-highlight; @color-bi-text-common-clear-button: @color-bi-text-highlight;
@color-bi-text-common-plain-button: @color-bi-text-highlight; @color-bi-text-common-plain-button: @color-bi-text-highlight;
@ -76,9 +75,7 @@
@color-bi-background-hover-common-ghost-button-theme-dark: @color-bi-background-default; @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: @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: @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-hover-common-light-button: @color-bi-background-light-blue;
@color-bi-background-active-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; @color-bi-background-hover-plain-button: @color-black-5;
@ -205,7 +202,6 @@
@color-bi-border-picker-button-mask: @color-bi-border-black; @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-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: @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; @color-bi-background-disabled-chooser-popup-mask: @color-bi-background-default;
// combo // combo
@color-bi-border-hover-combo: @color-bi-border-highlight; @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 * Created by windy on 2019/9/2
*/ */
describe("DatePane", function () { describe("DatePane", () => {
/** /**
* test_author_windy * test_author_windy
*/ */
it("defaultValue", function () { it("defaultValue", () => {
var datePane = BI.Test.createWidget({ var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane", type: "bi.dynamic_date_pane",
value: { value: {
@ -21,16 +21,16 @@ describe("DatePane", function () {
} }
}, },
}); });
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); 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()).to.equal("11"); expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
datePane.destroy(); datePane.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("setStaticValue", function () { it("setStaticValue", () => {
var datePane = BI.Test.createWidget({ var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane", type: "bi.dynamic_date_pane",
}); });
@ -42,16 +42,16 @@ describe("DatePane", function () {
day: 11 day: 11
} }
}); });
expect(datePane.element.find(".bi-year-combo .bi-label").text()).to.equal("2017"); expect(datePane.element.find(".bi-year-combo .bi-label").text()).toBe("2017");
expect(datePane.element.find(".bi-month-combo .bi-label").text()).to.equal("12"); 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()).to.equal("11"); expect(datePane.element.find(".bi-calendar .bi-list-item-select.active .bi-text").text()).toBe("11");
datePane.destroy(); datePane.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("setDynamicValue", function () { it("setDynamicValue", () => {
var datePane = BI.Test.createWidget({ var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane", type: "bi.dynamic_date_pane",
}); });
@ -65,7 +65,7 @@ describe("DatePane", function () {
day: 1 day: 1
} }
}); });
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
datePane.setValue({ datePane.setValue({
type: 2, type: 2,
@ -73,14 +73,14 @@ describe("DatePane", function () {
workDay: 1 workDay: 1
} }
}); });
expect(datePane.element.find(".bi-line-segment-button.active").text()).to.equal("动态时间"); expect(datePane.element.find(".bi-line-segment-button.active").text()).toBe("动态时间");
datePane.destroy(); datePane.destroy();
}); });
/** /**
* test_author_windy * test_author_windy
*/ */
it("getStaticValue", function (done) { it("getStaticValue", done => {
var datePane = BI.Test.createWidget({ var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane", type: "bi.dynamic_date_pane",
value: { value: {
@ -97,7 +97,7 @@ describe("DatePane", function () {
datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click(); datePane.element.find(".bi-month-combo .bi-list-item-select").get(2).click();
BI.nextTick(function () { BI.nextTick(function () {
datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click(); datePane.element.find(".bi-calendar:visible .bi-list-item-select :contains(27)").parent().click();
expect(datePane.getValue()).to.deep.equal({ expect(datePane.getValue()).toEqual({
type: 1, type: 1,
value: { value: {
year: 2019, year: 2019,
@ -114,7 +114,7 @@ describe("DatePane", function () {
/** /**
* test_author_windy * test_author_windy
*/ */
it("getDynamicValue", function (done) { it("getDynamicValue", done => {
var datePane = BI.Test.createWidget({ var datePane = BI.Test.createWidget({
type: "bi.dynamic_date_pane", type: "bi.dynamic_date_pane",
value: { value: {
@ -129,7 +129,7 @@ describe("DatePane", function () {
BI.nextTick(function () { BI.nextTick(function () {
datePane.element.find(".bi-multi-select-item.active").click(); datePane.element.find(".bi-multi-select-item.active").click();
datePane.element.find(".bi-multi-select-item").click(); datePane.element.find(".bi-multi-select-item").click();
expect(datePane.getValue()).to.deep.equal({ expect(datePane.getValue()).toEqual({
type: 2, type: 2,
value: { value: {
workDay: -0 workDay: -0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save