diff --git a/CHANGELOG.md b/CHANGELOG.md index aa9b0093e..fcbd39c53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ toc: false docClass: timeline --- +## 🌈 1.1.12 `2023-07-11` +### 🚀 Features +- `PullDownRefresh`: 增加 show-scrollbar 属性 @lolhezihehe ([#2163](https://github.com/Tencent/tdesign-miniprogram/pull/2163)) +### 🐞 Bug Fixes +- `Rate`: 修复无法点击的问题 @AntzyMo ([#2158](https://github.com/Tencent/tdesign-miniprogram/pull/2158)) +- `Rate`: 使事件冒泡至上层元素 @LeeJim ([#2168](https://github.com/Tencent/tdesign-miniprogram/pull/2168)) +- `DateTimePicker`: 修复无法选择的问题 @betavs ([#2169](https://github.com/Tencent/tdesign-miniprogram/pull/2169)) +- `Tabs`: 修复超出时滚动不流畅的问题 @LeeJim ([#2170](https://github.com/Tencent/tdesign-miniprogram/pull/2170)) +- `TreeSelect`: 修复多选时 value 使用空数组报错的问题 @LeeJim ([#2173](https://github.com/Tencent/tdesign-miniprogram/pull/2173)) +### 🚧 Others +- 移除开启 virtual-host 场景的 snapshot 测试 @LeeJim ([#2161](https://github.com/Tencent/tdesign-miniprogram/pull/2161)) +- 修复控制台告警 @betavs ([#2164](https://github.com/Tencent/tdesign-miniprogram/pull/2164)) + ## 🌈 1.1.11 `2023-07-04` ### 🚀 Features - `CheckboxGroup`: 新增 borderless 属性 @betavs ([#2124](https://github.com/Tencent/tdesign-miniprogram/pull/2124)) diff --git a/jest.virtualHost.config.js b/jest.virtualHost.config.js deleted file mode 100644 index 1f25661ea..000000000 --- a/jest.virtualHost.config.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * virtualHost 的开启和关闭对 dom 渲染会产生较大差异,且在单测中无法通过 selectComponent 获取子组件实例, - * 故设置两个 jest 配置文件,区分 virtualHost 的两种状态。 - */ - -module.exports = { - verbose: true, - testEnvironment: 'jsdom', - testURL: 'http://localhost/', - moduleFileExtensions: ['js', 'ts'], - moduleNameMapper: { - '^tdesign-miniprogram/(.*)': '/src/$1', - }, - testMatch: ['/src/**/__test__/**/*.test.{js,ts}'], - collectCoverageFrom: ['/src/**/*.{js,ts}', '!**/__test__/**', '!**/_example/**'], - collectCoverage: true, - coverageProvider: 'v8', - coverageDirectory: '/test/unit-virtualHost/coverage', - reporters: [ - 'default', - [ - './node_modules/jest-html-reporter', - { - pageTitle: 'TDesign-miniprogram Unit Test Report(virtualHost)', - outputPath: './test/unit-virtualHost/report/test-report.html', - }, - ], - ], - setupFiles: ['/script/test/virtualHostSetup.js'], - coverageReporters: ['html', 'json-summary'], - globals: { - CONFIG_PREFIX: 't', - }, - globalSetup: '/script/test/globalSetup.js', - snapshotSerializers: ['miniprogram-simulate/jest-snapshot-plugin'], - snapshotResolver: '/script/test/snapshotResolver.js', -}; diff --git a/package.json b/package.json index bf6151f77..76d3b025d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tdesign-miniprogram", "purename": "tdesign", - "version": "1.1.11", + "version": "1.1.12", "description": "tdesign-miniprogram", "title": "tdesign-ßminiprogram", "main": "miniprogram_dist/index.js", @@ -31,9 +31,8 @@ "site:intranet": "cd site && vite build --mode intranet", "site:prerender": "node script/prerender.mjs", "cover": "jest --coverage", - "test": "jest && jest -c jest.virtualHost.config.js && jest -c jest.e2e.config.js", - "test:virtualHost": "jest -c jest.virtualHost.config.js", - "test:snap-update": "npm run test:virtualHost -- -u && npm run test:unit -- -u", + "test": "jest && jest -c jest.e2e.config.js", + "test:snap-update": "npm run test:unit -- -u", "test:demo": "node gen-demo-test.js", "test:unit": "jest", "test:e2e": "jest -c jest.e2e.config.js", @@ -94,7 +93,7 @@ "lodash": "^4.17.21", "miniprogram-api-typings": "^3.4.6", "miniprogram-automator": "^0.10.0", - "miniprogram-simulate": "^1.5.7", + "miniprogram-simulate": "^1.6.0", "npm-run-all": "^4.1.5", "playwright": "^1.19.1", "prettier": "^2.0.5", diff --git a/script/test/setup.js b/script/test/setup.js index af8a50d11..5b32222d7 100644 --- a/script/test/setup.js +++ b/script/test/setup.js @@ -1,5 +1,6 @@ import Path from 'path'; import simulate from 'miniprogram-simulate'; +import similateApi from 'miniprogram-simulate/src/api'; import { canUseVirtualHost } from '../../src/common/version'; global.getApp = () => null; @@ -13,5 +14,27 @@ global.load = (path, demoName) => { }, }); }; - +global.wx = { + ...similateApi, + getSystemInfoSync: () => { + return { + SDKVersion: '2.19.1', + batteryLevel: 100, + benchmarkLevel: 1, + brand: 'devtools', + fontSizeSetting: 16, + language: 'zh_CN', + model: 'iPhone 7 Plus', + pixelRatio: 3, + platform: 'devtools', + screenHeight: 736, + screenWidth: 414, + statusBarHeight: 20, + system: 'iOS 10.0.1', + version: '6.6.3', + windowHeight: 672, + windowWidth: 414, + }; + }, +}; global.VIRTUAL_HOST = canUseVirtualHost(); diff --git a/script/test/snapshotResolver.js b/script/test/snapshotResolver.js deleted file mode 100644 index 47664f502..000000000 --- a/script/test/snapshotResolver.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - // resolves from test to snapshot path - resolveSnapshotPath: (testPath, snapshotExtension) => - testPath.replace('__test__', '__test__/__virtualHostSnapshot__') + snapshotExtension, - - // resolves from snapshot to test path - resolveTestPath: (snapshotFilePath, snapshotExtension) => - snapshotFilePath.replace('__test__/__virtualHostSnapshot__', '__test__').slice(0, -snapshotExtension.length), - - // Example test path, used for preflight consistency check of the implementation above - testPathForConsistencyCheck: 'some/__tests__/example.test.js', -}; diff --git a/script/test/virtualHostSetup.js b/script/test/virtualHostSetup.js deleted file mode 100644 index 7ddc3fc70..000000000 --- a/script/test/virtualHostSetup.js +++ /dev/null @@ -1,43 +0,0 @@ -import Path from 'path'; -import simulate from 'miniprogram-simulate'; -import similateApi from 'miniprogram-simulate/src/api'; -import { canUseVirtualHost } from '../../src/common/version'; - -global.getApp = () => null; -global.Page = (options) => Component(options); -global.load = (path, demoName) => { - return simulate.load(path, demoName, { - less: true, - rootPath: Path.resolve(__dirname, '../../src'), - compilerOptions: { - maxBuffer: 1024 * 1024 * 2, - }, - }); -}; - -global.wx = { - ...similateApi, - getSystemInfoSync: () => { - return { - // SDKVersion > 2.19.2, 开启 VirtualHost - SDKVersion: '2.20.0', - batteryLevel: 100, - benchmarkLevel: 1, - brand: 'devtools', - fontSizeSetting: 16, - language: 'zh_CN', - model: 'iPhone 7 Plus', - pixelRatio: 3, - platform: 'devtools', - screenHeight: 736, - screenWidth: 414, - statusBarHeight: 20, - system: 'iOS 10.0.1', - version: '6.6.3', - windowHeight: 672, - windowWidth: 414, - }; - }, -}; - -global.VIRTUAL_HOST = canUseVirtualHost(); diff --git a/src/common/template/button.wxml b/src/common/template/button.wxml index 27d6bc493..faff528bd 100644 --- a/src/common/template/button.wxml +++ b/src/common/template/button.wxml @@ -14,7 +14,7 @@ size="{{size || 'medium'}}" variant="{{variant || 'base'}}" open-type="{{openType || ''}}" - hover-class="{{hoverClass}}" + hover-class="{{hoverClass || ''}}" hover-stop-propagation="{{hoverStopPropagation || false}}" hover-start-time="{{hoverStartTime || 20}}" hover-stay-time="{{hoverStayTime || 70}}" diff --git a/src/dialog/index.ts b/src/dialog/index.ts index 5cfac79a5..f9c538f8b 100644 --- a/src/dialog/index.ts +++ b/src/dialog/index.ts @@ -37,7 +37,7 @@ interface DialogActionOptionsType { } const defaultOptions = { - actions: false, + actions: [], buttonLayout: props.buttonLayout.value, cancelBtn: props.cancelBtn.value, closeOnOverlayClick: props.closeOnOverlayClick.value, diff --git a/src/message/__test__/index.test.js b/src/message/__test__/index.test.js index f0192ab51..4299fa21e 100644 --- a/src/message/__test__/index.test.js +++ b/src/message/__test__/index.test.js @@ -1,13 +1,8 @@ import simulate from 'miniprogram-simulate'; import path from 'path'; -import similateApi from 'miniprogram-simulate/src/api'; import Message from '../index'; import * as Util from '../../common/utils'; -global.wx = { - ...similateApi, -}; - const mockGetRect = jest.spyOn(Util, 'getRect'); mockGetRect.mockImplementation(() => { return new Promise((resolve) => resolve({ height: 46, width: 156 })); diff --git a/src/navbar/__test__/__snapshots__/index.test.js.snap b/src/navbar/__test__/__snapshots__/index.test.js.snap index 198a82e20..803ab3731 100644 --- a/src/navbar/__test__/__snapshots__/index.test.js.snap +++ b/src/navbar/__test__/__snapshots__/index.test.js.snap @@ -40,7 +40,7 @@ exports[`navbar :base 2`] = ` { const { width, left } = rect; @@ -77,7 +77,7 @@ export default class Rate extends SuperComponent { }, onTouchMove(e: WechatMiniprogram.TouchEvent) { this.onTouch(e, 'move'); - this.showAlertText() + this.showAlertText(); }, onTouchEnd() { this.touchEnd = true; diff --git a/src/rate/rate.wxml b/src/rate/rate.wxml index 5feb342b7..961afe23f 100644 --- a/src/rate/rate.wxml +++ b/src/rate/rate.wxml @@ -5,11 +5,11 @@ diff --git a/src/tree-select/tree-select.ts b/src/tree-select/tree-select.ts index 87a2e0810..784400736 100644 --- a/src/tree-select/tree-select.ts +++ b/src/tree-select/tree-select.ts @@ -66,7 +66,7 @@ export default class TreeSelect extends SuperComponent { if (multiple) { const finalValue = this.data.value || this.data.defaultValue; - if (!Array.isArray(finalValue[leafLevel])) { + if (finalValue[leafLevel] != null && !Array.isArray(finalValue[leafLevel])) { throw TypeError('应传入数组类型的 value'); } }