Skip to content

Commit b8cc146

Browse files
committed
recursively handle lists in measure method
1 parent 1b81f6f commit b8cc146

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/CSS/Properties/Calculator.rakumod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ class CSS::Properties::Calculator {
136136
.(self, $v, :$ref);
137137
}
138138
else {
139-
$.measure($v, :$ref);
139+
given $.measure($v, :$ref) {
140+
.isa(List)
141+
?? [ $v.map: {$.measure($_, :$ref)} ]
142+
!! $v;
143+
}
140144
}
141145
}
142146
}

t/measure.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use v6;
22
use Test;
3-
plan 27;
3+
plan 28;
44

55
use CSS::Units :pt, :px, :pc, :in, :vw, :vh, :em, :ex, :percent;
66
use CSS::Properties;
@@ -27,6 +27,9 @@ is '%0.2f'.sprintf($css.measure: :font-size<thick>), '3.00', '$css.measure("thic
2727
is '%0.2f'.sprintf($css.measure: :font-size<x-large>), '18.00', '$css.measure("x-large")';
2828
is '%0.2f'.sprintf($css.measure: :font-size<smaller>), '10.00', '$css.measure("smaller")';
2929

30+
$css .= new: :style("border-spacing: 3pt .75em");
31+
is $css.measure(:border-spacing), [3.0, 9.0];
32+
3033
# change base units
3134
$css .= new: :units<pc>;
3235
is $css.units, 'pc', 'changed units';

0 commit comments

Comments
 (0)