Skip to content

Commit

Permalink
Merge pull request #17 from FriedRiceNoodles/test/fix
Browse files Browse the repository at this point in the history
test(dropdown): fieed some broken test of dropdown
  • Loading branch information
FriedRiceNoodles authored Feb 22, 2024
2 parents 5be9e98 + acd24d9 commit 9912ff0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
14 changes: 7 additions & 7 deletions docs/example/Dropdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ demo:

## 属性 - Attributes & Properties

| 属性 | 说明 | 类型 | 默认值 |
| --------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------ |
| placement | 弹出方向 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` |
| margin | trigger 与下拉内容的间距,单位是`px` | `number` | 4 |
| mouseEnterDelay | hover 模式下,鼠标移入 trigger 多久后展示下拉菜单的内容,单位是`ms` | `number` | 100 |
| mouseLeaveDelay | hover 模式下,鼠标移出下拉菜单多久后隐藏下拉菜单的内容,单位是`ms` | `number` | 100 |
| triggerAction | 触发下拉菜单的方式 | `click` \| `hover` | `hover` |
| 属性 | 说明 | 类型 | 默认值 |
| ----------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------ |
| placement | 弹出方向 | `bottomLeft` \| `bottom` \| `bottomRight` \| `topLeft` \| `top` \| `topRight` | `bottomLeft` |
| margin | trigger 与下拉内容的间距,单位是`px` | `number` | 4 |
| mouseEnterDelay <br/> (mouse-enter-delay) | hover 模式下,鼠标移入 trigger 多久后展示下拉菜单的内容,单位是`ms` | `number` | 100 |
| mouseLeaveDelay <br/> (mouse-leave-delay) | hover 模式下,鼠标移出下拉菜单多久后隐藏下拉菜单的内容,单位是`ms` | `number` | 100 |
| triggerAction <br/> (trigger-action) | 触发下拉菜单的方式 | `click` \| `hover` | `hover` |

## 事件 - Events

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"scripts": {
"build": "pnpm build:all",
"build:all": "cd packages/banana && pnpm run build && cd ../banana-react && pnpm run build",
"dev": "npm run dev:all",
"dev:all": "cd packages/banana && npm run dev & cd packages/banana-react && npm run dev & dumi dev",
"dev": "pnpm run dev:all",
"dev:all": "cd packages/banana && pnpm run dev & cd packages/banana-react && pnpm run dev & dumi dev",
"dev:dumi": "dumi dev",
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d docs-dist",
"lint": "npm run lint:es",
"lint": "pnpm run lint:es",
"lint:es": "eslint \"packages/**/{src,styles,bin}/**/*.{js,jsx,ts,tsx}\"",
"prepare": "husky install && dumi setup",
"start": "npm run dev"
"start": "pnpm run dev",
"test": "cd packages/banana && pnpm run test"
},
"commitlint": {
"extends": [
Expand Down
14 changes: 7 additions & 7 deletions packages/banana/src/dropdown/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('b-dropdown', () => {

it('should open the dropdown when mouse enter the trigger after mouseEnterDelay', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown mouseEnterDelay="200">
<b-dropdown mouse-enter-delay="200">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand All @@ -47,7 +47,7 @@ describe('b-dropdown', () => {

it('should close the dropdown when mouse leave the dropdown content after mouseLeaveDelay', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown mouseLeaveDelay="200">
<b-dropdown mouse-leave-delay="200">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('b-dropdown', () => {
describe('when triggerAction is click', () => {
it('should open the dropdown when click the trigger', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown triggerAction="click">
<b-dropdown trigger-action="click">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('b-dropdown', () => {

it('should doing nothing when mouse enter the trigger', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown triggerAction="click">
<b-dropdown trigger-action="click">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('b-dropdown', () => {
describe('when keydown', () => {
it('should open the dropdown when press Enter', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown triggerAction="click">
<b-dropdown trigger-action="click">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand All @@ -175,7 +175,7 @@ describe('b-dropdown', () => {

it('should close the dropdown when press Escape', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown triggerAction="click">
<b-dropdown trigger-action="click">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('b-dropdown', () => {

it('should open or close the dropdown when press Space', async () => {
const element = await fixture<BDropdown>(html`
<b-dropdown triggerAction="click">
<b-dropdown trigger-action="click">
<b-button>Banana</b-button>
<b-menu slot="drop">
<b-menu-item>Option 1</b-menu-item>
Expand Down

0 comments on commit 9912ff0

Please sign in to comment.