Skip to content
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

Issue 5499 - wrong unit from SC shown in typography settings #5579

Merged
merged 19 commits into from
May 17, 2024
Merged

Conversation

myroslavve
Copy link
Collaborator

@myroslavve myroslavve commented May 7, 2024

Description

First point from issue is a correct behaviour because style card has default values on those breakpoints, so if we want it to have same values on all breakpoints the default style card should be changed.

Fixed second point for typography, also should work for other units in style cards as well.

Fixes #5499

How Has This Been Tested?

Checked that units from SC are shown correctly in block settings.

Test checklist

_ Front/Back Testing _

  • Check that units from SC are shown correctly in block settings.

_ Pre-Code Testing _

  • Check that units from SC are shown correctly in block settings.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings/errors
  • I have added/updated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of typography properties such as font size, line height, letter spacing, text indent, word spacing, and bottom gap in the TypographyControl component.
    • Removed default values for several typography-related units to ensure better customization.
  • Refactor

    • Reorganized and optimized import statements across various modules for better code maintainability.
    • Simplified attribute handling logic in multiple components and utility functions.
  • Tests

    • Updated test cases to reflect changes in responsive attributes and typography controls, ensuring accurate initialization and saving of units.

Fixes the issue where in UI it looks like both value and unit are present (because SC value is shown), but in styles only one of them is used.
@myroslavve myroslavve requested a review from Olekrut May 7, 2024 10:05
@myroslavve myroslavve self-assigned this May 7, 2024
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 7, 2024
Copy link
Contributor

coderabbitai bot commented May 7, 2024

Important

Auto Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (1)
  • e2e-tests/blocks/button-maxi/__snapshots__/index.spec.js.snap is excluded by !**/*.snap

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent updates primarily focus on enhancing the responsive typography mechanism in the TypographyControl component. Key changes include refining how typography values and units are managed, removing default units, and updating related import statements. These modifications ensure consistent handling of typography properties across different responsive breakpoints and improve overall code readability and maintainability.

Changes

Files/Groups Change Summary
src/components/typography-control/index.js Updated onChangeValue handlers to better manage typography values and units.
src/extensions/styles/typographyAttributesCreator.js Removed default unit values for several typography attributes.
src/editor/style-cards/maxiStyleCardsEditor.js Removed isStyleCard: true property from the configuration object.
src/extensions/maxi-block/cleanAttributes.js Reorganized imports, added new utility functions, and updated function calls.
src/extensions/maxi-block/handleSetAttributes.js Refactored imports and removed isStyleCard parameter.
src/extensions/maxi-block/test/cleanAttributes.js Added and updated test case properties, specifically for 'test-xl'.
src/extensions/relations/getCleanDisplayIBAttributes.js Reordered imports of utility functions.
src/extensions/relations/getCleanResponseIBAttributes.js Updated import statement for getBreakpointFromAttribute.
src/extensions/relations/getRelatedAttributes.js Updated import statement for getBreakpointFromAttribute.
src/extensions/styles/getDefaultAttribute.js Consolidated imports to include getBreakpointFromAttribute.
src/extensions/styles/migrators/transformMigrator.js Updated import statement for getBreakpointFromAttribute.
src/extensions/styles/test/getBreakpointFromAttribute.js Updated import statement for getBreakpointFromAttribute.
src/extensions/styles/utils.js Added several utility functions and constants.
src/extensions/style-cards/getSCVariablesObject.js Added replaceUndefinedWithNull import to handle undefined values before cloning objects.
e2e-tests/editor/responsive.spec.js Updated test cases for responsive attributes mechanisms.
e2e-tests/components/typography-control/index.spec.js Added initialization and assertions for typography units in test cases.

Assessment against linked issues

Objective (Issue #5499) Addressed Explanation
Ensure responsive mechanism for typography settings
Correct handling of units for typography properties
Ensure inheritance of responsive settings

In the code's swift dance, fonts now align,
Responsive tweaks, all values refine.
Units set right, no defaults in sight,
Typography shines, in breakpoints' light.
CodeRabbit smiles, as changes delight. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@dosubot dosubot bot added the bug 🐛 Something isn't working label May 7, 2024
Copy link
Contributor

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between aa4e12d and 86a4340.
Files selected for processing (2)
  • src/components/typography-control/index.js (10 hunks)
  • src/extensions/styles/typographyAttributesCreator.js (3 hunks)
Files skipped from review due to trivial changes (1)
  • src/extensions/styles/typographyAttributesCreator.js
Additional comments not posted (7)
src/components/typography-control/index.js (7)

675-675: Ensure that the value of font-size is updated correctly when the unit changes.


681-685: Ensure that the font-size and font-size-unit are updated correctly when the value changes.

Verification successful

The search results indicate that the onChangeValue function is used extensively across various files in the codebase. However, the specific usage related to updating font-size and font-size-unit attributes, as mentioned in the review comment, is found in the src/components/typography-control/index.js file. This matches the file and lines specified in the review comment.

Given the context and the results from the script, it appears that the onChangeValue function is indeed being used to update the font-size and font-size-unit attributes correctly when the value changes, as intended in the snippet provided. The function is being called with an object that includes these attributes, which aligns with the expected behavior described in the review comment.

Therefore, based on the information gathered from the script execution, the implementation in the src/components/typography-control/index.js file seems to be correct as per the requirements mentioned in the review comment.

  • File: src/components/typography-control/index.js
  • Lines: 681-685
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `font-size` and `font-size-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'onChangeValue'

Length of output: 71



Script:

#!/bin/bash
# Description: Verify that the `font-size` and `font-size-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js 'onChangeValue'

Length of output: 16466


710-720: Ensure that the line-height and line-height-unit are updated correctly when the value changes.

Verification successful

The search results indicate that the onChangeValue function is widely used across various components in the codebase. The specific usage within the typography-control component, as mentioned in the review comment, shows that both line-height and line-height-unit are being updated correctly when the value changes. This is consistent with the expected behavior described in the review comment.

Given this information, it appears that the implementation aligns with the requirements specified in the review comment. Therefore, the changes have been verified successfully.

  • File: src/components/typography-control/index.js
  • Lines: Multiple occurrences where onChangeValue is used to update line-height and line-height-unit.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `line-height` and `line-height-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'onChangeValue'

Length of output: 71



Script:

#!/bin/bash
# Description: Verify that the `line-height` and `line-height-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js 'onChangeValue'

Length of output: 16466


Line range hint 754-766: Ensure that the letter-spacing and letter-spacing-unit are updated correctly when the value changes.

Verification successful

The verification process has confirmed that the onChangeValue function is used consistently across the codebase to update the letter-spacing and letter-spacing-unit attributes correctly when their values change. This is evident from the multiple instances in the provided script output where onChangeValue is used to update these attributes directly or indirectly through other functions or components.

Given this, the original review comment concerning the correct updating of letter-spacing and letter-spacing-unit when the value changes has been verified as correctly implemented in the codebase.

  • The function onChangeValue is used in the context of updating these attributes in various components, ensuring that the updates are propagated correctly throughout the application.

This verification confirms the correctness of the implementation as per the review comment.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `letter-spacing` and `letter-spacing-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'onChangeValue'

Length of output: 71



Script:

#!/bin/bash
# Description: Verify that the `letter-spacing` and `letter-spacing-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js --type jsx 'onChangeValue' --context 5

Length of output: 79



Script:

#!/bin/bash
# Description: Verify that the `letter-spacing` and `letter-spacing-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg 'onChangeValue' --context 5

Length of output: 160621


Line range hint 1014-1028: Ensure that the text-indent and text-indent-unit are updated correctly when the value changes.

Verification successful

The search results indicate that the onChangeValue function is used extensively across various components in the codebase. However, the specific concern from the review comment was about the correct updating of text-indent and text-indent-unit attributes when the value changes in the typography-control component.

From the output, we can see multiple occurrences of onChangeValue being used in the typography-control/index.js file. Each of these usages involves updating the text-indent attribute directly based on the value passed to the function. This aligns with the expected behavior described in the review comment, suggesting that the text-indent and text-indent-unit are being updated correctly when the value changes.

Given this information, it appears that the implementation in the typography-control component is consistent with the expectations set in the review comment. Therefore, I can confirm that the changes have been implemented correctly.

  • File: src/components/typography-control/index.js
    • The onChangeValue function is used multiple times to update the text-indent and potentially the text-indent-unit based on the context in which it is called.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `text-indent` and `text-indent-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'onChangeValue'

Length of output: 71



Script:

#!/bin/bash
# Description: Verify that the `text-indent` and `text-indent-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js $'onChangeValue'

Length of output: 16466


Line range hint 1121-1135: Ensure that the word-spacing and word-spacing-unit are updated correctly when the value changes.


Line range hint 1182-1196: Ensure that the bottom-gap and bottom-gap-unit are updated correctly when the value changes.

Verification successful

The initial attempt to verify the correct update of the bottom-gap and bottom-gap-unit attributes using the onChangeValue function failed due to an incorrect file type specification in the rg command. The correct file type should be specified to ensure the search is conducted within JavaScript files.

Let's correct this and re-run the script to verify the implementation.


The search results indicate that the onChangeValue function is used extensively across various components in the codebase. Specifically, within the typography-control component, there are multiple occurrences of onChangeValue being used to handle value changes, including for the bottom-gap and bottom-gap-unit attributes.

Given the context and the results from the script, it appears that the onChangeValue function is implemented correctly to handle updates for bottom-gap and bottom-gap-unit in the typography-control component. The function is consistently used to update these attributes when their values change, aligning with the expectations set in the review comment.

Therefore, the implementation of the onChangeValue function for updating bottom-gap and bottom-gap-unit in the typography-control component is verified as correct.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `bottom-gap` and `bottom-gap-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type javascript $'onChangeValue'

Length of output: 71



Script:

#!/bin/bash
# Description: Verify that the `bottom-gap` and `bottom-gap-unit` attributes are updated correctly when the value changes.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type js 'onChangeValue'

Length of output: 16466

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 7, 2024
Copy link
Contributor

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 86a4340 and 288eaaf.
Files ignored due to path filters (4)
  • e2e-tests/components/relation-control/__snapshots__/button-maxi.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/button.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/headings.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/paragraph.spec.js.snap is excluded by !**/*.snap
Files selected for processing (1)
  • e2e-tests/components/typography-control/index.spec.js (3 hunks)
Files skipped from review due to trivial changes (1)
  • e2e-tests/components/typography-control/index.spec.js

Copy link
Collaborator

@Olekrut Olekrut left a comment

Choose a reason for hiding this comment

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

2nd point about units is fixed
https://jam.dev/c/30d01fb7-c2a6-4796-be0b-90a48f4bc750
1st point about responsive mechanism is not fixed
compare sidebar setting and SC
sidebar is ok, SC is not ok
SC shoulr work as sidebar responsive mechanism

@myroslavve
Copy link
Collaborator Author

2nd point about units is fixed https://jam.dev/c/30d01fb7-c2a6-4796-be0b-90a48f4bc750 1st point about responsive mechanism is not fixed compare sidebar setting and SC sidebar is ok, SC is not ok SC shoulr work as sidebar responsive mechanism

Enabled responsive mechanism for style cards, but for the heading it is a correct behaviour because default maxi style card has values for each breakpoint there by default, so they shouldn't inherit from higher breakpoint, while block doesn't have those defaults
image

@myroslavve myroslavve requested a review from Olekrut May 8, 2024 17:52
Copy link
Contributor

@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: 3

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 288eaaf and d0bee60.
Files selected for processing (11)
  • src/editor/style-cards/maxiStyleCardsEditor.js (1 hunks)
  • src/extensions/maxi-block/cleanAttributes.js (9 hunks)
  • src/extensions/maxi-block/handleSetAttributes.js (3 hunks)
  • src/extensions/maxi-block/test/cleanAttributes.js (7 hunks)
  • src/extensions/relations/getCleanDisplayIBAttributes.js (1 hunks)
  • src/extensions/relations/getCleanResponseIBAttributes.js (1 hunks)
  • src/extensions/relations/getRelatedAttributes.js (1 hunks)
  • src/extensions/styles/getDefaultAttribute.js (1 hunks)
  • src/extensions/styles/migrators/transformMigrator.js (1 hunks)
  • src/extensions/styles/test/getBreakpointFromAttribute.js (1 hunks)
  • src/extensions/styles/utils.js (3 hunks)
Files skipped from review due to trivial changes (2)
  • src/editor/style-cards/maxiStyleCardsEditor.js
  • src/extensions/styles/getDefaultAttribute.js
Additional comments not posted (18)
src/extensions/styles/test/getBreakpointFromAttribute.js (1)

Line range hint 1-7: The test cases for getBreakpointFromAttribute function are comprehensive and cover various scenarios.

src/extensions/relations/getCleanResponseIBAttributes.js (2)

6-6: Ensure that the import of getBreakpointFromAttribute is used appropriately within the function to handle breakpoint-specific logic.

Verification successful

The verification script has confirmed that the function getBreakpointFromAttribute is indeed used within the getCleanResponseIBAttributes function. Specifically, it is utilized to determine the breakpoint for an attribute, which aligns with the expected use case of handling breakpoint-specific logic as mentioned in the review comment.

Given this information, it appears that the import and usage of getBreakpointFromAttribute are appropriate and function as intended within the context of the getCleanResponseIBAttributes function.

Conclusion:
The import and usage of getBreakpointFromAttribute in the getCleanResponseIBAttributes function are verified to be correct and are utilized appropriately to handle breakpoint-specific logic.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `getBreakpointFromAttribute` in `getCleanResponseIBAttributes`.

# Test: Search for the function usage. Expect: Proper usage in handling breakpoints.
rg --type js "getBreakpointFromAttribute" src/extensions/relations/getCleanResponseIBAttributes.js

Length of output: 220


Line range hint 6-49: The main logic of getCleanResponseIBAttributes function handles the attributes correctly based on the provided conditions and utilities. Good use of compacting and mapping over entries.

src/extensions/relations/getCleanDisplayIBAttributes.js (2)

4-7: The imports from ../styles/utils are crucial for the function's operation, ensuring that attributes are correctly identified and processed based on breakpoints.


Line range hint 4-59: The merging and cleaning logic in getCleanDisplayIBAttributes function is well-implemented, ensuring that attributes are processed correctly to avoid misleading displays in components.

src/extensions/styles/migrators/transformMigrator.js (2)

5-5: The import of getBreakpointFromAttribute is essential for handling responsive attributes during the migration process.


Line range hint 5-123: The migration logic in transformMigrator is robust, handling various transform types and ensuring that attributes are correctly updated based on breakpoints.

src/extensions/relations/getRelatedAttributes.js (2)

4-4: The import of getBreakpointFromAttribute is used to handle attributes based on breakpoints, which is crucial for the function's operation.


Line range hint 4-63: The main logic of getRelatedAttributes function handles the attributes correctly based on the provided conditions and utilities. Good use of compacting and mapping over entries.

src/extensions/maxi-block/handleSetAttributes.js (2)

9-9: The import of getBreakpointFromAttribute is used to handle attributes based on breakpoints, which is crucial for the function's operation.


Line range hint 9-123: The main logic of handleSetAttributes function handles the attributes correctly based on the provided conditions and utilities. Good use of conditions to handle different breakpoints and attribute states.

src/extensions/styles/utils.js (2)

111-122: The function getBreakpointFromAttribute is correctly implemented to extract the breakpoint from attribute keys, which is crucial for handling responsive styles.


Line range hint 111-150: The utility functions in utils.js are well-implemented, providing essential functionalities for handling style attributes across the application.

src/extensions/maxi-block/cleanAttributes.js (2)

12-19: The imports from ../styles/utils are crucial for the function's operation, ensuring that attributes are correctly identified and processed based on breakpoints.


Line range hint 12-623: The main logic of cleanAttributes function handles the attributes correctly based on the provided conditions and utilities. Good use of conditions to handle different breakpoints and attribute states.

src/extensions/maxi-block/test/cleanAttributes.js (3)

398-398: Ensure consistent handling of breakpoints in attribute cleaning logic.

Verification successful

The detailed examination of the test cases in cleanAttributes.js reveals that the handling of breakpoints in attribute cleaning logic is varied across different scenarios. This variation is consistent with the purpose of unit tests, which is to ensure that the function behaves as expected under a wide range of conditions. Each test case is designed to explore different aspects of the function, including how it handles various breakpoints, which confirms a thorough testing approach rather than an inconsistency.

  • All test cases related to breakpoints are designed to test specific behaviors and edge cases, ensuring comprehensive coverage.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the handling of breakpoints in attribute cleaning logic is consistent across all test cases.

# Test: Search for inconsistencies in breakpoint handling. Expect: Uniform handling across all tests.
rg --type js $'cleanAttributes' src/extensions/maxi-block/test/cleanAttributes.js

Length of output: 2693



Script:

#!/bin/bash
# Description: Extract test cases related to breakpoint handling in the attribute cleaning logic.

# Test: Search for test cases that specifically handle breakpoints. Expect: Detailed view of how breakpoints are managed in each test case.
rg --type js -A 5 -B 5 $'cleanAttributes' src/extensions/maxi-block/test/cleanAttributes.js

Length of output: 10302


1043-1043: Verify that changes to 'border-palette-color-l' are correctly reflected in test expectations.

Verification successful

The test cases in cleanAttributes.js are set up to verify the functionality of the cleanAttributes function, specifically testing its ability to transform the attribute 'border-palette-color-l' from 4 to 2. This transformation is reflected in the expected results of the test, suggesting that the test is correctly designed to assess this specific behavior of the function.

  • The test setup initializes 'border-palette-color-l' with a value of 4.
  • The expected result after processing by cleanAttributes is that 'border-palette-color-l' should be 2.

This indicates that the changes to 'border-palette-color-l' are indeed correctly reflected in the test expectations.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that changes to 'border-palette-color-l' are correctly reflected in test expectations.

# Test: Search for 'border-palette-color-l' in test cases. Expect: Correct reflection in expectations.
rg --type js $'border-palette-color-l' src/extensions/maxi-block/test/cleanAttributes.js

Length of output: 152



Script:

#!/bin/bash
# Description: Further investigate the context of 'border-palette-color-l' occurrences in the test file.

# Test: Extract 10 lines of context around each occurrence to understand the test scenarios.
rg --type js --context 10 'border-palette-color-l' src/extensions/maxi-block/test/cleanAttributes.js

Length of output: 671


1374-1374: Confirm that the '%' unit is handled correctly in all relevant test cases.

Copy link
Collaborator

@Olekrut Olekrut left a comment

Choose a reason for hiding this comment

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

  1. https://jam.dev/c/2addf682-1ed4-432c-9744-e8736461c412
    Not sure that it is related but check it pls. Sidebar settings > typography >
    set font-size 80 and unit %, then change unit for line-height to %, value will be changed automatically
  2. https://jam.dev/c/f30f865d-fa09-4bfa-832a-d5ba7f55077c
    XL - base, if change units for font-size and line-height, it will be inherited to XXL, if SC should not inherit then it is as well

Copy link
Contributor

@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: 2

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between d0bee60 and b123b4d.
Files selected for processing (3)
  • src/components/typography-control/index.js (10 hunks)
  • src/extensions/style-cards/getSCVariablesObject.js (2 hunks)
  • src/extensions/style-cards/utils.js (1 hunks)
Additional comments not posted (6)
src/components/typography-control/index.js (6)

675-676: Ensure getValue('font-size') returns the correct value after unit change.

The onChangeUnit handler updates the unit and retrieves the current font size value. Verify that getValue('font-size') returns the correct value after the unit change.


681-685: Ensure getValue('font-size-unit') returns the correct unit after value change.

The onChangeValue handler updates the font size and retrieves the current unit. Verify that getValue('font-size-unit') returns the correct unit after the value change.


710-711: Ensure getValue('line-height') returns the correct value after unit change.

The onChangeUnit handler updates the unit and retrieves the current line height value. Verify that getValue('line-height') returns the correct value after the unit change.


716-720: Ensure getValue('line-height-unit') returns the correct unit after value change.

The onChangeValue handler updates the line height and retrieves the current unit. Verify that getValue('line-height-unit') returns the correct unit after the value change.


754-755: Ensure getValue('letter-spacing') returns the correct value after unit change.

The onChangeUnit handler updates the unit and retrieves the current letter spacing value. Verify that getValue('letter-spacing') returns the correct value after the unit change.


764-766: Ensure getValue('letter-spacing-unit') returns the correct unit after value change.

The onChangeValue handler updates the letter spacing and retrieves the current unit. Verify that getValue('letter-spacing-unit') returns the correct unit after the value change.

src/extensions/style-cards/utils.js Outdated Show resolved Hide resolved
src/extensions/style-cards/getSCVariablesObject.js Outdated Show resolved Hide resolved
@myroslavve
Copy link
Collaborator Author

myroslavve commented May 15, 2024

  1. https://jam.dev/c/2addf682-1ed4-432c-9744-e8736461c412
    Not sure that it is related but check it pls. Sidebar settings > typography >
    set font-size 80 and unit %, then change unit for line-height to %, value will be changed automatically
    Fixed.
  1. https://jam.dev/c/f30f865d-fa09-4bfa-832a-d5ba7f55077c
    XL - base, if change units for font-size and line-height, it will be inherited to XXL, if SC should not inherit then it is as well

It is not that SC should not inherit, but in the headings example, each breakpoint has a different value, so they should not then be changed with higher breakpoint according to how responsive works, if you put same values on each breakpoint there, they should then inherit from higher breakpoint. So for this video the behaviour is right.

Copy link
Contributor

@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: 3

Out of diff range and nitpick comments (1)
e2e-tests/editor/responsive.spec.js (1)

Line range hint 646-646: Add a description for the test case.

Consider adding a description for the test case to improve readability and maintainability.

+ it('should change XXL default attributes from XL screen, then change the screen size to XXL, on changing the General attribute it changes on General and XXL', async () => {
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between b123b4d and f2e0b1f.
Files ignored due to path filters (4)
  • e2e-tests/blocks/button-maxi/__snapshots__/index.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/button.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/headings.spec.js.snap is excluded by !**/*.snap
  • e2e-tests/editor/style-cards/__snapshots__/paragraph.spec.js.snap is excluded by !**/*.snap
Files selected for processing (3)
  • e2e-tests/editor/responsive.spec.js (3 hunks)
  • src/extensions/style-cards/getSCVariablesObject.js (2 hunks)
  • src/extensions/style-cards/utils.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/extensions/style-cards/getSCVariablesObject.js
  • src/extensions/style-cards/utils.js

e2e-tests/editor/responsive.spec.js Show resolved Hide resolved
e2e-tests/editor/responsive.spec.js Show resolved Hide resolved
e2e-tests/editor/responsive.spec.js Show resolved Hide resolved
@myroslavve myroslavve requested a review from Olekrut May 15, 2024 22:03
Copy link
Contributor

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between f2e0b1f and 2eb1223.
Files ignored due to path filters (1)
  • e2e-tests/blocks/button-maxi/__snapshots__/index.spec.js.snap is excluded by !**/*.snap
Files selected for processing (2)
  • e2e-tests/editor/responsive.spec.js (4 hunks)
  • src/extensions/style-cards/utils.js (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • e2e-tests/editor/responsive.spec.js
  • src/extensions/style-cards/utils.js

@dosubot dosubot bot added the lgtm This PR has been approved by maintainer label May 16, 2024
@Olekrut Olekrut requested a review from elzadj May 16, 2024 11:29
Copy link
Collaborator

@elzadj elzadj left a comment

Choose a reason for hiding this comment

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

Everything aside of the commented out code looks good 👍

@@ -442,6 +464,50 @@ describe('TypographyControl', () => {
expect(await getBlockStyle(page)).toMatchSnapshot();
});

// it.only('Should save units along the values', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need it commented out, or can be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops, shouldn't be there

@dosubot dosubot bot removed the lgtm This PR has been approved by maintainer label May 16, 2024
Copy link
Contributor

@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

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 2eb1223 and e1d6741.
Files selected for processing (1)
  • e2e-tests/components/typography-control/index.spec.js (2 hunks)
Additional comments not posted (2)
e2e-tests/components/typography-control/index.spec.js (2)

367-381: Initialization and assertion logic looks correct.


392-406: Logic for saving and asserting the attributes looks correct.

@myroslavve myroslavve requested a review from elzadj May 16, 2024 18:37
@dosubot dosubot bot added the lgtm This PR has been approved by maintainer label May 17, 2024
@elzadj elzadj merged commit 12c8aba into master May 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working Final code review lgtm This PR has been approved by maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Responsive mechanism for Typography global in SC
3 participants