Skip to content

Commit 985f20e

Browse files
committed
box-shadow transform: always set shadowOpacity to 1
1 parent 57a6d7d commit 985f20e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/index.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ it('transforms box-shadow into shadow- properties', () => runTest([
464464
shadowOffset: { width: 10, height: 20 },
465465
shadowRadius: 30,
466466
shadowColor: 'red',
467+
shadowOpacity: 1,
467468
}));
468469

469470
it('transforms box-shadow without blur-radius', () => runTest([
@@ -472,6 +473,7 @@ it('transforms box-shadow without blur-radius', () => runTest([
472473
shadowOffset: { width: 10, height: 20 },
473474
shadowRadius: 0,
474475
shadowColor: 'red',
476+
shadowOpacity: 1,
475477
}));
476478

477479
it('transforms box-shadow without color', () => runTest([
@@ -480,6 +482,7 @@ it('transforms box-shadow without color', () => runTest([
480482
shadowOffset: { width: 10, height: 20 },
481483
shadowRadius: 30,
482484
shadowColor: 'black',
485+
shadowOpacity: 1,
483486
}));
484487

485488
it('transforms box-shadow without blur-radius, color', () => runTest([
@@ -488,6 +491,7 @@ it('transforms box-shadow without blur-radius, color', () => runTest([
488491
shadowOffset: { width: 10, height: 20 },
489492
shadowRadius: 0,
490493
shadowColor: 'black',
494+
shadowOpacity: 1,
491495
}));
492496

493497
it('transforms box-shadow with rgb color', () => runTest([
@@ -496,6 +500,7 @@ it('transforms box-shadow with rgb color', () => runTest([
496500
shadowOffset: { width: 10, height: 20 },
497501
shadowRadius: 0,
498502
shadowColor: 'rgb(100, 100, 100)',
503+
shadowOpacity: 1,
499504
}));
500505

501506
it('transforms box-shadow with rgba color', () => runTest([
@@ -504,6 +509,7 @@ it('transforms box-shadow with rgba color', () => runTest([
504509
shadowOffset: { width: 10, height: 20 },
505510
shadowRadius: 0,
506511
shadowColor: 'rgba(100, 100, 100, 0.5)',
512+
shadowOpacity: 1,
507513
}));
508514

509515
it('transforms box-shadow with hsl color', () => runTest([
@@ -512,6 +518,7 @@ it('transforms box-shadow with hsl color', () => runTest([
512518
shadowOffset: { width: 10, height: 20 },
513519
shadowRadius: 0,
514520
shadowColor: 'hsl(120, 100%, 50%)',
521+
shadowOpacity: 1,
515522
}));
516523

517524
it('transforms box-shadow with hsla color', () => runTest([
@@ -520,6 +527,7 @@ it('transforms box-shadow with hsla color', () => runTest([
520527
shadowOffset: { width: 10, height: 20 },
521528
shadowRadius: 0,
522529
shadowColor: 'hsla(120, 100%, 50%, 0.7)',
530+
shadowOpacity: 1,
523531
}));
524532

525533
it('transforms box-shadow enforces offset to be present', () => {

src/transforms/boxShadow.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = (tokenStream) => {
1111
if (tokenStream.matches(NONE)) {
1212
tokenStream.expectEmpty();
1313
return {
14-
$merge: { shadowOffset: { width: 0, height: 0 }, shadowRadius: 0, shadowColor: 'black' },
14+
$merge: { shadowOffset: { width: 0, height: 0 }, shadowRadius: 0, shadowColor: 'black', shadowOpacity: 1 },
1515
};
1616
}
1717

@@ -43,6 +43,7 @@ module.exports = (tokenStream) => {
4343
shadowOffset: { width: offsetX, height: offsetY },
4444
shadowRadius: blurRadius !== undefined ? blurRadius : 0,
4545
shadowColor: color !== undefined ? color : 'black',
46+
shadowOpacity: 1,
4647
};
4748
return { $merge };
4849
};

0 commit comments

Comments
 (0)