-
Notifications
You must be signed in to change notification settings - Fork 330
feat(tag): [tag] add round prop to support circular border radius #3846
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
base: dev
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||||||||||||
| <template> | ||||||||||||||||||||
| <div class="tag-round-demo"> | ||||||||||||||||||||
| <h4>Round 属性示例</h4> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <tiny-tag type="primary" round>圆角标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="success" round>成功标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="warning" round>警告标签</tiny-tag> | ||||||||||||||||||||
| <tiny-tag type="danger" round>危险标签</tiny-tag> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <tiny-tag type="info" round only-icon> | ||||||||||||||||||||
| <tiny-icon-heartempty /> | ||||||||||||||||||||
| </tiny-tag> | ||||||||||||||||||||
| </div> | ||||||||||||||||||||
| </template> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <script setup> | ||||||||||||||||||||
| import { TinyTag } from '@opentiny/vue' | ||||||||||||||||||||
| import { IconHeartempty } from '@opentiny/vue-icon' | ||||||||||||||||||||
| const tinyIconHeartempty = IconHeartempty() | ||||||||||||||||||||
| </script> | ||||||||||||||||||||
|
Comment on lines
+16
to
+21
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. Remove unused variable or register the component properly. The variable Consider one of these solutions: Option 1: Remove the unused variable and import (if auto-registration works): <script setup>
import { TinyTag } from '@opentiny/vue'
-import { IconHeartempty } from '@opentiny/vue-icon'
-
-const tinyIconHeartempty = IconHeartempty()
</script>Option 2: Register and use the component explicitly: <script setup>
import { TinyTag } from '@opentiny/vue'
import { IconHeartempty } from '@opentiny/vue-icon'
-const tinyIconHeartempty = IconHeartempty()
+const TinyIconHeartempty = IconHeartempty()
</script>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| <style scoped> | ||||||||||||||||||||
| .tiny-tag { | ||||||||||||||||||||
| margin-right: 12px; | ||||||||||||||||||||
| margin-bottom: 12px; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| h4 { | ||||||||||||||||||||
| margin-bottom: 16px; | ||||||||||||||||||||
| color: #333; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| </style> | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||
| import { test, expect } from '@playwright/test' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| test('圆角', async ({ page }) => { | ||||||||||||||||||||||||||||
| page.on('pageerror', (exception) => expect(exception).toBeNull()) | ||||||||||||||||||||||||||||
|
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. Improve error handling for better debugging. Using Apply this diff to improve error visibility: - page.on('pageerror', (exception) => expect(exception).toBeNull())
+ page.on('pageerror', (exception) => {
+ throw new Error(`Unexpected page error: ${exception}`)
+ })Or simply remove the handler to let errors fail the test naturally with full stack traces. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| await page.goto('tag#round') | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const tags = page.locator('.all-demos-container').locator('.tiny-tag') | ||||||||||||||||||||||||||||
| const count = await tags.count() | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // 动态创建与元素数量相同的期望数组 | ||||||||||||||||||||||||||||
| await expect(tags).toHaveClass(Array(count).fill(/tiny-tag--round/)) | ||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+11
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. Test will pass with zero tags, losing validation effectiveness. The dynamic assertion Apply this diff to add meaningful validation: const tags = page.locator('.all-demos-container').locator('.tiny-tag')
const count = await tags.count()
+ // Ensure at least one round tag exists
+ expect(count).toBeGreaterThan(0)
+
// 动态创建与元素数量相同的期望数组
await expect(tags).toHaveClass(Array(count).fill(/tiny-tag--round/))
+
+ // Verify the first tag has the expected border-radius
+ await expect(tags.first()).toHaveCSS('border-radius', '9999px')This ensures:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <template> | ||
| <div class="tag-round-demo"> | ||
| <h4>Round 属性示例</h4> | ||
|
|
||
| <tiny-tag type="primary" :round="true">圆角标签</tiny-tag> | ||
| <tiny-tag type="success" :round="true">成功标签</tiny-tag> | ||
| <tiny-tag type="warning" :round="true">警告标签</tiny-tag> | ||
| <tiny-tag type="danger" :round="true">危险标签</tiny-tag> | ||
|
|
||
| <tiny-tag type="info" :round="true" :only-icon="true"> | ||
| <template #default> | ||
| <icon-heartempty /> | ||
| </template> | ||
| </tiny-tag> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { Tag, Icon } from '@opentiny/vue' | ||
|
|
||
| export default { | ||
| components: { | ||
| TinyTag: Tag, | ||
| IconHeartempty: Icon.IconHeartempty | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .tiny-tag { | ||
| margin-right: 12px; | ||
| margin-bottom: 12px; | ||
| } | ||
|
|
||
| h4 { | ||
| margin-bottom: 16px; | ||
| color: #333; | ||
| } | ||
| </style> |
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.
Clarify the English description.
The English description "Whether it is a circular mode" is ambiguous. "Circular" suggests a circle shape, but
roundhere refers to rounded corners (border-radius). The Chinese "圆角" correctly translates to "rounded corners."Apply this diff to improve clarity:
desc: { 'zh-CN': '是否为圆角的模式', - 'en-US': 'Whether it is a circular mode' + 'en-US': 'Whether to enable rounded corners' },📝 Committable suggestion
🤖 Prompt for AI Agents