-
Notifications
You must be signed in to change notification settings - Fork 338
fix(modal): [modal] add aria-* attribute #3941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,46 +3,53 @@ import { test, expect } from '@playwright/test' | |
| test('状态和图标', async ({ page }) => { | ||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||
| await page.goto('modal#status') | ||
| const modal = page.locator('.tiny-modal__status-wrapper svg').first() | ||
| const message = page.locator('.type__message') | ||
| const modal = page.locator( | ||
| '.tiny-modal__wrapper.is__visible > .tiny-modal__box > .tiny-modal__header > .tiny-modal__status-wrapper > svg' | ||
| ) | ||
| const message = page.locator('.type__message.is__visible') | ||
|
|
||
| // 信息提示图标 | ||
| await page.getByRole('button', { name: '信息提示图标' }).first().click() | ||
| await expect(modal).toHaveClass(/tiny-modal-svg__info/) | ||
| await page.getByRole('button', { name: '确定' }).click() | ||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '信息提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__info/) | ||
|
|
||
| // 成功提示图标 | ||
| await page.getByRole('button', { name: '成功提示图标' }).first().click() | ||
| await expect(modal).toHaveClass(/tiny-modal-svg__success/) | ||
| await page.getByRole('button', { name: '确定' }).click() | ||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '成功提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__success/) | ||
|
|
||
| // 警告提示图标 | ||
| await page.getByRole('button', { name: '警告提示图标' }).first().click() | ||
| await expect(modal).toHaveClass(/tiny-modal-svg__warning/) | ||
| await page.getByRole('button', { name: '确定' }).click() | ||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '警告提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__warning/) | ||
|
|
||
| // 错误提示图标 | ||
| await page.getByRole('button', { name: '错误提示图标' }).first().click() | ||
| await expect(modal).toHaveClass(/tiny-svg tiny-modal-svg__error/) | ||
| await page.getByRole('button', { name: '确定' }).click() | ||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '错误提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__error/) | ||
|
|
||
| // 加载提示图标 | ||
| await page.getByRole('button', { name: '加载提示图标' }).first().click() | ||
| await expect(modal).toHaveClass(/tiny-modal-svg__refresh/) | ||
| await page.getByRole('button', { name: '确定' }).click() | ||
|
|
||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '信息提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__info/) | ||
|
|
||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '成功提示图标' }).nth(1).click() | ||
| await expect(message.nth(1)).toHaveClass(/status__success/) | ||
|
|
||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '警告提示图标' }).nth(1).click() | ||
| await expect(message.nth(2)).toHaveClass(/status__warning/) | ||
|
|
||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '错误提示图标' }).nth(1).click() | ||
| await expect(message.nth(3)).toHaveClass(/status__error/) | ||
|
|
||
| // ----消息状态示例---- | ||
| await page.getByRole('button', { name: '加载提示图标' }).nth(1).click() | ||
| await expect(message).toHaveClass(/status__loading/) | ||
| await expect(message.nth(4)).toHaveClass(/status__loading/) | ||
|
Comment on lines
+36
to
+54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's read the test file to understand the full context
cat -n examples/sites/demos/pc/app/modal/status.spec.tsRepository: opentiny/tiny-vue Length of output: 2593 🏁 Script executed: # Search for message implementation with duration/timeout
fd -e 'ts' -e 'js' -e 'tsx' -e 'jsx' packages/vue/src -type f | xargs grep -l "type.*message" | head -10Repository: opentiny/tiny-vue Length of output: 231 🏁 Script executed: # Search for message component or factory that might handle auto-dismiss
find packages/vue/src -name "*message*" -type fRepository: opentiny/tiny-vue Length of output: 107 🏁 Script executed: # Look for duration property in message-related code
rg "duration" packages/vue/src --type ts --type js -B 3 -A 3 | grep -i message -A 3 -B 3 | head -50Repository: opentiny/tiny-vue Length of output: 1558 🏁 Script executed: # Check the modal implementation
head -200 packages/vue/src/modal/src/index.tsRepository: opentiny/tiny-vue Length of output: 3270 🏁 Script executed: # Look for duration-related logic in modal
rg "duration" packages/vue/src/modal/src/index.ts -B 2 -A 5Repository: opentiny/tiny-vue Length of output: 317 🏁 Script executed: # Find the setup implementation for modal
find packages/vue/src/modal -name "*.ts" -o -name "*.tsx" -o -name "*.js" | grep -v test | grep -v __tests__Repository: opentiny/tiny-vue Length of output: 128 🏁 Script executed: # Search for where duration is used in the modal component
rg "duration" packages/vue/src/modal -B 3 -A 3 --type-listRepository: opentiny/tiny-vue Length of output: 450 🏁 Script executed: # Search for where duration is used in the modal component
rg "duration" packages/vue/src/modal -B 3 -A 3Repository: opentiny/tiny-vue Length of output: 3183 🏁 Script executed: # Look at the full duration test to understand the auto-dismiss behavior
sed -n '60,80p' packages/vue/src/modal/__tests__/modal.test.tsxRepository: opentiny/tiny-vue Length of output: 560 🏁 Script executed: # Search for the actual implementation that handles auto-dismiss (likely onMounted or watch)
rg "onMounted\|onBeforeUnmount\|watch\|setTimeout" packages/vue/src/modal/src/pc.vue -B 2 -A 8 | head -100Repository: opentiny/tiny-vue Length of output: 43 🏁 Script executed: # Look for the modal setup logic - check what $setup does
rg "\$setup" packages/vue/src/modal/src/index.ts -B 5 -A 5Repository: opentiny/tiny-vue Length of output: 43 🏁 Script executed: # Check if there's a setup.ts or similar file
find packages/vue/src/modal -name "*setup*" -type fRepository: opentiny/tiny-vue Length of output: 43 🏁 Script executed: # Look for JavaScript/TypeScript implementation files in modal
ls -la packages/vue/src/modal/src/Repository: opentiny/tiny-vue Length of output: 357 🏁 Script executed: # Read the pc.vue implementation to find duration-based auto-dismiss logic
cat -n packages/vue/src/modal/src/pc.vueRepository: opentiny/tiny-vue Length of output: 13871 🏁 Script executed: # Look for the renderless modal implementation
find . -path "*/vue-renderless/modal*" -type f 2>/dev/null | head -20Repository: opentiny/tiny-vue Length of output: 43 🏁 Script executed: # Search for renderless modal in node_modules or source
rg "vue-renderless/modal" packages/vue/src -lRepository: opentiny/tiny-vue Length of output: 170 🏁 Script executed: # Find the renderless implementation in the repo
find . -name "modal" -type d | grep -i renderlessRepository: opentiny/tiny-vue Length of output: 92 🏁 Script executed: # Check if renderless is a separate package directory
ls -la packages/ | grep renderlessRepository: opentiny/tiny-vue Length of output: 122 🏁 Script executed: # Search for where the modal duration auto-dismiss might be implemented
rg "setTimeout\|setInterval" packages/ -l --max-count 5 | grep -i modalRepository: opentiny/tiny-vue Length of output: 43 🏁 Script executed: # Check the renderless modal implementation
ls -la packages/renderless/src/modal/Repository: opentiny/tiny-vue Length of output: 298 🏁 Script executed: # Look for the modal setup logic in renderless
find packages/renderless/src/modal -name "*.ts" -o -name "*.js"Repository: opentiny/tiny-vue Length of output: 136 🏁 Script executed: # Check the vue.ts file for duration handling
cat -n packages/renderless/src/modal/vue.tsRepository: opentiny/tiny-vue Length of output: 5317 🏁 Script executed: # Search for duration in the renderless modal implementation
rg "duration" packages/renderless/src/modal/ -B 3 -A 10Repository: opentiny/tiny-vue Length of output: 1921 🏁 Script executed: # Get more context around the duration setTimeout calls
sed -n '1,150p' packages/renderless/src/modal/index.ts | tail -80Repository: opentiny/tiny-vue Length of output: 2167 🏁 Script executed: # Get the specific section with the first duration setTimeout
sed -n '200,300p' packages/renderless/src/modal/index.tsRepository: opentiny/tiny-vue Length of output: 2797 🏁 Script executed: # Look for the mouseEnterEvent and mouseLeaveEvent handlers
rg "mouseEnterEvent|mouseLeaveEvent" packages/renderless/src/modal/index.ts -B 2 -A 10Repository: opentiny/tiny-vue Length of output: 444 Add explicit timing controls to avoid race conditions between auto-dismiss and assertions. Messages auto-dismiss after
🤖 Prompt for AI Agents |
||
| }) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, examine the test file to see the actual changes head -20 examples/sites/demos/pc/app/modal/modal-size.spec.tsRepository: opentiny/tiny-vue
Length of output: 178
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 502
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 814
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 1802
🏁 Script executed:
# Read the entire modal-size.spec.ts file to see context cat examples/sites/demos/pc/app/modal/modal-size.spec.tsRepository: opentiny/tiny-vue
Length of output: 727
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 163
🏁 Script executed:
# Check the modal-size.vue demo to see if .status__question class is present cat examples/sites/demos/pc/app/modal/modal-size.vueRepository: opentiny/tiny-vue
Length of output: 1490
🏁 Script executed:
# Also check the composition-api version cat examples/sites/demos/pc/app/modal/modal-size-composition-api.vueRepository: opentiny/tiny-vue
Length of output: 1375
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 1133
🏁 Script executed:
# Check the status.vue file since it's likely related to status classes cat examples/sites/demos/pc/app/modal/status.vueRepository: opentiny/tiny-vue
Length of output: 3034
🏁 Script executed:
# Also check the status-composition-api version cat examples/sites/demos/pc/app/modal/status-composition-api.vueRepository: opentiny/tiny-vue
Length of output: 2874
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 88
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 1594
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 450
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 396
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 163
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 784
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 2928
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 43
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 856
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 1143
🏁 Script executed:
Repository: opentiny/tiny-vue
Length of output: 2339
🏁 Script executed:
# Check the test more carefully - does line 13 make sense with the selector from line 6? cat examples/sites/demos/pc/app/modal/modal-size.spec.tsRepository: opentiny/tiny-vue
Length of output: 727
Selector
.status__questionis incorrect—modal-size demo never applies this class.The test creates a modal via
Modal.confirm()without a status parameter, so the modal will never have the.status__questionclass. Use.type__confirmor.tiny-modal.is__visibleinstead, consistent with other modal tests (e.g., modal-resize.spec.ts, basic-usage.spec.ts).Also applies to: 13-13
🤖 Prompt for AI Agents