compass-sass37 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/test/units/sass_extenstions/gradients_test.rb +163 -3
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f61e63af678a7ba96197493dcb23466150f84ff95c18722baa56c4b5cdf96c9
|
|
4
|
+
data.tar.gz: cd4f2725a6df6d5c4268e815ff9fa532cada69420b260ec793dcfa9874fc108b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1e53853871433d9314c6bd6dd59521288ee34d38549c65c251fb9a64fa352f2a33d44559ef45c0799ea1dbf99f511d26dc0c7fd8b9520253353e5dacbf6b1e4
|
|
7
|
+
data.tar.gz: 8af8099cb1481fde43f0d67a91beed86aad96b542dcc53acaa8a00a5579721746bcb55c2e921a92e40130a271b61961445acb13644174f0488f0965e2e368b06
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.1
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
require_relative '../../test_helper'
|
|
2
|
+
|
|
1
3
|
class GradientTestClass
|
|
4
|
+
extend Compass::Core::SassExtensions::Functions::GradientSupport::Assertions
|
|
2
5
|
extend Compass::Core::SassExtensions::Functions::Constants
|
|
3
6
|
extend Compass::Core::SassExtensions::Functions::GradientSupport::Functions
|
|
4
7
|
def self.options
|
|
@@ -6,9 +9,6 @@ class GradientTestClass
|
|
|
6
9
|
end
|
|
7
10
|
end
|
|
8
11
|
|
|
9
|
-
require 'test_helper'
|
|
10
|
-
require 'compass'
|
|
11
|
-
|
|
12
12
|
class GradientsTest < Test::Unit::TestCase
|
|
13
13
|
include Sass::Script::Value::Helpers
|
|
14
14
|
|
|
@@ -16,6 +16,16 @@ class GradientsTest < Test::Unit::TestCase
|
|
|
16
16
|
GradientTestClass
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Sass::Script::Value objects created outside the parser need #options for #to_s.
|
|
20
|
+
def prime_sass_options(*values)
|
|
21
|
+
o = Sass::Engine::DEFAULT_OPTIONS
|
|
22
|
+
values.compact.each do |v|
|
|
23
|
+
next unless v.is_a?(Sass::Script::Value::Base)
|
|
24
|
+
v.options = o
|
|
25
|
+
v.value.each { |x| prime_sass_options(x) } if v.is_a?(Sass::Script::Value::List)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
19
29
|
test "should return correct angle" do
|
|
20
30
|
assert_equal number(330, 'deg'), klass.convert_angle_from_offical(number(120, 'deg'))
|
|
21
31
|
end
|
|
@@ -27,4 +37,154 @@ class GradientsTest < Test::Unit::TestCase
|
|
|
27
37
|
end
|
|
28
38
|
end
|
|
29
39
|
|
|
40
|
+
test "color_stops parses CSS double-position stop (transparent 0 25%)" do
|
|
41
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
42
|
+
triplet = list([transparent, number(0), number(25, "%")], :space)
|
|
43
|
+
stops = klass.send(:color_stops, triplet)
|
|
44
|
+
assert_equal 1, stops.value.size
|
|
45
|
+
cs = stops.value.first
|
|
46
|
+
assert_equal transparent, cs.color
|
|
47
|
+
assert_equal number(0), cs.stop
|
|
48
|
+
assert_equal number(25, "%"), cs.stop2
|
|
49
|
+
assert_match(/transparent.*25%/, cs.to_s)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
test "radial-gradient includes double-position stop in official CSS output" do
|
|
53
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
54
|
+
pos = list([identifier("circle"), identifier("at"), number(70, "%"), number(20, "%")], :space)
|
|
55
|
+
highlight = Sass::Script::Value::Color.new([255, 255, 255, 0.08])
|
|
56
|
+
plateau = list([transparent, number(0), number(25, "%")], :space)
|
|
57
|
+
prime_sass_options(pos, highlight, plateau)
|
|
58
|
+
g = klass.radial_gradient(pos, nil, highlight, plateau)
|
|
59
|
+
g.options = Sass::Engine::DEFAULT_OPTIONS
|
|
60
|
+
out = g.to_official.to_s
|
|
61
|
+
assert_match(/transparent 0% 25%/, out)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
test "radial grad_position uses outer stop for double-position last color-stop" do
|
|
65
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
66
|
+
c1 = Sass::Script::Value::Color.new([255, 255, 255, 1])
|
|
67
|
+
plateau = list([transparent, number(0), number(30, "%")], :space)
|
|
68
|
+
stops = klass.send(:color_stops, c1, plateau)
|
|
69
|
+
prime_sass_options(stops)
|
|
70
|
+
norm = klass.send(:normalize_stops, stops)
|
|
71
|
+
edge = klass.send(:grad_position, norm, number(2), number(100), bool(false))
|
|
72
|
+
assert_equal number(30, "%"), edge
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
test "linear-gradient includes double-position stop in output" do
|
|
76
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
77
|
+
angle = number(145, "deg")
|
|
78
|
+
from = Sass::Script::Value::Color.new([212, 191, 154, 0.08])
|
|
79
|
+
plateau = list([transparent, number(0), number(48, "%")], :space)
|
|
80
|
+
prime_sass_options(angle, from, plateau)
|
|
81
|
+
g = klass.send(:_linear_gradient, angle, from, plateau)
|
|
82
|
+
g.options = Sass::Engine::DEFAULT_OPTIONS
|
|
83
|
+
assert_match(/transparent 0% 48%/, g.to_s)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# --- регрессия: поведение до поддержки двойных позиций ---
|
|
87
|
+
|
|
88
|
+
test "classic stop color plus single position has no stop2" do
|
|
89
|
+
red = Sass::Script::Value::Color.new([255, 0, 0])
|
|
90
|
+
pair = list([red, number(50, "%")], :space)
|
|
91
|
+
stops = klass.send(:color_stops, pair)
|
|
92
|
+
cs = stops.value.first
|
|
93
|
+
assert_nil cs.stop2
|
|
94
|
+
assert_equal number(50, "%"), cs.stop
|
|
95
|
+
assert_equal red, cs.color
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
test "classic radial two stops without plateau matches prior shape" do
|
|
99
|
+
red = Sass::Script::Value::Color.new([255, 0, 0])
|
|
100
|
+
blue = Sass::Script::Value::Color.new([0, 0, 255])
|
|
101
|
+
end_stop = list([blue, number(100, "%")], :space)
|
|
102
|
+
prime_sass_options(red, end_stop)
|
|
103
|
+
g = klass.radial_gradient(nil, nil, red, end_stop)
|
|
104
|
+
g.options = Sass::Engine::DEFAULT_OPTIONS
|
|
105
|
+
out = g.to_official.to_s
|
|
106
|
+
assert_match(/radial-gradient\(/, out)
|
|
107
|
+
assert_match(/100%/, out)
|
|
108
|
+
assert_equal false, g.color_stops.value.any? { |cs| cs.stop2 }
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
test "bare color stop without position still works" do
|
|
112
|
+
violet = Sass::Script::Value::Color.new([128, 0, 255])
|
|
113
|
+
stops = klass.send(:color_stops, violet)
|
|
114
|
+
assert_equal 1, stops.value.size
|
|
115
|
+
assert_nil stops.value.first.stop
|
|
116
|
+
assert_nil stops.value.first.stop2
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# --- двойная позиция: варианты синтаксиса ---
|
|
120
|
+
|
|
121
|
+
test "double-position stop with comma-separated list" do
|
|
122
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
123
|
+
triplet = list([transparent, number(0), number(25, "%")], :comma)
|
|
124
|
+
stops = klass.send(:color_stops, triplet)
|
|
125
|
+
cs = stops.value.first
|
|
126
|
+
assert_equal number(25, "%"), cs.stop2
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
test "double-position with rgb color and percentage pair" do
|
|
130
|
+
c = Sass::Script::Value::Color.new([100, 150, 200])
|
|
131
|
+
plateau = list([c, number(10, "%"), number(40, "%")], :space)
|
|
132
|
+
stops = klass.send(:color_stops, plateau)
|
|
133
|
+
cs = stops.value.first
|
|
134
|
+
assert_equal c, cs.color
|
|
135
|
+
assert_equal number(10, "%"), cs.stop
|
|
136
|
+
assert_equal number(40, "%"), cs.stop2
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
test "double-position second edge can be calc string" do
|
|
140
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
141
|
+
calc_stop = Sass::Script::Value::String.new("calc(100% - 1px)")
|
|
142
|
+
plateau = list([transparent, number(0), calc_stop], :space)
|
|
143
|
+
stops = klass.send(:color_stops, plateau)
|
|
144
|
+
cs = stops.value.first
|
|
145
|
+
assert_equal calc_stop, cs.stop2
|
|
146
|
+
assert_match(/calc\(100% - 1px\)/, cs.to_s)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
test "linear-gradient three stops middle has double position" do
|
|
150
|
+
red = Sass::Script::Value::Color.new([255, 0, 0])
|
|
151
|
+
green = Sass::Script::Value::Color.new([0, 255, 0])
|
|
152
|
+
blue = Sass::Script::Value::Color.new([0, 0, 255])
|
|
153
|
+
mid = list([green, number(25, "%"), number(75, "%")], :space)
|
|
154
|
+
angle = number(180, "deg")
|
|
155
|
+
prime_sass_options(angle, red, mid, blue)
|
|
156
|
+
g = klass.send(:_linear_gradient, angle, red, mid, blue)
|
|
157
|
+
g.options = Sass::Engine::DEFAULT_OPTIONS
|
|
158
|
+
out = g.to_s
|
|
159
|
+
assert_match(/25%/, out)
|
|
160
|
+
assert_match(/75%/, out)
|
|
161
|
+
assert_operator out.index("25%"), :<, out.index("75%")
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
test "color_stops_in_percentages duplicates plateau into sequential pairs" do
|
|
165
|
+
transparent = Sass::Script::Value::String.new("transparent")
|
|
166
|
+
c1 = Sass::Script::Value::Color.new([200, 200, 200])
|
|
167
|
+
plateau = list([transparent, number(0), number(25, "%")], :space)
|
|
168
|
+
stops = klass.send(:color_stops, c1, plateau)
|
|
169
|
+
prime_sass_options(stops)
|
|
170
|
+
pairs = klass.send(:color_stops_in_percentages, stops)
|
|
171
|
+
assert_equal 3, pairs.size
|
|
172
|
+
assert_equal transparent, pairs[1].last
|
|
173
|
+
assert_equal transparent, pairs[2].last
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
test "outer_stop equals stop when stop2 absent" do
|
|
177
|
+
red = Sass::Script::Value::Color.new([255, 0, 0])
|
|
178
|
+
pair = list([red, number(33, "%")], :space)
|
|
179
|
+
cs = klass.send(:color_stops, pair).value.first
|
|
180
|
+
assert_equal cs.stop, cs.outer_stop
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
test "three list elements that are not two positions still error" do
|
|
184
|
+
a = Sass::Script::Value::Color.new([255, 255, 255])
|
|
185
|
+
b = Sass::Script::Value::Color.new([0, 0, 0])
|
|
186
|
+
bad = list([a, b, number(50, "%")], :space)
|
|
187
|
+
assert_raises(Sass::SyntaxError) { klass.send(:color_stops, bad) }
|
|
188
|
+
end
|
|
189
|
+
|
|
30
190
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: compass-sass37
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Ivanin
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
autorequire:
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date:
|
|
16
|
+
date: 2026-04-08 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: sass
|
|
@@ -41,28 +41,28 @@ dependencies:
|
|
|
41
41
|
requirements:
|
|
42
42
|
- - "~>"
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version: 1.1.
|
|
44
|
+
version: 1.1.1
|
|
45
45
|
type: :runtime
|
|
46
46
|
prerelease: false
|
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
|
48
48
|
requirements:
|
|
49
49
|
- - "~>"
|
|
50
50
|
- !ruby/object:Gem::Version
|
|
51
|
-
version: 1.1.
|
|
51
|
+
version: 1.1.1
|
|
52
52
|
- !ruby/object:Gem::Dependency
|
|
53
53
|
name: compass-import-once-sass37
|
|
54
54
|
requirement: !ruby/object:Gem::Requirement
|
|
55
55
|
requirements:
|
|
56
56
|
- - "~>"
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: 1.1.
|
|
58
|
+
version: 1.1.1
|
|
59
59
|
type: :runtime
|
|
60
60
|
prerelease: false
|
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
|
63
63
|
- - "~>"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: 1.1.
|
|
65
|
+
version: 1.1.1
|
|
66
66
|
- !ruby/object:Gem::Dependency
|
|
67
67
|
name: chunky_png
|
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|