-
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows fusing nested `.padding` modifiers into a single `div` that sums up padding values from all these modifiers. Before: ```swift Text("text").padding(10).padding(20) ``` rendered to this (text styling omitted for brevity): ```html <div style="padding-top: 20.0px; padding-left: 20.0px; padding-bottom: 20.0px; padding-right: 20.0px;"> <div style="padding-top: 10.0px; padding-left: 10.0px; padding-bottom: 10.0px; padding-right: 10.0px;"> <span>text</span> </div> </div> ``` Now it renders as ```html <div style="padding-top: 30.0px; padding-left: 30.0px; padding-bottom: 30.0px; padding-right: 30.0px;"> <span>text</span> </div> ``` I hope this approach could be applied to other modifier combinations where it makes sense (in separate PRs). * Attempt `padding` modifier fusion * Fix linter warning * Add a test to verify that fusion works * Enable fusion of modifiers nested three times * Filter out empty attributes * Run snapshot tests only on macOS for now * Fully exclude snapshot testing on WASI * Fix `testOptional` snapshot * Clean up code formatting
- Loading branch information
1 parent
ae219e9
commit e6c37a4
Showing
10 changed files
with
493 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
exclude: __Snapshots__ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: detect-private-key | ||
- id: check-merge-conflict | ||
- repo: https://github.com/hodovani/pre-commit-swift | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: detect-private-key | ||
- id: check-merge-conflict | ||
- repo: https://github.com/hodovani/pre-commit-swift | ||
rev: master | ||
hooks: | ||
- id: swift-lint | ||
- id: swift-format | ||
- id: swift-lint | ||
- id: swift-format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.