Skip to content

Commit 85cf1ce

Browse files
committed
Fix non-happy-path rem function output expectations
1 parent a3b355e commit 85cf1ce

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

polaris-migrator/src/migrations/replace-sass-lengths/tests/replace-sass-lengths.input.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
// Single shorthand rem function (rem(Xpx))
6363
padding: rem(10px);
6464
padding: rem(16px);
65-
padding: calc(10rem + var(--p-choice-size, #{rem(16px)}));
66-
padding: calc(10rem + var(--p-choice-size, #{rem(10px)}));
6765
gap: rem(10px);
6866
gap: rem(16px);
6967

@@ -93,6 +91,8 @@
9391
gap: rem($var * 16px);
9492
gap: calc(16px + 16px);
9593
gap: 16px + #{16px + 16px};
94+
padding: calc(10rem + var(--p-choice-size, #{rem(16px)}));
95+
padding: calc(10rem + var(--p-choice-size, #{rem(10px)}));
9696

9797
// Unsupported transforms without comments
9898
padding: rem(16px);

polaris-migrator/src/migrations/replace-sass-lengths/tests/replace-sass-lengths.output.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@
6262
// Single shorthand rem function (rem(Xpx))
6363
padding: rem(10px);
6464
padding: var(--p-space-4);
65-
padding: calc(10rem + var(--p-choice-size, #{rem(16px)}));
66-
padding: calc(10rem + var(--p-choice-size, #{rem(10px)}));
6765
gap: rem(10px);
6866
gap: var(--p-space-4);
6967

7068
// Mixed shorthand rem function
71-
padding: rem(16px) 16px;
69+
padding: rem(16px) var(--p-space-4);
7270
padding: rem(16px) 4in;
7371
padding: rem(16px) 1em;
7472
padding: rem(16px) -16px;
@@ -114,7 +112,7 @@
114112
/* gap: $var + var(--p-space-4); */
115113
gap: $var + 16px;
116114
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
117-
/* gap: var(--p-space-4) + var(--p-space-4); */
115+
/* gap: rem(16px) + var(--p-space-4); */
118116
gap: rem(16px) + 16px;
119117
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
120118
/* gap: rem($var * 16px); */
@@ -125,6 +123,12 @@
125123
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
126124
/* gap: var(--p-space-4) + #{16px + 16px}; */
127125
gap: 16px + #{16px + 16px};
126+
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
127+
/* padding: calc(10rem + var(--p-choice-size, #{rem(16px)})); */
128+
padding: calc(10rem + var(--p-choice-size, #{rem(16px)}));
129+
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
130+
/* padding: calc(10rem + var(--p-choice-size, #{rem(10px)})); */
131+
padding: calc(10rem + var(--p-choice-size, #{rem(10px)}));
128132

129133
// Unsupported transforms without comments
130134
padding: var(--p-space-4);

polaris-migrator/src/migrations/replace-sass-lengths/tests/with-namespace.input.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
// Single shorthand rem function (rem(Xpx))
6464
padding: legacy-polaris-v8.rem(10px);
6565
padding: legacy-polaris-v8.rem(16px);
66-
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(16px)}));
67-
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(10px)}));
6866
gap: legacy-polaris-v8.rem(10px);
6967
gap: legacy-polaris-v8.rem(16px);
7068

@@ -94,6 +92,8 @@
9492
gap: legacy-polaris-v8.rem($var * 16px);
9593
gap: calc(16px + 16px);
9694
gap: 16px + #{16px + 16px};
95+
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(16px)}));
96+
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(10px)}));
9797

9898
// Unsupported transforms without comments
9999
padding: legacy-polaris-v8.rem(16px);

polaris-migrator/src/migrations/replace-sass-lengths/tests/with-namespace.output.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@
6161
gap: var(--p-space-4) -16px;
6262

6363
// Single shorthand rem function (rem(Xpx))
64-
padding: rem(10px);
64+
padding: legacy-polaris-v8.rem(10px);
6565
padding: var(--p-space-4);
66-
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(16px)}));
67-
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(10px)}));
68-
gap: rem(10px);
66+
gap: legacy-polaris-v8.rem(10px);
6967
gap: var(--p-space-4);
7068

7169
// Mixed shorthand rem function
@@ -126,6 +124,12 @@
126124
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
127125
/* gap: var(--p-space-4) + #{16px + 16px}; */
128126
gap: 16px + #{16px + 16px};
127+
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
128+
/* padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(16px)})); */
129+
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(16px)}));
130+
/* polaris-migrator: Unable to migrate the following expression. Please upgrade manually. */
131+
/* padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(10px)})); */
132+
padding: calc(10rem + var(--p-choice-size, #{legacy-polaris-v8.rem(10px)}));
129133

130134
// Unsupported transforms without comments
131135
padding: var(--p-space-4);

0 commit comments

Comments
 (0)