Skip to content

fix(dialog-box): [dialog-box] modify theme and demo #3198

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged

Conversation

James-9696
Copy link
Collaborator

@James-9696 James-9696 commented Mar 26, 2025

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style

    • Dialog boxes now feature updated button labels with improved spacing ("取 消" and "确 定") and reordered footer buttons for clarity.
    • Enhanced visual presentation with rounded buttons and a cleaner header/footer by removing unnecessary background colors.
    • Custom dialog content now displays simple text instead of alert components.
  • Theming

    • Dialog mask styling has been updated using CSS variable-based backgrounds for improved consistency and easier customization.

@github-actions github-actions bot added bug Something isn't working enhancement New feature or request (功能增强) labels Mar 26, 2025
Copy link

coderabbitai bot commented Mar 26, 2025

Walkthrough

The changes update various dialog box components and corresponding tests. Button order and text have been modified—for example, swapping the positions of “取消” and “确定” and adjusting them to “取 消” and “确 定” (i.e., adding or removing spaces). In some cases, a round attribute is added to buttons. Test files have been updated to use scoped locators (via a new demo variable) instead of the global page context. Additionally, a custom alert component was removed and replaced with plain text, and theme files now reference CSS variables for dialog mask backgrounds.

Changes

File(s) Change Summary
.../dialog-box/basic-usage-composition-api.vue, .../dialog-box/basic-usage.vue, .../dialog-box/right-dialog*.vue, .../dialog-box/destroy-on-close*.vue, .../dialog-box/transition-effect*.vue, .../dialog-box/double-dialog-height*.vue, .../dialog-box/draggable*.vue, .../dialog-box/secondary-dialog*.vue, .../dialog-box/open-close-events*.vue Reordered footer buttons, updated button labels (spacing adjustments: "确定"→"确 定", "取消"→"取 消"), and added round attribute to enhance visual styling.
.../dialog-box/custom-dialog-content*.vue, .../dialog-box/custom-dialog-footer*.vue, .../dialog-box/custom-dialog-title*.vue Removed <tiny-alert> in favor of a plain <b> element, updated text content, and removed background styling from footer and title for a refined look.
.../dialog-box/*.spec.ts (all test files) Refactored test selectors to use a scoped demo locator for specific demo elements and updated expectations for button labels with new spacing.
packages/theme/src/dialog-box/index.less, packages/theme/src/dialog-box/vars.less Introduced a new CSS variable for the dialog box mask background and applied the .inject-DialogBox-vars() mixin, moving towards a variable-based theming approach.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Script
    participant D as Demo Element (Locator)
    participant DB as Dialog Box
    T->>D: Locate demo element by ID (e.g., #close-on-click-modal)
    D->>DB: Scope search to dialog box within demo
    T->>DB: Trigger button click ("确 定" / "取 消")
    DB-->>T: Dialog action completes (e.g., hides dialog)
Loading

Possibly related PRs

Suggested labels

bug

Poem

I'm a little rabbit, hopping with delight,
Seeing buttons swap positions in the light.
"取 消" and "确 定" now dance in a row,
With tidy code and tests that glow.
I twitch my whiskers—this change makes my day,
A bunny-approved update, hip-hip-hooray!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/sites/demos/pc/app/dialog-box/basic-usage-composition-api.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/dialog-box/basic-usage.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/dialog-box/close-on-click-modal.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 35 others
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
examples/sites/demos/pc/app/dialog-box/open-close-events-composition-api.vue (1)

19-20: Updated Button Labels – Visual Consistency:
The button labels have been updated to "取 消" and "确 定" to match the new design guidelines. Please confirm that this spacing change is consistent with all dialog box components across the project.

examples/sites/demos/pc/app/dialog-box/custom-dialog-title.vue (1)

5-7: Title Template Styling – Removal of Hardcoded Background:
The inline style in the title slot now only specifies width and height, omitting any fixed background color. This change favors a theme-driven approach. Verify that the appearance matches the desired custom title design without the removed background.

examples/sites/demos/pc/app/dialog-box/custom-dialog-footer-composition-api.vue (1)

7-7: Footer Template – Simplified Inline Styling:
By removing the fixed background: #dddddd, the footer now relies on external styling or theme variables. Ensure that the readability and visual separation of the footer area remain acceptable across different themes.

examples/sites/demos/pc/app/dialog-box/right-dialog-composition-api.vue (1)

13-14: Footer Button Enhancement – Added round Attribute and Label Update:
The footer buttons now include the round attribute and display the labels "取 消" and "确 定". This update improves visual consistency and button styling. Please verify that the rounded appearance aligns with the overall UI design across the dialog components.

packages/theme/src/dialog-box/vars.less (1)

13-17: New CSS Variable for Dialog Box Mask Background:
The addition of --tv-DialogBox-mask-bg-color (set to var(--tv-color-bg-mask)) enhances theming flexibility for the dialog box's background mask. Ensure this variable is properly referenced in related style files (e.g., in index.less) and that it integrates seamlessly with the overall theme configuration.

examples/sites/demos/pc/app/dialog-box/custom-dialog-content.spec.ts (1)

10-10: Enhanced test coverage with content verification.

Adding an explicit check for the custom content text improves the test by verifying that the dialog displays the expected content.

Consider making the text matcher more precise by using an exact match instead of a regex pattern if the text is known and fixed:

- expect(demo.locator('b')).toHaveText(/自定义内容/)
+ expect(demo.locator('b')).toHaveText('自定义内容')
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 223fef7 and 8fdeb67.

📒 Files selected for processing (40)
  • examples/sites/demos/pc/app/dialog-box/basic-usage-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/basic-usage.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/basic-usage.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/close-on-click-modal.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/close-on-press-escape.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-content-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-content.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-content.vue (2 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-footer-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-footer.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-footer.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-title-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-title.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/custom-dialog-title.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/destroy-on-close-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/destroy-on-close.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/dialog-top-height.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/dialog-width.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/double-dialog-height-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/double-dialog-height.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/draggable-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/draggable.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/draggable.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/fullscreen.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/hidden-header.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/lock-scroll.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/open-close-events-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/open-close-events.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/open-close-events.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/right-dialog-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/right-dialog.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/secondary-dialog-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/secondary-dialog.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/secondary-dialog.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/transition-effect-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/transition-effect.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/dialog-box/transition-effect.vue (1 hunks)
  • packages/theme/src/dialog-box/index.less (1 hunks)
  • packages/theme/src/dialog-box/vars.less (1 hunks)
🔇 Additional comments (50)
examples/sites/demos/pc/app/dialog-box/custom-dialog-content.vue (2)

5-5: Custom content simplification looks good.

The change from a tiny-alert component to a simple <b> element with "自定义内容" text makes the demo cleaner and more focused on the dialog box itself.


14-14: Import and component cleanup is appropriate.

Removing the TinyAlert from imports and component registrations is consistent with the template changes. This cleanup removes unnecessary dependencies.

Also applies to: 19-19

examples/sites/demos/pc/app/dialog-box/draggable-composition-api.vue (1)

25-25: Button text formatting change looks good.

The button text formatting "确 定" has been standardized, which aligns with the theme modifications mentioned in the PR objectives.

examples/sites/demos/pc/app/dialog-box/destroy-on-close-composition-api.vue (1)

14-14: Button text formatting change is consistent.

The button text formatting has been standardized to "确 定" (with a space between characters), consistent with changes in other dialog box demos.

examples/sites/demos/pc/app/dialog-box/destroy-on-close.vue (1)

14-14: Button text formatting change maintains consistency.

The button text formatting has been standardized to "确 定" (with a space between characters), maintaining consistency with the other dialog box demos. This aligns with the theme modifications mentioned in the PR objectives.

examples/sites/demos/pc/app/dialog-box/custom-dialog-footer.vue (1)

7-7: Background style removed from custom footer

The background color (#dddddd) has been removed from the footer div's inline style. This change aligns with the theme modifications mentioned in the PR objectives and creates a cleaner, more consistent look for the custom footer area.

examples/sites/demos/pc/app/dialog-box/transition-effect-composition-api.vue (1)

13-14: Added spaces to button labels for better visual aesthetics

The button labels have been changed from "取消" to "取 消" and from "确定" to "确 定", adding a space between characters. This improves the visual appearance and is consistent with the change pattern across other dialog components in this PR.

examples/sites/demos/pc/app/dialog-box/open-close-events.vue (1)

19-20: Added spaces to button labels for better visual aesthetics

The button labels have been changed from "取消" to "取 消" and from "确定" to "确 定", adding a space between characters. This improves the visual appearance and maintains consistency with the same changes made to other dialog box components.

examples/sites/demos/pc/app/dialog-box/custom-dialog-title-composition-api.vue (1)

6-6: Background style removed from custom title

The background color (#dddddd) has been removed from the title div's inline style. This change aligns with the theme modifications mentioned in the PR objectives and creates a cleaner look for the custom title area, matching the similar change made to the custom footer.

examples/sites/demos/pc/app/dialog-box/open-close-events.spec.ts (1)

10-10: Updated test selector to match new button label format

The button selector has been updated to use a regex pattern (/确 定/) instead of the exact string ('确定'). This change properly accommodates the new button label with a space that was modified in the corresponding Vue component.

examples/sites/demos/pc/app/dialog-box/basic-usage.spec.ts (2)

8-8: Button text updated to match UI changes

The test has been correctly updated to use the new button text with a space between characters ("确 定").


11-11: Button text updated to match UI changes

The test has been correctly updated to use the new button text with a space between characters ("取 消").

examples/sites/demos/pc/app/dialog-box/draggable.vue (1)

25-25: Button text updated for consistency

The confirmation button text has been updated to include a space between characters ("确 定"), maintaining consistency with the other dialog box components.

examples/sites/demos/pc/app/dialog-box/right-dialog.vue (2)

13-13: Added round attribute and updated button text

The cancel button has been updated with the round attribute for rounded corners and its text has been changed to include a space between characters ("取 消").


14-14: Added round attribute and updated button text

The confirmation button has been updated with the round attribute for rounded corners and its text has been changed to include a space between characters ("确 定").

examples/sites/demos/pc/app/dialog-box/transition-effect.vue (2)

13-13: Button text updated for consistency

The cancel button text has been updated to include a space between characters ("取 消"), maintaining consistency with the other dialog box components.


14-14: Button text updated for consistency

The confirmation button text has been updated to include a space between characters ("确 定"), maintaining consistency with the other dialog box components.

examples/sites/demos/pc/app/dialog-box/basic-usage.vue (1)

7-8: Button styling and order updated for consistency.

The changes to the dialog footer buttons improve the UI by standardizing the cancel-confirm button sequence and adding spaces within Chinese characters for better visual alignment.

examples/sites/demos/pc/app/dialog-box/secondary-dialog-composition-api.vue (1)

14-14: Button reordering for consistent UI pattern.

The "子弹窗" button has been repositioned to follow the cancel button, maintaining a consistent button ordering pattern across dialog components.

examples/sites/demos/pc/app/dialog-box/close-on-press-escape.spec.ts (1)

6-8: Improved test robustness with scoped selectors.

The introduction of a demo-scoped selector improves test reliability by ensuring that interactions target only elements within the specific dialog-box demo component rather than potentially matching elements elsewhere on the page.

examples/sites/demos/pc/app/dialog-box/secondary-dialog.vue (1)

14-14: Consistent button ordering across component variants.

The "子弹窗" button has been repositioned to follow the cancel button, matching the changes made to the composition API version and maintaining consistent UI patterns across both implementation styles.

examples/sites/demos/pc/app/dialog-box/basic-usage-composition-api.vue (1)

7-8: UI changes look good

The updated button styling with rounded corners and consistent text spacing (adding spaces between Chinese characters) improves the visual presentation. The reordering of buttons with "Cancel" before "Confirm" follows common UI patterns.

examples/sites/demos/pc/app/dialog-box/custom-dialog-title.spec.ts (1)

6-9: Test improvements enhance reliability

Good refactoring of the test to use scoped selector via the demo variable. This approach:

  1. Improves test reliability by limiting element selection to specific demo component
  2. Makes tests more maintainable
  3. Correctly updates button text selector to match UI changes ("确 定" with space)
examples/sites/demos/pc/app/dialog-box/close-on-click-modal.spec.ts (1)

6-9: Consistent test scoping pattern applied

Good implementation of the scoped selector pattern with the demo variable. This ensures all element selections and interactions occur within the specific component under test, making the tests more reliable and easier to maintain.

examples/sites/demos/pc/app/dialog-box/double-dialog-height.vue (2)

29-29: Consistent button text formatting

The standardized text spacing for the confirm button ("确 定" with space between characters) aligns with the formatting pattern established in other dialog components.


33-34: Standardized button text presentation

Good consistency in button text formatting:

  • Action button now has space between characters ("取 消")
  • Descriptive button has spaces removed ("子弹窗")

This maintains visual consistency with other dialog components in the application.

examples/sites/demos/pc/app/dialog-box/hidden-header.spec.ts (1)

6-8: Improved test reliability with scoped selectors

The changes refine the test by scoping the selectors to the specific demo section (#hidden-header) rather than the entire page. This approach:

  1. Increases test reliability by targeting elements within their proper context
  2. Reduces potential conflicts with identical selectors in other sections of the page
  3. Better isolates the test functionality to the specific component being tested
examples/sites/demos/pc/app/dialog-box/fullscreen.spec.ts (1)

6-9: Enhanced selector specificity with demo-scoped elements

The changes properly scope the dialog box and button selectors to the specific fullscreen demo container rather than the entire page. This follows the same pattern applied to other dialog box tests and improves test isolation and reliability.

examples/sites/demos/pc/app/dialog-box/double-dialog-height-composition-api.vue (2)

29-29: Standardized button text formatting

The confirmation button text has been updated to maintain consistent spacing conventions with other dialog buttons in the application.


33-34: Standardized footer button formatting

The button text formatting has been standardized for both the cancel button and the child dialog button. This ensures consistent spacing in button labels across the application.

examples/sites/demos/pc/app/dialog-box/draggable.spec.ts (1)

6-10: Improved test reliability with demo-scoped selectors

The changes appropriately scope the selectors to the specific draggable demo section instead of the entire page. This pattern:

  1. Makes tests more reliable by targeting elements within their proper context
  2. Reduces potential conflicts with identical selectors elsewhere on the page
  3. Follows the consistent pattern applied across other dialog box test files
examples/sites/demos/pc/app/dialog-box/custom-dialog-footer.spec.ts (1)

6-9: Good refactoring to use scoped element selection

The changes improve test isolation by introducing a demo variable that scopes all element selections to the specific dialog component being tested. This approach is more maintainable than using global page selectors and aligns with best practices for component testing.

packages/theme/src/dialog-box/index.less (1)

202-209: Good improvement for theming flexibility

The addition of .inject-DialogBox-vars() and switching from hardcoded background color to a CSS variable (--tv-DialogBox-mask-bg-color) improves theming flexibility and maintainability. This approach aligns with modern CSS practices and makes it easier to implement different themes.

examples/sites/demos/pc/app/dialog-box/dialog-top-height.spec.ts (2)

6-8: Good refactoring to use scoped element selection

Introducing the demo variable to scope element selection to the specific component being tested improves test isolation and maintainability.


11-12: Updated button names to match UI changes

The button text has been updated to include spaces between characters ("确 定" instead of "确定"), which aligns with the changes made to the component's UI in this PR.

examples/sites/demos/pc/app/dialog-box/transition-effect.spec.ts (2)

6-8: Good refactoring to use scoped element selection

The introduction of the demo variable improves test isolation by scoping element selection to the specific component being tested, making the tests more maintainable and reliable.


10-11: Improved selector specificity

The changes improve the specificity of the element selections by using the scoped demo variable, which makes the test more robust against changes in other parts of the page.

examples/sites/demos/pc/app/dialog-box/lock-scroll.spec.ts (3)

6-6: Good practice: adding a scoped demo selector.

Using a scoped selector for the specific demo container improves test isolation and makes selectors more reliable.


8-9: Improved selector specificity.

Changing selectors from page-scoped to demo-scoped improves test robustness and prevents potential conflicts with elements from other parts of the page.


16-16: Button text updated to match UI changes.

The button text is now '确 定' with a space, which matches the changes made in the component. This ensures test consistency with the actual UI.

examples/sites/demos/pc/app/dialog-box/secondary-dialog.spec.ts (2)

6-6: Good practice: adding a scoped demo selector.

Using a scoped selector for the specific demo container improves test isolation and makes selectors more reliable.


8-9: Improved selector specificity.

Updating selectors to use the scoped demo variable instead of the global page context helps isolate selectors to just the secondary dialog component, making tests more robust.

examples/sites/demos/pc/app/dialog-box/custom-dialog-content.spec.ts (2)

6-8: Good practice: adding scoped selectors.

Creating scoped selectors for the demo container and its components improves test isolation and reliability.


13-13: Button text updated to match UI changes.

The confirmation button selector now uses a regex pattern with space '确 定', matching UI changes and making the test more flexible with the pattern match.

examples/sites/demos/pc/app/dialog-box/destroy-on-close.spec.ts (2)

7-7: Improved selector specificity.

Using the demo-scoped selector for the dialog box improves test reliability by ensuring we're targeting elements within the specific demo container.


11-11: Button text updated for consistency.

The confirmation button text has been updated from '确定' to '确 定' with a space, maintaining consistency with UI changes across the component.

Also applies to: 16-16

examples/sites/demos/pc/app/dialog-box/custom-dialog-content-composition-api.vue (2)

5-5: Simplified dialog content.

The dialog content has been simplified by replacing what was likely a <tiny-alert> component with a basic HTML <b> element containing the text "自定义内容" (Custom content). This change makes the example more straightforward but removes any styling or functionality that the alert component might have provided.


15-15: Cleaned up unused import.

The import statement has been correctly updated to remove the TinyAlert component that is no longer being used in the template. This is good practice to avoid unnecessary imports.

examples/sites/demos/pc/app/dialog-box/dialog-width.spec.ts (2)

6-6: Improved test specificity with scoped locator.

Adding a scoped locator with the ID #dialog-width is a good practice as it ensures that element selections are constrained to the specific component being tested. This prevents potential issues with multiple dialog components on the same page.


8-9: Updated element selections to use scoped locator.

All element selections have been properly updated to use the scoped demo locator instead of the global page context. This makes the tests more robust and less prone to failures if similar elements exist elsewhere on the page.

Also applies to: 11-12

@zzcr zzcr merged commit 569302e into dev Mar 27, 2025
11 checks passed
@kagol kagol removed the enhancement New feature or request (功能增强) label Mar 31, 2025
@kagol kagol deleted the fix-dialog-deeptheme branch April 14, 2025 12:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants