forked from fanruan/fineui
Compare commits
4 Commits
master
...
research/t
Author | SHA1 | Date |
---|---|---|
Zoupers.Zou-邹清原 | 4fc41d599e | 6 months ago |
Zoupers | cfe8ce1d6c | 7 months ago |
Zoupers | d8448dcd38 | 7 months ago |
Zoupers | feca9ef16b | 7 months ago |
123 changed files with 1495 additions and 1331 deletions
@ -1,2 +1,2 @@ |
|||||||
puppeteer_download_host=https://npm.taobao.org/mirrors |
PUPPETEER_DOWNLOAD_BASE_URL=https://cdn.npmmirror.com/binaries/chrome-for-testing |
||||||
@fui:registry=https://npm.fineres.com/ |
@fui:registry=https://npm.fineres.com/ |
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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; |
@ -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", |
||||||
|
] |
||||||
|
}); |
||||||
|
}; |
@ -1,31 +1,31 @@ |
|||||||
/** |
/** |
||||||
* Created by windy on 2018/01/23. |
* Created by windy on 2018/01/23. |
||||||
*/ |
*/ |
||||||
describe("dateFunctionTest", function () { |
describe("dateFunctionTest", () => { |
||||||
|
|
||||||
before(function () { |
beforeAll(() => { |
||||||
|
|
||||||
}); |
}); |
||||||
|
|
||||||
/** |
/** |
||||||
* test_author_windy |
* test_author_windy |
||||||
*/ |
*/ |
||||||
it("getWeekNumber", function () { |
it("getWeekNumber", () => { |
||||||
expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).to.equal("2004-53"); |
expect(BI.print(BI.getDate(2005, 0, 1), "%Y-%W")).toBe("2004-53"); |
||||||
expect(BI.print(BI.getDate(2005, 0, 2), "%Y-%W")).to.equal("2004-53"); |
expect(BI.print(BI.getDate(2005, 0, 2), "%Y-%W")).toBe("2004-53"); |
||||||
expect(BI.print(BI.getDate(2005, 11, 31), "%Y-%W")).to.equal("2005-52"); |
expect(BI.print(BI.getDate(2005, 11, 31), "%Y-%W")).toBe("2005-52"); |
||||||
expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).to.equal("2007-01"); |
expect(BI.print(BI.getDate(2007, 0, 1), "%Y-%W")).toBe("2007-01"); |
||||||
expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).to.equal("2007-52"); |
expect(BI.print(BI.getDate(2007, 11, 30), "%Y-%W")).toBe("2007-52"); |
||||||
expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).to.equal("2008-01"); |
expect(BI.print(BI.getDate(2007, 11, 31), "%Y-%W")).toBe("2008-01"); |
||||||
expect(BI.print(BI.getDate(2008, 0, 1), "%Y-%W")).to.equal("2008-01"); |
expect(BI.print(BI.getDate(2008, 0, 1), "%Y-%W")).toBe("2008-01"); |
||||||
expect(BI.print(BI.getDate(2008, 11, 28), "%Y-%W")).to.equal("2008-52"); |
expect(BI.print(BI.getDate(2008, 11, 28), "%Y-%W")).toBe("2008-52"); |
||||||
expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).to.equal("2009-01"); |
expect(BI.print(BI.getDate(2008, 11, 29), "%Y-%W")).toBe("2009-01"); |
||||||
expect(BI.print(BI.getDate(2008, 11, 30), "%Y-%W")).to.equal("2009-01"); |
expect(BI.print(BI.getDate(2008, 11, 30), "%Y-%W")).toBe("2009-01"); |
||||||
expect(BI.print(BI.getDate(2008, 11, 31), "%Y-%W")).to.equal("2009-01"); |
expect(BI.print(BI.getDate(2008, 11, 31), "%Y-%W")).toBe("2009-01"); |
||||||
expect(BI.print(BI.getDate(2009, 0, 1), "%Y-%W")).to.equal("2009-01"); |
expect(BI.print(BI.getDate(2009, 0, 1), "%Y-%W")).toBe("2009-01"); |
||||||
expect(BI.print(BI.getDate(2009, 11, 31), "%Y-%W")).to.equal("2009-53"); |
expect(BI.print(BI.getDate(2009, 11, 31), "%Y-%W")).toBe("2009-53"); |
||||||
expect(BI.print(BI.getDate(2010, 0, 1), "%Y-%W")).to.equal("2009-53"); |
expect(BI.print(BI.getDate(2010, 0, 1), "%Y-%W")).toBe("2009-53"); |
||||||
expect(BI.print(BI.getDate(2010, 0, 2), "%Y-%W")).to.equal("2009-53"); |
expect(BI.print(BI.getDate(2010, 0, 2), "%Y-%W")).toBe("2009-53"); |
||||||
expect(BI.print(BI.getDate(2010, 0, 3), "%Y-%W")).to.equal("2009-53"); |
expect(BI.print(BI.getDate(2010, 0, 3), "%Y-%W")).toBe("2009-53"); |
||||||
}); |
}); |
||||||
}); |
}); |
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue