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. 51
      packages/fineui/jest.config.ts
  5. 167
      packages/fineui/karma.conf.js
  6. 36
      packages/fineui/package.json
  7. 5
      packages/fineui/src/base/collection/__test__/collection.test.js
  8. 18
      packages/fineui/src/base/foundation/__test__/message.test.js
  9. 4
      packages/fineui/src/base/grid/__test__/grid.test.js
  10. 6
      packages/fineui/src/base/layer/__test__/layer.popover.test.js
  11. 6
      packages/fineui/src/base/list/__test__/listview.test.js
  12. 60
      packages/fineui/src/base/single/__test__/text.test.js
  13. 10
      packages/fineui/src/base/single/a/__test__/a.test.js
  14. 22
      packages/fineui/src/base/single/button/buttons/__test__/button.test.js
  15. 32
      packages/fineui/src/base/single/button/node/__test__/icontexticonnode.test.js
  16. 32
      packages/fineui/src/base/single/button/node/__test__/icontextnode.test.js
  17. 32
      packages/fineui/src/base/single/button/node/__test__/texticonnode.test.js
  18. 32
      packages/fineui/src/base/single/button/node/__test__/textnode.test.js
  19. 10
      packages/fineui/src/base/single/html/__test__/html.test.js
  20. 4
      packages/fineui/src/base/single/iframe/__test__/iframe.test.js
  21. 8
      packages/fineui/src/base/single/img/__test__/img.test.js
  22. 6
      packages/fineui/src/base/single/link/__test__/link.test.js
  23. 24
      packages/fineui/src/case/button/node/__test__/node.arrow.test.js
  24. 20
      packages/fineui/src/case/button/node/__test__/node.first.plus.test.js
  25. 20
      packages/fineui/src/case/button/node/__test__/node.icon.arrow.test.js
  26. 20
      packages/fineui/src/case/button/node/__test__/node.last.plus.test.js
  27. 20
      packages/fineui/src/case/button/node/__test__/node.mid.plus.test.js
  28. 24
      packages/fineui/src/case/button/node/__test__/node.multilayer.icon.arrow.test.js
  29. 20
      packages/fineui/src/case/button/node/__test__/node.plus.test.js
  30. 98
      packages/fineui/src/case/button/treeitem/__test__/item.treeleaf.test.js
  31. 14
      packages/fineui/src/case/colorchooser/__test__/colorchooser.test.js
  32. 6
      packages/fineui/src/case/colorchooser/farbtastic/__test__/farbtastic.test.js
  33. 18
      packages/fineui/src/case/combo/bubblecombo/__test__/combo.bubble.test.js
  34. 8
      packages/fineui/src/case/combo/editoriconcheckcombo/__test__/combo.editiconcheck.test.js
  35. 10
      packages/fineui/src/case/combo/icontextvaluecombo/__test__/combo.icontextvalue.test.js
  36. 20
      packages/fineui/src/case/combo/searchtextvaluecombo/__test__/combo.searchtextvaluecombo.test.js
  37. 14
      packages/fineui/src/case/combo/textvaluecheckcombo/__test__/combo.textvaluecheck.test.js
  38. 18
      packages/fineui/src/case/combo/textvaluecombo/__test__/combo.textvalue.test.js
  39. 26
      packages/fineui/src/case/editor/__test__/editor.clear.test.js
  40. 18
      packages/fineui/src/case/editor/__test__/editor.sign.test.js
  41. 18
      packages/fineui/src/case/editor/__test__/editor.state.simple.test.js
  42. 18
      packages/fineui/src/case/editor/__test__/editor.state.test.js
  43. 16
      packages/fineui/src/case/loader/__test__/loader.lazy.test.js
  44. 16
      packages/fineui/src/case/loader/__test__/loader.list.test.js
  45. 40
      packages/fineui/src/case/pager/__test__/pager.test.js
  46. 8
      packages/fineui/src/case/segment/__test__/segment.test.js
  47. 10
      packages/fineui/src/component/allvaluechooser/__test__/combo.allvaluechooser.test.js
  48. 6
      packages/fineui/src/component/allvaluemultitextvaluecombo/__test__/allvalue.multitextvalue.combo.test.js
  49. 30
      packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.insert.test.js
  50. 22
      packages/fineui/src/component/valuechooser/__test__/combo.valuechooser.test.js
  51. 14
      packages/fineui/src/component/valuechooser/__test__/pane.valuechooser.test.js
  52. 110
      packages/fineui/src/core/__test__/alias.test.js
  53. 280
      packages/fineui/src/core/__test__/base.test.js
  54. 24
      packages/fineui/src/core/__test__/context.test.js
  55. 8
      packages/fineui/src/core/__test__/widget.test.js
  56. 38
      packages/fineui/src/core/func/__test__/date.test.js
  57. 14
      packages/fineui/src/core/func/__test__/function.test.js
  58. 10
      packages/fineui/src/core/func/__test__/string.test.js
  59. 36
      packages/fineui/src/core/platform/web/jquery/__test__/fn.test.js
  60. 10
      packages/fineui/src/core/utils/__test__/aes.test.js
  61. 32
      packages/fineui/src/widget/datepane/__test__/datepane.test.js
  62. 16
      packages/fineui/src/widget/datetime/__test__/datetime.test.js
  63. 32
      packages/fineui/src/widget/datetimepane/__test__/datetimepane.test.js
  64. 14
      packages/fineui/src/widget/downlist/__test__/downlist.test.js
  65. 46
      packages/fineui/src/widget/dynamicdate/__test__/dynamicdate.test.js
  66. 46
      packages/fineui/src/widget/dynamicdatetime/__test__/dynamicdatetime.test.js
  67. 50
      packages/fineui/src/widget/editor/__test__/editor.search.test.js
  68. 42
      packages/fineui/src/widget/editor/__test__/editor.text.test.js
  69. 26
      packages/fineui/src/widget/intervalslider/__test__/accuratecalculation.test.js
  70. 22
      packages/fineui/src/widget/intervalslider/__test__/intervalslider.test.js
  71. 14
      packages/fineui/src/widget/multilayerdownlist/__test__/downlist.test.js
  72. 10
      packages/fineui/src/widget/multilayerselecttree/__test__/multilayerselecttree.combo.test.js
  73. 22
      packages/fineui/src/widget/multilayersingletree/__test__/multilayersingletree.combo.test.js
  74. 24
      packages/fineui/src/widget/multiselect/__test__/multiselect.loader.nobar.test.js
  75. 14
      packages/fineui/src/widget/multiselectlist/__test__/multiselect.insert.nobar.test.js
  76. 18
      packages/fineui/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js
  77. 18
      packages/fineui/src/widget/numberinterval/__test__/numberinterval.test.js
  78. 57
      packages/fineui/src/widget/searchmultitextvaluecombo/__test__/multitextvalue.combo.search.test.js
  79. 10
      packages/fineui/src/widget/selecttree/__test__/selecttree.combo.test.js
  80. 18
      packages/fineui/src/widget/singleselect/__test__/singleselect.combo.test.js
  81. 18
      packages/fineui/src/widget/singleselect/__test__/singleselect.insert.combo.test.js
  82. 14
      packages/fineui/src/widget/singleslider/__test__/singleslider.test.js
  83. 14
      packages/fineui/src/widget/singletree/__test__/singletree.combo.test.js
  84. 14
      packages/fineui/src/widget/textvaluedownlistcombo/__test__/combo.textvaluedownlist.test.js
  85. 32
      packages/fineui/src/widget/time/__test__/time.combo.test.js
  86. 22
      packages/fineui/src/widget/timeinterval/__test__/timeinterval.test.js
  87. 42
      packages/fineui/src/widget/year/__test__/combo.year.test.js
  88. 42
      packages/fineui/src/widget/yearmonth/__test__/combo.yearmonth.test.js
  89. 16
      packages/fineui/src/widget/yearmonthinterval/__test__/yearmonthinterval.test.js
  90. 42
      packages/fineui/src/widget/yearquarter/__test__/combo.yearquarter.test.js
  91. 3
      packages/fineui/test/prepare.js
  92. 71
      packages/fineui/test/utils.js
  93. 2
      packages/fineui/tsconfig.json

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/

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

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

2
packages/fineui/.gitignore vendored

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

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",
"link": "pnpm link --global",
"build:biCss": "cross-env LESS_CONFIG_PATH=bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css",
"build:jsyCss": "cross-env LESS_CONFIG_PATH=jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css"
"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": [
"dist",
@ -57,7 +59,37 @@
"jquery": "3.6.3"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.24.1",
"@babel/plugin-transform-classes": "^7.24.5",
"@babel/plugin-transform-modules-commonjs": "7.6.0",
"@babel/plugin-transform-proto-to-assign": "^7.24.1",
"@babel/plugin-transform-react-jsx": "^7.23.4",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.24.5",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime": "7.20.1",
"@jest/environment": "^29.7.0",
"babel-jest": "^29.7.0",
"chai": "4.2.0",
"core-js": "^3.30.2",
"cross-env": "^7.0.3"
"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
* Created by windy on 2020/3/17
*/
require("../../../bundle")
describe("CollectionTest", function () {
describe("CollectionTest", () => {
/**
* test_author_windy
*/
it("collection", function () {
it("collection", () => {
var items = [];
var cellCount = 100;
for (var i = 0; i < cellCount; i++) {

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

@ -3,17 +3,17 @@
* @version 2.0
* Created by windy on 2020/3/9
*/
describe("MessageTest", function () {
describe("MessageTest", () => {
/**
* test_author_windy
*/
it("alert", function (done) {
it("alert", done => {
BI.Msg.alert("message", "ASASASASA");
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 () {
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();
});
});
@ -21,15 +21,15 @@ describe("MessageTest", function () {
/**
* test_author_windy
*/
it("toast_hand_close", function (done) {
it("toast_hand_close", done => {
BI.Msg.toast("message", {
autoClose: false,
});
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 () {
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();
});
});
@ -37,9 +37,9 @@ describe("MessageTest", function () {
/**
* test_author_windy
*/
it("toast_auto_close", function () {
it("toast_auto_close", () => {
BI.Msg.toast("message");
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
* Created by windy on 2020/3/20
*/
describe("GridTest", function () {
describe("GridTest", () => {
/**
* test_author_windy
*/
it("grid", function () {
it("grid", () => {
var items = [];
var rowCount = 1000, columnCount = 100;
for (var i = 0; i < rowCount; i++) {

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

@ -4,11 +4,11 @@
* Created by windy on 2020/3/17
*/
describe("PopoverTest", function () {
describe("PopoverTest", () => {
/**
* test_author_windy
*/
it("BarPopover", function (done) {
it("BarPopover", done => {
var id = BI.UUID();
BI.Popovers.remove(id);
BI.Popovers.create(id, {
@ -24,7 +24,7 @@ describe("PopoverTest", function () {
},
}).open(id);
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);
done();
}, 100);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -4,16 +4,16 @@
* Created by windy on 2020/3/10
*/
describe("HtmlTest", function () {
describe("HtmlTest", () => {
/**
* test_author_windy
*/
it("html_h1", function () {
it("html_h1", () => {
var a = BI.Test.createWidget({
type: "bi.html",
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();
});
@ -21,7 +21,7 @@ describe("HtmlTest", function () {
/**
* test_author_windy
*/
it("html测试属性方法", function () {
it("html测试属性方法", () => {
var a = BI.Test.createWidget({
type: "bi.html",
text: "<h1>在bi.html标签中使用html原生标签</h1>",
@ -35,7 +35,7 @@ describe("HtmlTest", function () {
});
a.setValue("DDDDD");
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();
});
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -4,12 +4,12 @@
* Created by windy on 2020/3/2
*/
describe("bubble_combo", function () {
describe("bubble_combo", () => {
/**
* test_author_windy
*/
it("测试弹出收起", function (done) {
it("测试弹出收起", done => {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -34,7 +34,7 @@ describe("bubble_combo", function () {
});
BI.nextTick(function () {
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();
done();
})
@ -43,7 +43,7 @@ describe("bubble_combo", function () {
/**
* test_author_windy
*/
it("测试弹出收起", function (done) {
it("测试弹出收起", done => {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -68,7 +68,7 @@ describe("bubble_combo", function () {
});
BI.nextTick(function () {
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();
done();
})
@ -78,7 +78,7 @@ describe("bubble_combo", function () {
/**
* test_author_windy
*/
it("bubble_bar_popup_view", function (done) {
it("bubble_bar_popup_view", done => {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -96,7 +96,7 @@ describe("bubble_combo", function () {
});
BI.nextTick(function () {
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();
done();
})
@ -106,7 +106,7 @@ describe("bubble_combo", function () {
/**
* test_author_windy
*/
it("text_bubble_bar_popup_view", function (done) {
it("text_bubble_bar_popup_view", done => {
var bubbleCombo = BI.Test.createWidget({
type: "bi.bubble_combo",
el: {
@ -124,7 +124,7 @@ describe("bubble_combo", function () {
});
BI.nextTick(function () {
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();
done();
})

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -3,22 +3,22 @@
* @Maintainers: lei.wang
* @Date: 2019-04-16
*/
describe("core-function-test", function () {
describe("core-function-test", () => {
/**
* test_author_lei.wang
*/
it("createDistinctName-支持字符串数组", function () {
it("createDistinctName-支持字符串数组", () => {
const names = ["name", "name1"];
expect(BI.Func.createDistinctName(names, "name")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name")).toBe("name2");
expect(BI.Func.createDistinctName(names, "name2")).toBe("name2");
});
/**
* test_author_lei.wang
*/
it("createDistinctName-支持对象数组数组", function () {
it("createDistinctName-支持对象数组数组", () => {
const names = [{ name: "name" }, { name: "name1" }];
expect(BI.Func.createDistinctName(names, "name")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name2")).to.equal("name2");
expect(BI.Func.createDistinctName(names, "name")).toBe("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
* Created by windy on 2020/6/5
*/
describe("dateFunctionTest", function () {
describe("dateFunctionTest", () => {
before(function () {
beforeAll(() => {
});
/**
* test_author_windy
*/
it("getWeekNumber", function () {
expect(BI.replaceAll(null, "A", "b")).to.equal(null);
expect(BI.replaceAll("A", "A", "b")).to.equal("b");
it("getWeekNumber", () => {
expect(BI.replaceAll(null, "A", "b")).toBeNull();
expect(BI.replaceAll("A", "A", "b")).toBe("b");
});
});

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

@ -4,73 +4,79 @@
* Created by windy on 2019/12/9
*/
describe("标红test", function () {
describe("标红test", () => {
/**
* test_author_windy
*/
it("无多音字标红", function () {
it("无多音字标红", () => {
var a = BI.Test.createWidget({
type: "bi.layout",
});
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();
});
/**
* test_author_windy
*/
it("含有多音字标红", function () {
it("含有多音字标红", () => {
var a = BI.Test.createWidget({
type: "bi.layout",
});
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");
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();
});
/**
* test_author_windy
*/
it("多音字错位标红", function () {
it("多音字错位标红", () => {
var a = BI.Test.createWidget({
type: "bi.layout",
});
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");
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");
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();
});
/**
* test_author_windy
*/
it("原文和拼音都匹配标红", function () {
it("原文和拼音都匹配标红", () => {
var a = BI.Test.createWidget({
type: "bi.layout",
});
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");
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();
});
/**
* test_author_windy
*/
it("中文拼音", function () {
it("中文拼音", () => {
var a = BI.Test.createWidget({
type: "bi.layout",
});
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();
});
});

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

18
packages/fineui/src/widget/multiselectlist/__test__/multiselectlist.insert.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2020/6/2
*/
describe("multi_list_insert_pane", function () {
describe("multi_list_insert_pane", () => {
var items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
@ -28,7 +28,7 @@ describe("multi_list_insert_pane", function () {
/**
* test_author_windy
**/
it("setValue", function () {
it("setValue", () => {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_list",
width: 220,
@ -40,7 +40,7 @@ describe("multi_list_insert_pane", function () {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
type: 1,
value: [1, 2]
});
@ -50,7 +50,7 @@ describe("multi_list_insert_pane", function () {
/**
* test_author_windy
**/
it("点选选值", function (done) {
it("点选选值", done => {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_list",
width: 220,
@ -76,7 +76,7 @@ describe("multi_list_insert_pane", function () {
});
var value = widget.getValue();
delete value.assist;
expect(value).to.deep.equal({
expect(value).toEqual({
type: 2,
value: [0, 1, 2]
});
@ -89,7 +89,7 @@ describe("multi_list_insert_pane", function () {
/**
* test_author_windy
**/
it("搜索选值", function (done) {
it("搜索选值", done => {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_list",
width: 220,
@ -125,7 +125,7 @@ describe("multi_list_insert_pane", function () {
});
var value = widget.getValue();
delete value.assist;
expect(value).to.deep.equal({
expect(value).toEqual({
type: 1,
value: ["2", "12"]
});
@ -139,7 +139,7 @@ describe("multi_list_insert_pane", function () {
/**
* test_author_windy
**/
it("新增值", function (done) {
it("新增值", done => {
var widget = BI.Test.createWidget({
type: "bi.multi_select_insert_list",
width: 220,
@ -164,7 +164,7 @@ describe("multi_list_insert_pane", function () {
widget.element.find(".bi-text-button:contains(+点击新增\"z\")").click();
var value = widget.getValue();
delete value.assist;
expect(value).to.deep.equal({
expect(value).toEqual({
type: 1,
value: ["z"]
});

18
packages/fineui/src/widget/numberinterval/__test__/numberinterval.test.js

@ -4,12 +4,12 @@
* Created by windy on 2019/9/27
*/
describe("NumberInterval", function () {
describe("NumberInterval", () => {
/**
* test_author_windy
*/
it("setValue", function () {
it("setValue", () => {
var widget = BI.Test.createWidget({
type: "bi.number_interval",
});
@ -19,7 +19,7 @@ describe("NumberInterval", function () {
closeMin: true,
closeMax: true
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
max: "10",
min: "2",
closeMin: true,
@ -31,7 +31,7 @@ describe("NumberInterval", function () {
/**
* test_author_windy
*/
it("defaultValue", function () {
it("defaultValue", () => {
var widget = BI.Test.createWidget({
type: "bi.number_interval",
max: 10,
@ -39,7 +39,7 @@ describe("NumberInterval", function () {
closeMin: true,
closeMax: true
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
max: "10",
min: "2",
closeMin: true,
@ -51,7 +51,7 @@ describe("NumberInterval", function () {
/**
* test_author_windy
*/
it("输入报错单editor输入不合法报错", function (done) {
it("输入报错单editor输入不合法报错", done => {
var widget = BI.Test.createWidget({
type: "bi.number_interval",
width: 200,
@ -59,7 +59,7 @@ describe("NumberInterval", function () {
});
widget.element.find(".number-interval-small-editor .bi-input").click();
BI.Test.triggerKeyDown(widget.element.find(".number-interval-small-editor .bi-input"), "A", 65, function () {
expect(widget.element.children(".bi-tip").length).to.not.equal(0);
expect(widget.element.children(".bi-tip").length).not.toBe(0);
widget.destroy();
done();
});
@ -69,7 +69,7 @@ describe("NumberInterval", function () {
/**
* test_author_windy
*/
it("输入报错区间不合法报错", function (done) {
it("输入报错区间不合法报错", done => {
var widget = BI.Test.createWidget({
type: "bi.number_interval",
width: 200,
@ -79,7 +79,7 @@ describe("NumberInterval", function () {
BI.Test.triggerKeyDown(widget.element.find(".number-interval-small-editor .bi-input"), "2", 50, function () {
widget.element.find(".number-interval-big-editor .bi-input").click();
BI.Test.triggerKeyDown(widget.element.find(".number-interval-big-editor .bi-input"), "1", 49, function () {
expect(widget.element.children(".bi-tip").length).to.not.equal(0);
expect(widget.element.children(".bi-tip").length).not.toBe(0);
widget.destroy();
done();
});

57
packages/fineui/src/widget/searchmultitextvaluecombo/__test__/multitextvalue.combo.search.test.js

@ -4,7 +4,7 @@
* Created by windy on 2019/9/27
*/
describe("multitextvaluecombo", function () {
describe("multitextvaluecombo", () => {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -29,7 +29,7 @@ describe("multitextvaluecombo", function () {
/**
* test_author_windy
**/
it("setValue", function () {
it("setValue", () => {
var widget = BI.Test.createWidget({
type: "bi.search_multi_text_value_combo",
width: 220,
@ -39,7 +39,7 @@ describe("multitextvaluecombo", function () {
type: 1,
value: [1, 2]
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
type: 1,
value: [1, 2]
});
@ -49,7 +49,7 @@ describe("multitextvaluecombo", function () {
/**
* test_author_windy
**/
it("getValue", function () {
it("getValue", () => {
var widget = BI.Test.createWidget({
type: "bi.search_multi_text_value_combo",
width: 220,
@ -59,7 +59,7 @@ describe("multitextvaluecombo", function () {
value: [1, 2, 3]
}
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
type: 2,
value: [1, 2, 3]
});
@ -69,39 +69,38 @@ describe("multitextvaluecombo", function () {
/**
* test_author_windy
**/
it("点选选值", function (done) {
it("点选选值", async () => {
var widget = BI.Test.createWidget({
type: "bi.search_multi_text_value_combo",
width: 220,
items: items
});
// 组件创建需要时间...
await BI.Test.sleep(300);
widget.element.find(".bi-multi-select-trigger").click();
await BI.Test.sleep(300);
// 为什么要delay 300呢,因为按钮有debounce
BI.delay(function () {
// 点选1、2、3
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
// 点全选
widget.element.find(".bi-multi-select-popup-view .bi-label:contains(全选)").click();
// 取消勾选1、2、3
BI.delay(function () {
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
var value = widget.getValue();
expect(value.type).to.equal(2);
expect(value.value).to.deep.equal([0, 1, 2]);
widget.destroy();
done();
}, 300);
}, 300);
// 点选1、2、3
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
// 点全选
widget.element.find(".bi-multi-select-popup-view .bi-label:contains(全选)").click();
await BI.Test.sleep(300);
// 取消勾选1、2、3
BI.each(itemSelectorGetter([1,2,3]), function (idx, selector) {
widget.element.find(selector).click();
});
await BI.Test.sleep(300);
var value = widget.getValue();
expect(value.type).toBe(2);
expect(value.value).toEqual([0, 1, 2]);
});
/**
* test_author_windy
**/
it("搜索选值", function (done) {
it("搜索选值", done => {
var widget = BI.Test.createWidget({
type: "bi.search_multi_text_value_combo",
width: 220,
@ -116,7 +115,7 @@ describe("multitextvaluecombo", function () {
BI.each(searchItemSelectorGetter([1,2]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).to.deep.equal({
expect(widget.getValue()).toEqual({
type: 1,
value: [2, 12]
});
@ -131,7 +130,7 @@ describe("multitextvaluecombo", function () {
/**
* test_author_windy
**/
it("查看已选", function (done) {
it("查看已选", done => {
var widget = BI.Test.createWidget({
type: "bi.search_multi_text_value_combo",
width: 220,
@ -144,7 +143,7 @@ describe("multitextvaluecombo", function () {
BI.nextTick(function () {
widget.element.find(".bi-multi-select-check-selected-button").click();
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();
done();
}, 300);

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

@ -4,7 +4,7 @@
* Created by windy on 2020/2/17
*/
describe("select_tree", function () {
describe("select_tree", () => {
var items = [{
id: 1,
@ -54,7 +54,7 @@ describe("select_tree", function () {
/**
* test_author_windy
**/
it("defaultValue", function () {
it("defaultValue", () => {
var tree = BI.Test.createWidget({
type: "bi.select_tree_combo",
width: 300,
@ -62,14 +62,14 @@ describe("select_tree", function () {
items: BI.deepClone(items),
value: "1"
});
expect(tree.getValue()[0]).to.equal("1");
expect(tree.getValue()[0]).toBe("1");
tree.destroy();
});
/**
* test_author_windy
**/
it("点选选值", function (done) {
it("点选选值", done => {
var tree = BI.Test.createWidget({
type: "bi.select_tree_combo",
width: 300,
@ -81,7 +81,7 @@ describe("select_tree", function () {
tree.element.find(".bi-single-tree-trigger").click();
BI.nextTick(function () {
tree.element.find(".bi-select-tree-first-plus-group-node").click();
expect(tree.getValue()[0]).to.equal("1");
expect(tree.getValue()[0]).toBe("1");
tree.destroy();
done();
});

18
packages/fineui/src/widget/singleselect/__test__/singleselect.combo.test.js

@ -3,7 +3,7 @@
* @version 2.0
* Created by windy on 2020/1/16
*/
describe("single_select_combo", function () {
describe("single_select_combo", () => {
var items = BI.map(BI.makeArray(1000, null), function(idx, v) {
return {
@ -28,7 +28,7 @@ describe("single_select_combo", function () {
/**
* test_author_windy
**/
it("setValue", function () {
it("setValue", () => {
var widget = BI.Test.createWidget({
type: "bi.single_select_combo",
width: 220,
@ -37,14 +37,14 @@ describe("single_select_combo", function () {
}
});
widget.setValue(1);
expect(widget.getValue()).to.equal(1);
expect(widget.getValue()).toBe(1);
widget.destroy();
});
/**
* test_author_windy
**/
it("getValue", function () {
it("getValue", () => {
var widget = BI.Test.createWidget({
type: "bi.single_select_combo",
width: 220,
@ -53,14 +53,14 @@ describe("single_select_combo", function () {
},
value: 1
});
expect(widget.getValue()).to.equal(1);
expect(widget.getValue()).toBe(1);
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", function (done) {
it("点选选值", done => {
var widget = BI.Test.createWidget({
type: "bi.single_select_combo",
allowNoSelect: true,
@ -80,7 +80,7 @@ describe("single_select_combo", function () {
BI.each(itemSelectorGetter([1]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).to.equal(0);
expect(widget.getValue()).toBe(0);
widget.destroy();
done();
}, 300);
@ -89,7 +89,7 @@ describe("single_select_combo", function () {
/**
* test_author_windy
**/
it("搜索选值", function (done) {
it("搜索选值", done => {
var widget = BI.Test.createWidget({
type: "bi.single_select_combo",
allowNoSelect: true,
@ -110,7 +110,7 @@ describe("single_select_combo", function () {
BI.each(searchItemSelectorGetter([3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).to.equal(2);
expect(widget.getValue()).toBe(2);
widget.destroy();
done();
});

18
packages/fineui/src/widget/singleselect/__test__/singleselect.insert.combo.test.js

@ -4,7 +4,7 @@
* Created by windy on 2020/3/5
*/
describe("single_select_insert_combo", function () {
describe("single_select_insert_combo", () => {
var items = BI.map(BI.makeArray(100, null), function(idx, v) {
return {
@ -29,7 +29,7 @@ describe("single_select_insert_combo", function () {
/**
* test_author_windy
**/
it("setValue", function () {
it("setValue", () => {
var widget = BI.Test.createWidget({
type: "bi.single_select_insert_combo",
width: 220,
@ -38,14 +38,14 @@ describe("single_select_insert_combo", function () {
}
});
widget.setValue(1);
expect(widget.getValue()).to.equal(1);
expect(widget.getValue()).toBe(1);
widget.destroy();
});
/**
* test_author_windy
**/
it("getValue", function () {
it("getValue", () => {
var widget = BI.Test.createWidget({
type: "bi.single_select_insert_combo",
width: 220,
@ -54,14 +54,14 @@ describe("single_select_insert_combo", function () {
},
value: 1
});
expect(widget.getValue()).to.equal(1);
expect(widget.getValue()).toBe(1);
widget.destroy();
});
/**
* test_author_windy
**/
it("点选选值", function (done) {
it("点选选值", done => {
var start = BI.getTime();
var widget = BI.Test.createWidget({
type: "bi.single_select_insert_combo",
@ -81,7 +81,7 @@ describe("single_select_insert_combo", function () {
BI.each(itemSelectorGetter([1]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).to.equal(0);
expect(widget.getValue()).toBe(0);
widget.destroy();
done();
}, 300);
@ -90,7 +90,7 @@ describe("single_select_insert_combo", function () {
/**
* test_author_windy
**/
it("搜索选值", function (done) {
it("搜索选值", done => {
var widget = BI.Test.createWidget({
type: "bi.single_select_insert_combo",
width: 220,
@ -110,7 +110,7 @@ describe("single_select_insert_combo", function () {
BI.each(searchItemSelectorGetter([3]), function (idx, selector) {
widget.element.find(selector).click();
});
expect(widget.getValue()).to.equal(2);
expect(widget.getValue()).toBe(2);
widget.destroy();
done();
});

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

@ -4,12 +4,12 @@
* Created by windy on 2020/3/24
*/
describe("SingleSlider", function () {
describe("SingleSlider", () => {
/**
* test_author_windy
*/
it("singleSlider", function () {
it("singleSlider", () => {
var widget = BI.Test.createWidget({
type: "bi.single_slider",
digit: 0,
@ -22,14 +22,14 @@ describe("SingleSlider", function () {
});
widget.setValue(30);
widget.populate();
expect(widget.element.find(".blue-track").width() > 0).to.equal(true);
expect(widget.element.find(".blue-track").width() > 0).toBe(true);
widget.destroy();
});
/**
* test_author_windy
*/
it("singleSlidernormal", function () {
it("singleSlidernormal", () => {
var widget = BI.Test.createWidget({
type: "bi.single_slider_normal",
digit: 0,
@ -42,7 +42,7 @@ describe("SingleSlider", function () {
});
widget.setValue(30);
widget.populate();
expect(widget.element.find(".blue-track").width() > 0).to.equal(true);
expect(widget.element.find(".blue-track").width() > 0).toBe(true);
widget.destroy();
});
@ -50,7 +50,7 @@ describe("SingleSlider", function () {
/**
* test_author_windy
*/
it("singleSliderlabel", function () {
it("singleSliderlabel", () => {
var widget = BI.Test.createWidget({
type: "bi.single_slider_label",
width: 300,
@ -65,7 +65,7 @@ describe("SingleSlider", function () {
});
widget.setValue(30);
widget.populate();
expect(widget.element.find(".blue-track").width() > 0).to.equal(true);
expect(widget.element.find(".blue-track").width() > 0).toBe(true);
widget.destroy();
});
});

14
packages/fineui/src/widget/singletree/__test__/singletree.combo.test.js

@ -4,7 +4,7 @@
* Created by windy on 2020/2/17
*/
describe("single_tree", function () {
describe("single_tree", () => {
var items = [{
id: 1,
@ -54,7 +54,7 @@ describe("single_tree", function () {
/**
* test_author_windy
**/
it("defaultValue", function () {
it("defaultValue", () => {
var tree = BI.Test.createWidget({
type: "bi.single_tree_combo",
width: 300,
@ -62,14 +62,14 @@ describe("single_tree", function () {
items: BI.deepClone(items),
value: "2"
});
expect(tree.getValue()[0]).to.equal("2");
expect(tree.getValue()[0]).toBe("2");
tree.destroy();
});
/**
* test_author_windy
**/
it("点选选值_选择父节点", function (done) {
it("点选选值_选择父节点", done => {
var tree = BI.Test.createWidget({
type: "bi.single_tree_combo",
width: 300,
@ -81,7 +81,7 @@ describe("single_tree", function () {
tree.element.find(".bi-single-tree-trigger").click();
BI.nextTick(function () {
tree.element.find(".bi-single-tree-first-plus-group-node").click();
expect(tree.getValue()[0]).to.equal("2");
expect(tree.getValue()[0]).toBe("2");
tree.destroy();
done();
});
@ -90,7 +90,7 @@ describe("single_tree", function () {
/**
* test_author_windy
**/
it("点选选值_选择叶子节点", function (done) {
it("点选选值_选择叶子节点", done => {
var tree = BI.Test.createWidget({
type: "bi.single_tree_combo",
width: 300,
@ -102,7 +102,7 @@ describe("single_tree", function () {
tree.element.find(".bi-single-tree-trigger").click();
BI.nextTick(function () {
tree.element.find(".bi-mid-tree-leaf-item").click();
expect(tree.getValue()[0]).to.equal("32");
expect(tree.getValue()[0]).toBe("32");
tree.destroy();
done();
});

14
packages/fineui/src/widget/textvaluedownlistcombo/__test__/combo.textvaluedownlist.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/2/17
*/
describe("TextValueDownListCombo", function () {
describe("TextValueDownListCombo", () => {
/**
* test_author_windy
*/
it("defaultValue", function () {
it("defaultValue", () => {
var downListCombo = BI.Test.createWidget({
type: "bi.text_value_down_list_combo",
adjustLength: 10,
@ -40,7 +40,7 @@ describe("TextValueDownListCombo", function () {
}]]
});
downListCombo.setValue(2);
expect(downListCombo.getValue()[0]).to.deep.equal(2);
expect(downListCombo.getValue()[0]).toEqual(2);
downListCombo.destroy();
});
@ -48,7 +48,7 @@ describe("TextValueDownListCombo", function () {
/**
* test_author_windy
*/
it("点击父亲选值", function (done) {
it("点击父亲选值", done => {
var downListCombo = BI.Test.createWidget({
type: "bi.text_value_down_list_combo",
height: 30,
@ -82,7 +82,7 @@ describe("TextValueDownListCombo", function () {
downListCombo.element.find(".pull-down-font").click();
BI.nextTick(function () {
downListCombo.element.find(".bi-down-list-group:first-child .bi-down-list-item").click();
expect(downListCombo.getValue()[0]).to.deep.equal(2);
expect(downListCombo.getValue()[0]).toEqual(2);
downListCombo.destroy();
done();
});
@ -92,7 +92,7 @@ describe("TextValueDownListCombo", function () {
/**
* test_author_windy
*/
it("点击儿子选值", function (done) {
it("点击儿子选值", done => {
var downListCombo = BI.Test.createWidget({
type: "bi.text_value_down_list_combo",
height: 30,
@ -127,7 +127,7 @@ describe("TextValueDownListCombo", function () {
BI.Test.triggerMouseover(downListCombo.element.find(".bi-down-list-group:last-child .bi-down-list-group-item"), function () {
BI.nextTick(function () {
downListCombo.element.find(".child-down-list-item:first-child").click();
expect(downListCombo.getValue()[0]).to.deep.equal(4);
expect(downListCombo.getValue()[0]).toEqual(4);
downListCombo.destroy();
done();
});

32
packages/fineui/src/widget/time/__test__/time.combo.test.js

@ -4,12 +4,12 @@
* Created by windy on 2020/2/17
*/
describe("TimeCombo", function () {
describe("TimeCombo", () => {
/**
* test_author_windy
*/
it("defaultValue", function (done) {
it("defaultValue", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
value: {
@ -20,7 +20,7 @@ describe("TimeCombo", function () {
width: 300
});
BI.nextTick(function () {
expect(timeCombo.element.find(".bi-time-trigger .bi-label").text()).to.equal("12:00:00");
expect(timeCombo.element.find(".bi-time-trigger .bi-label").text()).toBe("12:00:00");
timeCombo.destroy();
done();
});
@ -29,7 +29,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", function (done) {
it("测试输入值收起下拉清空值下拉出现", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
allowEdit: true,
@ -45,11 +45,11 @@ describe("TimeCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(timeCombo.element.find(".bi-time-trigger .bi-input"), "1", 49, function () {
BI.nextTick(function () {
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).toBe("none");
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(timeCombo.element.find(".bi-time-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).to.equal("block");
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).toBe("block");
timeCombo.destroy();
done();
});
@ -63,7 +63,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", function (done) {
it("下拉后直接点击外部的触发的confirm", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
width: 220,
@ -76,7 +76,7 @@ describe("TimeCombo", function () {
var input = timeCombo.element.find(".bi-time-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(timeCombo.element.find(".bi-time-trigger + .bi-popup-view").css("display")).toBe("none");
timeCombo.destroy();
done();
}, 300);
@ -89,7 +89,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("点击清空", function (done) {
it("点击清空", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
width: 220,
@ -103,7 +103,7 @@ describe("TimeCombo", function () {
timeCombo.element.find(".bi-time-trigger .bi-basic-button").click();
BI.nextTick(function () {
timeCombo.element.find(".bi-date-time-popup .bi-text:contains(清空)").parent().click();
expect(BI.isNull(timeCombo.getValue())).to.equal(true);
expect(BI.isNull(timeCombo.getValue())).toBe(true);
timeCombo.destroy();
done();
})
@ -113,7 +113,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("点击确定", function (done) {
it("点击确定", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
width: 220,
@ -127,7 +127,7 @@ describe("TimeCombo", function () {
timeCombo.element.find(".bi-time-trigger .bi-basic-button").click();
BI.nextTick(function () {
timeCombo.element.find(".bi-date-time-popup .bi-text:contains(确定)").parent().click();
expect(timeCombo.getValue()).to.deep.equal({
expect(timeCombo.getValue()).toEqual({
hour: 12,
minute: 0,
second: 0
@ -141,7 +141,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", function (done) {
it("trigger的输入日期后confirm", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
width: 220,
@ -159,7 +159,7 @@ describe("TimeCombo", function () {
input.val("11:11:11");
BI.Test.triggerKeyDown(timeCombo.element.find(".bi-time-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(timeCombo.element.find(".bi-time-trigger .bi-text-button").text()).to.equal("11:11:11");
expect(timeCombo.element.find(".bi-time-trigger .bi-text-button").text()).toBe("11:11:11");
timeCombo.destroy();
done();
}, 300);
@ -173,7 +173,7 @@ describe("TimeCombo", function () {
/**
* test_author_windy
*/
it("测试%M:%S", function (done) {
it("测试%M:%S", done => {
var timeCombo = BI.Test.createWidget({
type: "bi.time_combo",
width: 220,
@ -186,7 +186,7 @@ describe("TimeCombo", function () {
},
});
BI.nextTick(function () {
expect(timeCombo.element.find(".bi-time-trigger .bi-label").text()).to.equal("45:00");
expect(timeCombo.element.find(".bi-time-trigger .bi-label").text()).toBe("45:00");
timeCombo.destroy();
done();
});

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

@ -4,12 +4,12 @@
* Created by windy on 2020/2/18
*/
describe("DateInterval", function () {
describe("DateInterval", () => {
/**
* test_author_windy
*/
it("DateInterval_defaultValue", function () {
it("DateInterval_defaultValue", () => {
var dateInterval = BI.Test.createWidget({
type: "bi.date_interval"
});
@ -30,14 +30,14 @@ describe("DateInterval", function () {
}
}
});
expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).to.equal("2018-01-122019-01-01");
expect(dateInterval.element.find(".bi-date-trigger .bi-label").text()).toBe("2018-01-122019-01-01");
dateInterval.destroy();
});
/**
* test_author_windy
*/
it("DateInterval_测试报错", function (done) {
it("DateInterval_测试报错", done => {
var testText;
var dateInterval = BI.Test.createWidget({
type: "bi.date_interval",
@ -69,7 +69,7 @@ describe("DateInterval", function () {
dateInterval.element.find(".first-element .bi-date-trigger .bi-basic-button").click();
BI.delay(function () {
dateInterval.element.find(".first-element .bi-text-button:contains(确定)").click();
expect(testText).to.equal("ERROR");
expect(testText).toBe("ERROR");
dateInterval.destroy();
done();
}, 300);
@ -79,7 +79,7 @@ describe("DateInterval", function () {
/**
* test_author_windy
*/
it("TimeInterval_defaultValue", function () {
it("TimeInterval_defaultValue", () => {
var dateInterval = BI.Test.createWidget({
type: "bi.time_interval",
value: {
@ -103,14 +103,14 @@ describe("DateInterval", function () {
}
},
});
expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).to.equal("2018-01-12 10:10:102019-01-01 00:00:00");
expect(dateInterval.element.find(".bi-date-time-trigger .bi-label").text()).toBe("2018-01-12 10:10:102019-01-01 00:00:00");
dateInterval.destroy();
});
/**
* test_author_windy
*/
it("TimePeriod_defaultValue", function () {
it("TimePeriod_defaultValue", () => {
var dateInterval = BI.Test.createWidget({
type: "bi.time_periods",
value: {
@ -126,7 +126,7 @@ describe("DateInterval", function () {
}
},
});
expect(dateInterval.getValue()).to.deep.equal({
expect(dateInterval.getValue()).toEqual({
"end": {
"hour": 23,
"minute": 34,
@ -144,7 +144,7 @@ describe("DateInterval", function () {
/**
* test_author_windy
*/
it("TimeInterval_测试报错", function (done) {
it("TimeInterval_测试报错", done => {
var testText;
var dateInterval = BI.Test.createWidget({
type: "bi.time_interval",
@ -176,7 +176,7 @@ describe("DateInterval", function () {
dateInterval.element.find(".first-element .bi-date-time-trigger .bi-basic-button").click();
BI.delay(function () {
dateInterval.element.find(".first-element .bi-text-button:contains(确定)").click();
expect(testText).to.equal("ERROR");
expect(testText).toBe("ERROR");
dateInterval.destroy();
done();
}, 300);

42
packages/fineui/src/widget/year/__test__/combo.year.test.js

@ -4,9 +4,9 @@
* Created by windy on 2020/1/14
*/
describe("YearCombo", function () {
describe("YearCombo", () => {
before(function () {
beforeAll(() => {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("defaultValue", function (done) {
it("defaultValue", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
value: {
@ -27,7 +27,7 @@ describe("YearCombo", function () {
}
});
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-trigger .bi-label").text()).to.equal("2018年");
expect(dateCombo.element.find(".bi-year-trigger .bi-label").text()).toBe("2018年");
dateCombo.destroy();
done();
});
@ -37,7 +37,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", function (done) {
it("测试输入值收起下拉清空值下拉出现", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -48,11 +48,11 @@ describe("YearCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-trigger .bi-input"), "2", 50, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).toBe("none");
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).to.equal("block");
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).toBe("block");
dateCombo.destroy();
done();
});
@ -66,7 +66,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", function (done) {
it("trigger的confirm-下拉面板选值confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -76,7 +76,7 @@ describe("YearCombo", function () {
dateCombo.element.find(".bi-year-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-card .bi-list-item-select:first-child").click();
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
})
@ -86,7 +86,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", function (done) {
it("下拉后直接点击外部的触发的confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -98,7 +98,7 @@ describe("YearCombo", function () {
var input = dateCombo.element.find(".bi-year-trigger .bi-input");
BI.Test.triggerKeyDown(input, null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
}, 300);
@ -111,7 +111,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("点击清空", function (done) {
it("点击清空", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -127,7 +127,7 @@ describe("YearCombo", function () {
dateCombo.element.find(".bi-year-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-popup .bi-text:contains(清除)").parent().click();
expect(BI.isNull(dateCombo.getValue())).to.equal(true);
expect(BI.isNull(dateCombo.getValue())).toBe(true);
dateCombo.destroy();
done();
})
@ -136,7 +136,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("点击本年", function (done) {
it("点击本年", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -146,7 +146,7 @@ describe("YearCombo", function () {
BI.nextTick(function () {
dateCombo.element.find(".bi-year-popup .bi-text:contains(今年)").parent().click();
var date = BI.getDate();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: date.getFullYear()
@ -161,7 +161,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("点击确定", function (done) {
it("点击确定", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -176,7 +176,7 @@ describe("YearCombo", function () {
dateCombo.element.find(".bi-year-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: 2018
@ -190,7 +190,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("测试动态默认值", function () {
it("测试动态默认值", () => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -202,7 +202,7 @@ describe("YearCombo", function () {
}
}
});
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 2,
value: {
year: -1
@ -215,7 +215,7 @@ describe("YearCombo", function () {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", function (done) {
it("trigger的输入日期后confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_combo",
width: 220,
@ -234,7 +234,7 @@ describe("YearCombo", function () {
input.val("2017");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-trigger .bi-text-button").text()).to.equal("2017");
expect(dateCombo.element.find(".bi-year-trigger .bi-text-button").text()).toBe("2017");
dateCombo.destroy();
done();
}, 300);

42
packages/fineui/src/widget/yearmonth/__test__/combo.yearmonth.test.js

@ -4,9 +4,9 @@
* Created by windy on 2019/12/26
*/
describe("YearMonthCombo", function () {
describe("YearMonthCombo", () => {
before(function () {
beforeAll(() => {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("defaultValue", function (done) {
it("defaultValue", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
value: {
@ -28,7 +28,7 @@ describe("YearMonthCombo", function () {
}
});
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-month-trigger .bi-center-layout:first-child .bi-label").text()).to.equal("2018年1月");
expect(dateCombo.element.find(".bi-year-month-trigger .bi-center-layout:first-child .bi-label").text()).toBe("2018年1月");
dateCombo.destroy();
done();
});
@ -38,7 +38,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", function (done) {
it("测试输入值收起下拉清空值下拉出现", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -49,11 +49,11 @@ describe("YearMonthCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-month-trigger .bi-input"), "4", 52, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).toBe("none");
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-month-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).to.equal("block");
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).toBe("block");
dateCombo.destroy();
done();
});
@ -67,7 +67,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", function (done) {
it("trigger的confirm-下拉面板选值confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -77,7 +77,7 @@ describe("YearMonthCombo", function () {
dateCombo.element.find(".bi-year-month-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-static-year-month-card .bi-list-item-select:first-child").click();
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
})
@ -87,7 +87,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", function (done) {
it("下拉后直接点击外部的触发的confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -99,7 +99,7 @@ describe("YearMonthCombo", function () {
BI.nextTick(function () {
$("body").mousedown();
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-month-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
}, 300);
@ -111,7 +111,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("点击清空", function (done) {
it("点击清空", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -127,7 +127,7 @@ describe("YearMonthCombo", function () {
dateCombo.element.find(".bi-year-month-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-month-popup .bi-text:contains(清除)").parent().click();
expect(BI.isNull(dateCombo.getValue())).to.equal(true);
expect(BI.isNull(dateCombo.getValue())).toBe(true);
dateCombo.destroy();
done();
})
@ -136,7 +136,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("点击本季度", function (done) {
it("点击本季度", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -146,7 +146,7 @@ describe("YearMonthCombo", function () {
BI.nextTick(function () {
dateCombo.element.find(".bi-year-month-popup .bi-text:contains(本月)").parent().click();
var date = BI.getDate();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: date.getFullYear(),
@ -162,7 +162,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("点击确定", function (done) {
it("点击确定", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -178,7 +178,7 @@ describe("YearMonthCombo", function () {
dateCombo.element.find(".bi-year-month-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-month-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: 2018,
@ -193,7 +193,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("测试动态默认值", function () {
it("测试动态默认值", () => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -206,7 +206,7 @@ describe("YearMonthCombo", function () {
}
}
});
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 2,
value: {
year: -1,
@ -220,7 +220,7 @@ describe("YearMonthCombo", function () {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", function (done) {
it("trigger的输入日期后confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_month_combo",
width: 220,
@ -240,7 +240,7 @@ describe("YearMonthCombo", function () {
input.val("2");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-month-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-month-trigger .bi-text-button").text()).to.equal("2018年2月");
expect(dateCombo.element.find(".bi-year-month-trigger .bi-text-button").text()).toBe("2018年2月");
dateCombo.destroy();
done();
}, 300);

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

@ -3,9 +3,9 @@
* @version 2.0
* Created by windy on 2020/1/16
*/
describe("YearMonthInterval", function () {
describe("YearMonthInterval", () => {
before(function () {
beforeAll(() => {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -15,7 +15,7 @@ describe("YearMonthInterval", function () {
/**
* test_author_windy
*/
it("defaultValue", function () {
it("defaultValue", () => {
var dateCombo = BI.Test.createWidget({
type: "bi.year_month_interval",
value: {
@ -35,7 +35,7 @@ describe("YearMonthInterval", function () {
}
}
});
expect(dateCombo.getValue()).eql({
expect(dateCombo.getValue()).toEqual({
start: {
type: 2,
value: {
@ -58,7 +58,7 @@ describe("YearMonthInterval", function () {
/**
* test_author_windy
*/
it("setValue", function () {
it("setValue", () => {
var dateCombo = BI.Test.createWidget({
type: "bi.year_month_interval",
width: 220,
@ -80,7 +80,7 @@ describe("YearMonthInterval", function () {
}
}
});
expect(dateCombo.getValue()).eql({
expect(dateCombo.getValue()).toEqual({
start: {
type: 2,
value: {
@ -103,7 +103,7 @@ describe("YearMonthInterval", function () {
/**
* test_author_windy
*/
it("错误提示", function (done) {
it("错误提示", done => {
var testText;
var dateCombo = BI.Test.createWidget({
type: "bi.year_month_interval",
@ -135,7 +135,7 @@ describe("YearMonthInterval", function () {
dateCombo.element.find(".first-element .pull-down-font").click();
BI.delay(function () {
dateCombo.element.find(".bi-text-button:contains(确定)").click();
expect(testText).to.equal("ERROR");
expect(testText).toBe("ERROR");
dateCombo.destroy();
done();
}, 300);

42
packages/fineui/src/widget/yearquarter/__test__/combo.yearquarter.test.js

@ -4,9 +4,9 @@
* Created by windy on 2019/12/23
*/
describe("YearQuarterCombo", function () {
describe("YearQuarterCombo", () => {
before(function () {
beforeAll(() => {
BI.holidays = {
"2010-02-28": true,
"2010-02-27": true
@ -16,7 +16,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("defaultValue", function (done) {
it("defaultValue", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
value: {
@ -28,7 +28,7 @@ describe("YearQuarterCombo", function () {
}
});
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-quarter-trigger .bi-center-layout:first-child .bi-label").text()).to.equal("2018年1季度");
expect(dateCombo.element.find(".bi-year-quarter-trigger .bi-center-layout:first-child .bi-label").text()).toBe("2018年1季度");
dateCombo.destroy();
done();
});
@ -38,7 +38,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("测试输入值收起下拉清空值下拉出现", function (done) {
it("测试输入值收起下拉清空值下拉出现", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -49,11 +49,11 @@ describe("YearQuarterCombo", function () {
// 输入8, 检查popup是否收起
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-quarter-trigger .bi-input"), "4", 52, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).toBe("none");
// 清空输入, 检查popup是否弹出
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-quarter-trigger .bi-input"), "", BI.KeyCode.BACKSPACE, function () {
BI.nextTick(function () {
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).to.equal("block");
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).toBe("block");
dateCombo.destroy();
done();
});
@ -67,7 +67,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("trigger的confirm-下拉面板选值confirm", function (done) {
it("trigger的confirm-下拉面板选值confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -77,7 +77,7 @@ describe("YearQuarterCombo", function () {
dateCombo.element.find(".bi-year-quarter-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-static-year-quarter-card .bi-list-item-select:first-child").click();
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
})
@ -87,7 +87,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("下拉后直接点击外部的触发的confirm", function (done) {
it("下拉后直接点击外部的触发的confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -99,7 +99,7 @@ describe("YearQuarterCombo", function () {
BI.nextTick(function () {
$("body").mousedown();
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).to.equal("none");
expect(dateCombo.element.find(".bi-year-quarter-trigger + .bi-popup-view").css("display")).toBe("none");
dateCombo.destroy();
done();
}, 300);
@ -111,7 +111,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("点击清空", function (done) {
it("点击清空", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -127,7 +127,7 @@ describe("YearQuarterCombo", function () {
dateCombo.element.find(".bi-year-quarter-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-quarter-popup .bi-text:contains(清除)").parent().click();
expect(BI.isNull(dateCombo.getValue())).to.equal(true);
expect(BI.isNull(dateCombo.getValue())).toBe(true);
dateCombo.destroy();
done();
})
@ -136,7 +136,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("点击本季度", function (done) {
it("点击本季度", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -146,7 +146,7 @@ describe("YearQuarterCombo", function () {
BI.nextTick(function () {
dateCombo.element.find(".bi-year-quarter-popup .bi-text:contains(本季度)").parent().click();
var date = BI.getDate();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: date.getFullYear(),
@ -162,7 +162,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("点击确定", function (done) {
it("点击确定", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -178,7 +178,7 @@ describe("YearQuarterCombo", function () {
dateCombo.element.find(".bi-year-quarter-trigger .bi-basic-button").click();
BI.nextTick(function () {
dateCombo.element.find(".bi-year-quarter-popup .bi-text:contains(确定)").parent().click();
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 1,
value: {
year: 2018,
@ -193,7 +193,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("测试动态默认值", function () {
it("测试动态默认值", () => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -206,7 +206,7 @@ describe("YearQuarterCombo", function () {
}
}
});
expect(dateCombo.getValue()).to.deep.equal({
expect(dateCombo.getValue()).toEqual({
type: 2,
value: {
year: -1,
@ -220,7 +220,7 @@ describe("YearQuarterCombo", function () {
/**
* test_author_windy
*/
it("trigger的输入日期后confirm", function (done) {
it("trigger的输入日期后confirm", done => {
var dateCombo = BI.Test.createWidget({
type: "bi.dynamic_year_quarter_combo",
width: 220,
@ -240,7 +240,7 @@ describe("YearQuarterCombo", function () {
input.val("2");
BI.Test.triggerKeyDown(dateCombo.element.find(".bi-year-quarter-trigger .bi-input"), null, BI.KeyCode.ENTER, function () {
BI.delay(function () {
expect(dateCombo.element.find(".bi-year-quarter-trigger .bi-text-button").text()).to.equal("2018年2季度");
expect(dateCombo.element.find(".bi-year-quarter-trigger .bi-text-button").text()).toBe("2018年2季度");
dateCombo.destroy();
done();
}, 300);

3
packages/fineui/test/prepare.js

@ -0,0 +1,3 @@
while (BI.prepares && BI.prepares.length > 0) {
BI.prepares.shift()()
}

71
packages/fineui/test/utils.js

@ -0,0 +1,71 @@
const onetimeAfterEach = []
afterEach(() => {
while(onetimeAfterEach.length > 0) {
onetimeAfterEach.shift()()
}
});
function registeCloser(...f) {
onetimeAfterEach.unshift(...f)
};
function sleep(t) {
return new Promise(resolve => setTimeout(() => {
resolve()
}, t))
};
function createWidget(widgetJson) {
var widget = BI.createWidget(BI.extend(widgetJson, {
root: true
}));
widget.element.appendTo("body");
registeCloser(() => {
widget.destroy()
});
return widget;
};
/**
* 模拟一次输入框的keydown事件
*/
function triggerKeyDown (element, value, keyCode, callback) {
// keydown
var e = BI.$.Event("keydown");
e.keyCode = keyCode;
element.trigger(e);
// input
BI.isNotNull(value) && element.val(value);
var e1 = BI.$.Event("input");
e1.originalEvent = {};
e1.keyCode = keyCode;
element.trigger(e1);
// keyup 至少等300ms后触发
var e2 = BI.$.Event("keyup");
e2.keyCode = keyCode;
element.trigger(e2);
BI.delay(function () {
callback();
}, 300);
};
/**
* 模拟一次鼠标hover
*/
function triggerMouseover(element, callback) {
// keydown
var e = BI.$.Event("mouseover");
element.trigger(e);
callback && callback();
};
BI.Test = {};
BI.extend(BI.Test, {
registeCloser,
sleep,
createWidget,
triggerKeyDown,
triggerMouseover
})

2
packages/fineui/tsconfig.json

@ -22,7 +22,7 @@
"noFallthroughCasesInSwitch": true,
"emitDeclarationOnly": true,
"paths": {
"@": ["src"]
"@/*": ["src/*"]
}
},
"include": ["typescript/*.ts", "typescript/**/*.ts", "types/*.d.ts", "src/*.js", "src/**/*.js"],

Loading…
Cancel
Save