Skip to content

Commit

Permalink
Merge branch 'feature/opt-ue' of https://github.com/XiaoMi/hiui into …
Browse files Browse the repository at this point in the history
…feature/opt-ue
  • Loading branch information
Wugaoliang committed Jan 19, 2020
2 parents 4dc289d + 5228c57 commit cb3859d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions components/select/SelectDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class SelectDropdown extends Component {
}
}
static getDerivedStateFromProps (nextProps, prevState) {
if (nextProps.selectedItems.length > 0 && prevState.searchbarValue.length === 0 && nextProps.mode === 'single' && nextProps.isOnSearch) {
return { filterItems: prevState.cachedropdownItems, searchbarValue: nextProps.show ? prevState.searchbarValue : '' }
} else {
return { filterItems: nextProps.dropdownItems, searchbarValue: nextProps.show ? prevState.searchbarValue : '' }
}
const {selectedItems, mode, isOnSearch, dropdownItems, show} = nextProps
const {searchbarValue, cachedropdownItems} = prevState
const _filterItems = selectedItems.length > 0 && searchbarValue.length === 0 && mode === 'single' && isOnSearch ? cachedropdownItems : dropdownItems
const _searchbarValue = show ? searchbarValue : ''
return {filterItems: _filterItems, searchbarValue: _searchbarValue}
}
componentDidMount () {
this.props.searchable && this.searchbar.focus()
Expand Down
24 changes: 12 additions & 12 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ module.exports = {
coverageReporters: ['json-summary', 'text', 'lcov'],

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: [
// '<rootDir>/components/**/*',
// '!<rootDir>/components/table/**/*',
// '!<rootDir>/components/nav-menu/**/*',
// '!<rootDir>/components/**/style/**/*',
// '!<rootDir>/components/**/__test__/**/*',
// '!<rootDir>/components/**/(*-legacy)/**/*'
// ],
// 本地单测使用
// 1. 修改范围 <rootDir>/components/[组件名称]/**/*
// 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率
collectCoverageFrom: [
'<rootDir>/components/select/**/*',
'<rootDir>/components/**/*',
'!<rootDir>/components/table/**/*',
'!<rootDir>/components/nav-menu/**/*',
'!<rootDir>/components/**/style/**/*',
'!<rootDir>/components/**/__test__/**/*',
'!<rootDir>/components/**/(*-legacy)/**/*'
],
// 本地单测使用
// 1. 修改范围 <rootDir>/components/[组件名称]/**/*
// 2. 运行单测命令 npx jest components/date-picker/__tests__/index.test.js --coverage 即可看到当前文件夹的覆盖率
// collectCoverageFrom: [
// '<rootDir>/components/select/**/*',
// '!<rootDir>/components/table/**/*',
// '!<rootDir>/components/nav-menu/**/*',
// '!<rootDir>/components/**/style/**/*',
// '!<rootDir>/components/**/__test__/**/*',
// '!<rootDir>/components/**/(*-legacy)/**/*'
// ],

// The test environment that will be used for testing
testEnvironment: 'jest-environment-jsdom-global',
Expand Down

0 comments on commit cb3859d

Please sign in to comment.