File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ def render
21
21
22
22
Native . option_set_is_indented_syntax_src ( native_options , true ) if sass?
23
23
Native . option_set_input_path ( native_options , filename ) if filename
24
+ Native . option_set_precision ( native_options , precision ) if precision
24
25
Native . option_set_include_path ( native_options , load_paths )
25
26
Native . option_set_output_style ( native_options , output_style_enum )
26
27
Native . option_set_source_comments ( native_options , true ) if line_comments?
@@ -64,6 +65,10 @@ def filename
64
65
@options [ :filename ]
65
66
end
66
67
68
+ def precision
69
+ @options [ :precision ]
70
+ end
71
+
67
72
def sass?
68
73
@options [ :syntax ] && @options [ :syntax ] . to_sym == :sass
69
74
end
Original file line number Diff line number Diff line change @@ -64,6 +64,34 @@ def test_variables
64
64
SCSS
65
65
end
66
66
67
+ def test_precision
68
+ template = <<-SCSS
69
+ $var: 1;
70
+ .foo {
71
+ baz: $var / 3; }
72
+ SCSS
73
+ expected_output = <<-CSS
74
+ .foo {
75
+ baz: 0.33333333; }
76
+ CSS
77
+ output = Engine . new ( template , precision : 8 ) . render
78
+ assert_equal expected_output , output
79
+ end
80
+
81
+ def test_precision_not_specified
82
+ template = <<-SCSS
83
+ $var: 1;
84
+ .foo {
85
+ baz: $var / 3; }
86
+ SCSS
87
+ expected_output = <<-CSS
88
+ .foo {
89
+ baz: 0.33333; }
90
+ CSS
91
+ output = Engine . new ( template ) . render
92
+ assert_equal expected_output , output
93
+ end
94
+
67
95
def test_dependency_filenames_are_reported
68
96
temp_file ( "not_included.scss" , "$size: 30px;" )
69
97
temp_file ( "import_parent.scss" , "$size: 30px;" )
You can’t perform that action at this time.
0 commit comments