compass 0.12.2 → 0.13.alpha.4
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.
- data/README.markdown +5 -5
- data/Rakefile +14 -9
- data/VERSION.yml +5 -4
- data/features/command_line.feature +8 -50
- data/features/step_definitions/command_line_steps.rb +3 -2
- data/frameworks/compass/stylesheets/compass/_css3.scss +3 -0
- data/frameworks/compass/stylesheets/compass/_support.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_animation.scss +121 -0
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +14 -9
- data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +32 -36
- data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +32 -35
- data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +12 -15
- data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +27 -48
- data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +22 -35
- data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_box.scss +58 -83
- data/frameworks/compass/stylesheets/compass/css3/_columns.scss +113 -71
- data/frameworks/compass/stylesheets/compass/css3/_filter.scss +38 -18
- data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +294 -0
- data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +13 -22
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +45 -48
- data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +1 -1
- data/frameworks/compass/stylesheets/compass/css3/_regions.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_selection.scss +31 -0
- data/frameworks/compass/stylesheets/compass/css3/_shared.scss +226 -2
- data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +21 -26
- data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_transform.scss +8 -8
- data/frameworks/compass/stylesheets/compass/css3/_transition.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +43 -4
- data/frameworks/compass/stylesheets/compass/typography/_units.scss +152 -0
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +180 -102
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +5 -3
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +6 -3
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +7 -3
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +2 -2
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +32 -13
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +14 -9
- data/lib/compass/actions.rb +5 -1
- data/lib/compass/commands/project_base.rb +7 -1
- data/lib/compass/commands/update_project.rb +2 -3
- data/lib/compass/commands/watch_project.rb +11 -113
- data/lib/compass/commands.rb +1 -1
- data/lib/compass/compiler.rb +6 -0
- data/lib/compass/configuration/data.rb +1 -1
- data/lib/compass/configuration/helpers.rb +2 -0
- data/lib/compass/exec/global_options_parser.rb +1 -1
- data/lib/compass/exec/project_options_parser.rb +13 -1
- data/lib/compass/logger.rb +2 -0
- data/lib/compass/sass_extensions/functions/cross_browser_support.rb +1 -1
- data/lib/compass/sass_extensions/functions/env.rb +18 -0
- data/lib/compass/sass_extensions/functions/gradient_support.rb +101 -29
- data/lib/compass/sass_extensions/functions/image_size.rb +2 -1
- data/lib/compass/sass_extensions/functions/math.rb +14 -2
- data/lib/compass/sass_extensions/functions/sprites.rb +82 -22
- data/lib/compass/sass_extensions/functions/urls.rb +37 -6
- data/lib/compass/sass_extensions/functions/utility.rb +10 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +5 -1
- data/lib/compass/sass_extensions/sprites/engines.rb +3 -3
- data/lib/compass/sass_extensions/sprites/image.rb +7 -2
- data/lib/compass/sass_extensions/sprites/image_methods.rb +5 -1
- data/lib/compass/sass_extensions/sprites/images.rb +29 -0
- data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
- data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
- data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
- data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
- data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +9 -115
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +5 -1
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +9 -14
- data/lib/compass/sass_extensions/sprites.rb +2 -0
- data/lib/compass/sprite_importer/content.erb +29 -24
- data/lib/compass/sprite_importer.rb +7 -11
- data/lib/compass/watcher/compiler.rb +59 -0
- data/lib/compass/watcher/project_watcher.rb +111 -0
- data/lib/compass/watcher/watch.rb +33 -0
- data/lib/compass/watcher.rb +11 -0
- data/lib/compass.rb +2 -2
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +7 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +11 -0
- data/test/fixtures/stylesheets/busted_font_urls/tmp/screen.css +7 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +33 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +33 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +5 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +15 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +24 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +32 -61
- data/test/fixtures/stylesheets/compass/css/flexbox.css +121 -0
- data/test/fixtures/stylesheets/compass/css/gradients.css +65 -37
- data/test/fixtures/stylesheets/compass/css/grid_background.css +10 -17
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +4 -2
- data/test/fixtures/stylesheets/compass/css/lists.css +5 -5
- data/test/fixtures/stylesheets/compass/css/pie.css +0 -3
- data/test/fixtures/stylesheets/compass/css/regions.css +4 -2
- data/test/fixtures/stylesheets/compass/css/selection.css +13 -0
- data/test/fixtures/stylesheets/compass/css/sprites.css +251 -250
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +6 -6
- data/test/fixtures/stylesheets/compass/css/transition.css +6 -0
- data/test/fixtures/stylesheets/compass/css/units.css +30 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +22 -1
- data/test/fixtures/stylesheets/compass/css/utilities.css +15 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +196 -27
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +19 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +4 -2
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +10 -9
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +44 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +32 -3
- data/test/fixtures/stylesheets/compass/sass/selection.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +1 -1
- data/test/fixtures/stylesheets/compass/sass/units.scss +45 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +13 -1
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +208 -7
- data/test/fixtures/stylesheets/envtest/css/env.css +8 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +16 -0
- data/test/fixtures/stylesheets/envtest/tmp/env.css +4 -4
- data/test/fixtures/stylesheets/valid/css/simple.css +4 -0
- data/test/helpers/diff.rb +1 -1
- data/test/integrations/compass_test.rb +23 -14
- data/test/integrations/sprites_test.rb +305 -63
- data/test/test_helper.rb +4 -13
- data/test/units/command_line_test.rb +0 -2
- data/test/units/compass_module_test.rb +1 -1
- data/test/units/configuration_test.rb +12 -0
- data/test/units/regressions_test.rb +8 -8
- data/test/units/sass_extensions_test.rb +13 -11
- data/test/units/sass_extenstions/gradients_test.rb +33 -0
- data/test/units/sprites/image_test.rb +5 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/layout_test.rb +29 -4
- data/test/units/watcher/compiler_test.rb +39 -0
- data/test/units/watcher/project_watcher_test.rb +73 -0
- data/test/units/watcher/watch_test.rb +42 -0
- metadata +137 -241
- data/examples/compass/images/emblem-a043c4f148.png +0 -0
- data/examples/compass/images/flag-03c3b29b35.png +0 -0
- data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
- data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
- data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.otf +0 -0
- data/frameworks/blueprint/stylesheets/_blueprint.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +0 -101
- data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +0 -36
- data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +0 -28
- data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +0 -88
- data/frameworks/blueprint/stylesheets/blueprint/_form.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +0 -258
- data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +0 -111
- data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +0 -152
- data/frameworks/blueprint/stylesheets/blueprint/_print.scss +0 -86
- data/frameworks/blueprint/stylesheets/blueprint/_reset.scss +0 -3
- data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +0 -121
- data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +0 -52
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +0 -90
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +0 -83
- data/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/frameworks/blueprint/templates/basic/ie.sass +0 -4
- data/frameworks/blueprint/templates/basic/manifest.rb +0 -30
- data/frameworks/blueprint/templates/basic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/basic/print.sass +0 -4
- data/frameworks/blueprint/templates/basic/screen.sass +0 -12
- data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons.sass +0 -49
- data/frameworks/blueprint/templates/buttons/manifest.rb +0 -17
- data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons.sass +0 -13
- data/frameworks/blueprint/templates/link_icons/manifest.rb +0 -23
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +0 -16
- data/frameworks/blueprint/templates/project/manifest.rb +0 -30
- data/frameworks/blueprint/templates/project/partials/_base.sass +0 -11
- data/frameworks/blueprint/templates/project/print.sass +0 -8
- data/frameworks/blueprint/templates/project/screen.sass +0 -46
- data/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/frameworks/blueprint/templates/semantic/ie.sass +0 -16
- data/frameworks/blueprint/templates/semantic/manifest.rb +0 -33
- data/frameworks/blueprint/templates/semantic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/semantic/partials/_form.sass +0 -6
- data/frameworks/blueprint/templates/semantic/partials/_page.sass +0 -17
- data/frameworks/blueprint/templates/semantic/partials/_two_col.sass +0 -38
- data/frameworks/blueprint/templates/semantic/print.sass +0 -5
- data/frameworks/blueprint/templates/semantic/screen.sass +0 -14
- data/lib/compass/commands/generate_grid_background.rb +0 -96
- data/lib/compass/grid_builder.rb +0 -102
- data/test/fixtures/stylesheets/blueprint/config.rb +0 -14
- data/test/fixtures/stylesheets/blueprint/css/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/print.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/screen.css +0 -815
- data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +0 -80
- data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +0 -11
- data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +0 -30
- data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +0 -435
- data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +0 -46
- data/test/fixtures/stylesheets/blueprint/css/single-imports/link-icons.css +0 -40
- data/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +0 -651
- data/test/fixtures/stylesheets/blueprint/css/single-imports/print.css +0 -60
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +0 -69
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +0 -437
- data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +0 -45
- data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +0 -146
- data/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +0 -35
- data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/doc.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/email.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/external.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/feed.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/im.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/pdf.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/visited.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/xls.png +0 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +0 -18
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/buttons.scss +0 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/colors.scss +0 -34
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/debug.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/fancy-type.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/form.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/grid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/ie.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/interaction.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/link-icons.scss +0 -13
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/liquid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/print.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset-utilities.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset.scss +0 -1
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/rtl.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/scaffolding.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/typography.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/utilities.scss +0 -3
- data/test/fixtures/stylesheets/compass/images/flag-s4798b5a210.png +0 -0
- data/test/units/compass_png_test.rb +0 -46
- /data/{examples/css3/extensions/fancy-fonts/templates/project/bgrove.ttf → test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf} +0 -0
|
@@ -53,6 +53,18 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
|
53
53
|
assert_correct expected_lines, actual_lines
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
+
def test_custom_watch
|
|
57
|
+
contents = StringIO.new(<<-CONFIG)
|
|
58
|
+
watch 'img/**/*' do
|
|
59
|
+
puts 'foobar'
|
|
60
|
+
end
|
|
61
|
+
CONFIG
|
|
62
|
+
Compass.add_configuration(contents, 'test_watch_config')
|
|
63
|
+
watch = Compass.configuration.watches.first
|
|
64
|
+
assert_equal 'img/**/*', watch.glob
|
|
65
|
+
assert watch.is_a?(Compass::Watcher::Watch)
|
|
66
|
+
end
|
|
67
|
+
|
|
56
68
|
def test_serialization_warns_with_asset_host_set
|
|
57
69
|
contents = StringIO.new(<<-CONFIG)
|
|
58
70
|
asset_host do |path|
|
|
@@ -4,12 +4,16 @@ require 'compass/exec'
|
|
|
4
4
|
require 'stringio'
|
|
5
5
|
|
|
6
6
|
class RegressionsTest < Test::Unit::TestCase
|
|
7
|
+
include SpriteHelper
|
|
7
8
|
include Compass::CommandLineHelper
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
create_sprite_temp
|
|
9
12
|
Compass.reset_configuration!
|
|
10
13
|
end
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
def teardown
|
|
16
|
+
clean_up_sprites
|
|
13
17
|
Compass.reset_configuration!
|
|
14
18
|
end
|
|
15
19
|
|
|
@@ -18,12 +22,8 @@ class RegressionsTest < Test::Unit::TestCase
|
|
|
18
22
|
compass "create --bare issue911"
|
|
19
23
|
FileUtils.mkdir_p "issue911/images/sprites/a"
|
|
20
24
|
FileUtils.mkdir_p "issue911/images/sprites/b"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
open "issue911/images/sprites/b/bar.png", "wb" do |f|
|
|
25
|
-
f.write(Compass::PNG.new(5,10, [255,255,0]).to_blob)
|
|
26
|
-
end
|
|
25
|
+
FileUtils.cp File.join(@images_tmp_path, 'nested/squares/ten-by-ten.png'), "issue911/images/sprites/a/foo.png"
|
|
26
|
+
FileUtils.cp File.join(@images_tmp_path, 'nested/squares/ten-by-ten.png'), "issue911/images/sprites/a/bar.png"
|
|
27
27
|
Dir.chdir "issue911" do
|
|
28
28
|
result = compile_for_project(<<-SCSS)
|
|
29
29
|
@import "sprites/**/*.png";
|
|
@@ -23,7 +23,7 @@ class SassExtensionsTest < Test::Unit::TestCase
|
|
|
23
23
|
def test_enumerate
|
|
24
24
|
assert_equal ".grid-1, .grid-2, .grid-3", evaluate(%Q{enumerate(".grid", 1, 3, "-")})
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
def test_append_selector
|
|
28
28
|
assert_equal "div.bar", evaluate(%Q{append_selector("div", ".bar")})
|
|
29
29
|
assert_equal ".foo1.bar1, .foo1.bar2, .foo2.bar1, .foo2.bar2", evaluate(%Q{append_selector(".foo1, .foo2", ".bar1, .bar2")})
|
|
@@ -75,24 +75,24 @@ class SassExtensionsTest < Test::Unit::TestCase
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def test_math_functions
|
|
78
|
-
assert_equal "0.
|
|
79
|
-
assert_equal "0.
|
|
78
|
+
assert_equal "0.84147", evaluate("sin(1)")
|
|
79
|
+
assert_equal "0.84147px", evaluate("sin(1px)")
|
|
80
80
|
assert_equal "0.0", evaluate("sin(pi())")
|
|
81
81
|
assert_equal "1", evaluate("sin(pi() / 2)")
|
|
82
82
|
assert_equal "0.0", evaluate("sin(180deg)")
|
|
83
83
|
assert_equal "-1", evaluate("sin(3* pi() / 2)")
|
|
84
84
|
assert_equal "-1", evaluate("cos(pi())")
|
|
85
85
|
assert_equal "1", evaluate("cos(360deg)")
|
|
86
|
-
assert_equal "-0.
|
|
86
|
+
assert_equal "-0.17605", evaluate("sin(270)")
|
|
87
87
|
assert_equal "1", evaluate("cos(2*pi())")
|
|
88
88
|
assert_equal "0.0", evaluate("cos(pi() / 2)")
|
|
89
89
|
assert_equal "0.0", evaluate("cos(3* pi() / 2)")
|
|
90
90
|
assert_equal "0.0", evaluate("tan(pi())")
|
|
91
91
|
assert_equal "0.0", evaluate("tan(360deg)")
|
|
92
|
-
assert_equal "0.
|
|
92
|
+
assert_equal "0.95892", evaluate("sin(360)")
|
|
93
93
|
assert evaluate("tan(pi()/2 - 0.0001)").to_f > 1000, evaluate("tan(pi()/2 - 0.0001)")
|
|
94
94
|
assert evaluate("tan(pi()/2 + 0.0001)").to_f < -1000, evaluate("tan(pi()/2 - 0.0001)")
|
|
95
|
-
assert_equal "0.
|
|
95
|
+
assert_equal "0.69315px", evaluate("logarithm(2px)")
|
|
96
96
|
assert_equal "0", evaluate("logarithm(1)")
|
|
97
97
|
assert_equal "1", evaluate("logarithm(e())")
|
|
98
98
|
assert_equal "1", evaluate("logarithm($number: e())")
|
|
@@ -103,7 +103,9 @@ class SassExtensionsTest < Test::Unit::TestCase
|
|
|
103
103
|
assert_equal "5px", evaluate("square-root($number: 25px)")
|
|
104
104
|
assert_equal "25px", evaluate("pow(5px, 2)")
|
|
105
105
|
assert_equal "25px", evaluate("pow($number: 5px, $exponent: 2)")
|
|
106
|
-
assert_equal "79.
|
|
106
|
+
assert_equal "79.43236px", evaluate("pow(5px, e())")
|
|
107
|
+
assert (0..2).include?(evaluate("random(2)").to_i)
|
|
108
|
+
assert (4..16).include?(evaluate("random(4, 16)").to_i)
|
|
107
109
|
end
|
|
108
110
|
|
|
109
111
|
def test_blank
|
|
@@ -176,16 +178,16 @@ class SassExtensionsTest < Test::Unit::TestCase
|
|
|
176
178
|
base64_string = File.read(File.join(Compass.configuration.fonts_path, "bgrove.base64.txt")).chomp
|
|
177
179
|
assert_equal "url('data:font/truetype;base64,#{base64_string}') format('truetype')", evaluate("inline_font_files('bgrove.ttf', truetype)")
|
|
178
180
|
end
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
|
|
182
|
+
|
|
181
183
|
def test_image_size_should_respond_to_to_path
|
|
182
184
|
object = mock()
|
|
183
185
|
object.expects(:to_path).returns('foo.jpg')
|
|
184
186
|
object.expects(:respond_to?).with(:to_path).returns(true)
|
|
185
|
-
|
|
187
|
+
|
|
186
188
|
Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(object)
|
|
187
189
|
end
|
|
188
|
-
|
|
190
|
+
|
|
189
191
|
def test_reject
|
|
190
192
|
assert_equal "b d", evaluate("reject(a b c d, a, c)")
|
|
191
193
|
assert_equal "a b c d", evaluate("reject(a b c d, e)")
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class GradientTestClass
|
|
2
|
+
extend Compass::SassExtensions::Functions::Constants
|
|
3
|
+
extend Compass::SassExtensions::Functions::GradientSupport::Functions
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
require 'test_helper'
|
|
7
|
+
require 'compass'
|
|
8
|
+
|
|
9
|
+
class GradientsTest < Test::Unit::TestCase
|
|
10
|
+
|
|
11
|
+
def klass
|
|
12
|
+
GradientTestClass
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def sass_string(s)
|
|
16
|
+
Sass::Script::String.new(s)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def sass_list(array)
|
|
20
|
+
Sass::Script::List.new(array, :space)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test "should return correct angle" do
|
|
24
|
+
assert_equal Sass::Script::Number.new(330, ['deg']), klass.convert_angle_from_offical(Sass::Script::Number.new(120, ['deg']))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
test "Should convert old to new" do
|
|
28
|
+
[:top => ['to', 'bottom'], :bottom => ['to', 'top'], :left => ['to', 'right'], :right => ['to', 'left']].each do |test_value|
|
|
29
|
+
assert_equal sass_string(test_value.keys.first.to_s), klass.convert_angle_from_offical(sass_list([sass_string(test_value.values[0].first), sass_string(test_value.values[0].last)]))
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -74,6 +74,11 @@ class SpritesImageTest < Test::Unit::TestCase
|
|
|
74
74
|
assert img.repeat_x?
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
+
test 'image repeat-y' do
|
|
78
|
+
img = test_image "selectors_ten_by_ten_repeat" => Sass::Script::String.new('repeat-y')
|
|
79
|
+
assert img.repeat_y?
|
|
80
|
+
end
|
|
81
|
+
|
|
77
82
|
test 'image position' do
|
|
78
83
|
image = test_image "selectors_ten_by_ten_position" => Sass::Script::Number.new(100, ["px"])
|
|
79
84
|
assert_equal 100, image.position.value
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass/sass_extensions/sprites/images'
|
|
3
|
+
|
|
4
|
+
class ImagesTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@images = Compass::SassExtensions::Sprites::Images.new
|
|
8
|
+
@images << OpenStruct.new(:foo => 1, :name => 'bob', :size => 1200, :width => 10)
|
|
9
|
+
@images << OpenStruct.new(:foo => 2, :name => 'bob', :size => 300, :width => 100)
|
|
10
|
+
@images << OpenStruct.new(:foo => 3, :name => 'aob', :size => 120, :width => 50)
|
|
11
|
+
@images << OpenStruct.new(:foo => 4, :name => 'zbob', :size => 600, :width => 55)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
test "sort by size" do
|
|
16
|
+
@images.sort_by! :size
|
|
17
|
+
assert_equal [3, 2, 4, 1], @images.map(&:foo)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "sort by !size" do
|
|
21
|
+
@images.sort_by! '!size'
|
|
22
|
+
assert_equal [3, 2, 4, 1].reverse, @images.map(&:foo)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
test "sort by name" do
|
|
26
|
+
@images.sort_by! :name
|
|
27
|
+
assert_equal [3, 2, 1, 4], @images.map(&:foo)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
test "sort by !name" do
|
|
31
|
+
@images.sort_by! '!name'
|
|
32
|
+
assert_equal [3, 2, 1, 4].reverse, @images.map(&:foo)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test "sort by width" do
|
|
36
|
+
@images.sort_by! :width
|
|
37
|
+
assert_equal [1, 3, 4, 2], @images.map(&:foo)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
test "sort by !width" do
|
|
41
|
+
@images.sort_by! '!width'
|
|
42
|
+
assert_equal [1, 3, 4, 2].reverse, @images.map(&:foo)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
@@ -44,20 +44,20 @@ class LayoutTest < Test::Unit::TestCase
|
|
|
44
44
|
sprite_map_test(opts)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
def horizontal(options= {})
|
|
47
|
+
def horizontal(options= {}, uri=URI)
|
|
48
48
|
opts = @options.merge("layout" => Sass::Script::String.new('horizontal'))
|
|
49
49
|
opts.merge!(options)
|
|
50
50
|
|
|
51
|
-
sprite_map_test(opts)
|
|
51
|
+
sprite_map_test(opts, uri)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# REPEAT_X
|
|
55
55
|
|
|
56
56
|
test 'repeat-x layout single image' do
|
|
57
|
-
opts = {"repeat_x_three_repeat" => Sass::Script::String.new('repeat-x')}
|
|
57
|
+
opts = {"repeat_x_three_repeat" => Sass::Script::String.new('repeat-x'), 'sort_by' => Sass::Script::String.new('width')}
|
|
58
58
|
map = sprite_map_test(@options.merge(opts), 'repeat_x/*.png')
|
|
59
59
|
assert_equal 6, map.width
|
|
60
|
-
assert_equal [0,
|
|
60
|
+
assert_equal [0, 1, 3, 6, 10, 3, 3], map.images.map(&:top)
|
|
61
61
|
assert_equal [0, 0, 0, 0, 0, 0, 3], map.images.map(&:left)
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -67,6 +67,22 @@ class LayoutTest < Test::Unit::TestCase
|
|
|
67
67
|
assert_equal 12, map.width
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
test "repeat-y layout single image" do
|
|
71
|
+
opts = {"layout" => Sass::Script::String.new('horizontal'), "squares_ten_by_ten_repeat" => Sass::Script::String.new('repeat-y')}
|
|
72
|
+
map = sprite_map_test(@options.merge(opts), 'squares/*.png')
|
|
73
|
+
assert_equal 30, map.width
|
|
74
|
+
assert_equal 20, map.height
|
|
75
|
+
assert_equal 3, map.images.size
|
|
76
|
+
assert_equal [[0,0], [0,10], [10,0]], map.images.map { |img| [img.top, img.left] }
|
|
77
|
+
assert map.horizontal?
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
test "repeat-y layout multi image" do
|
|
81
|
+
opts = {"layout" => Sass::Script::String.new('horizontal'), "repeat_x_three_repeat" => Sass::Script::String.new('repeat-y'), "repeat_x_four_repeat" => Sass::Script::String.new('repeat-y')}
|
|
82
|
+
map = sprite_map_test(@options.merge(opts), 'repeat_x/*.png')
|
|
83
|
+
assert_equal [[0, 0], [0, 5], [0, 9], [0, 10], [0, 13], [4, 5], [8, 5], [3, 10], [6, 10], [9, 10]], map.images.map { |img| [img.top, img.left] }
|
|
84
|
+
end
|
|
85
|
+
|
|
70
86
|
# VERTICAL LAYOUT
|
|
71
87
|
|
|
72
88
|
it "should have a vertical layout" do
|
|
@@ -139,10 +155,19 @@ class LayoutTest < Test::Unit::TestCase
|
|
|
139
155
|
assert_equal [0, 0, 0, 0], base.images.map(&:top)
|
|
140
156
|
assert_equal 80, base.width
|
|
141
157
|
end
|
|
158
|
+
|
|
159
|
+
it "should layout horizontaly with spacing and and position" do
|
|
160
|
+
base = horizontal({"spacing" => Sass::Script::Number.new(10, ['px']), "position" => Sass::Script::Number.new(50, ['%'])}, 'squares/*.png')
|
|
161
|
+
assert_equal [0, 20], base.images.map(&:left)
|
|
162
|
+
assert_equal [5, 0], base.images.map(&:top)
|
|
163
|
+
assert_equal 50, base.width
|
|
164
|
+
end
|
|
142
165
|
|
|
143
166
|
it "should layout horizontaly with position" do
|
|
144
167
|
base = horizontal("selectors_ten_by_ten_active_position" => Sass::Script::Number.new(10, ['px']))
|
|
145
168
|
assert_equal [0, 10, 0, 0], base.images.map(&:top)
|
|
169
|
+
assert_equal 40, base.width
|
|
170
|
+
assert_equal 20, base.height
|
|
146
171
|
end
|
|
147
172
|
|
|
148
173
|
it "should generate a horrizontal sprite" do
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass'
|
|
3
|
+
|
|
4
|
+
class WatcherCompilerTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
def setup
|
|
7
|
+
@working_path = File.join(fixture_path, 'stylesheets', 'valid')
|
|
8
|
+
@to = File.join(@working_path, 'css')
|
|
9
|
+
remove_to
|
|
10
|
+
Compass.add_configuration({:sass_path => File.join(@working_path, 'sass'), :css_path => @to }, 'test')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
test "it sould create a new instance of a compass compiler" do
|
|
14
|
+
watch_compiler = Compass::Watcher::Compiler.new(@working_path, {})
|
|
15
|
+
assert watch_compiler.compiler.is_a?(Compass::Compiler)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
test "debug info gets passed into sass options" do
|
|
19
|
+
watch_compiler = Compass::Watcher::Compiler.new(@working_path, {:debug_info => true})
|
|
20
|
+
assert watch_compiler.compiler_options[:sass][:debug_info]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
test "should run compiler" do
|
|
24
|
+
watch_compiler = Compass::Watcher::Compiler.new(@working_path, {})
|
|
25
|
+
watch_compiler.compiler.expects(:reset_staleness_checker!).once
|
|
26
|
+
watch_compiler.compiler.expects(:run).once
|
|
27
|
+
watch_compiler.expects(:log_action).once
|
|
28
|
+
watch_compiler.compile
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def remove_to
|
|
32
|
+
::FileUtils.rm_r @to if File.exists?(@to)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def teardown
|
|
36
|
+
remove_to
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass'
|
|
3
|
+
|
|
4
|
+
class ProjectWatcherTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
FOO = ['foo.scss']
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@working_path = File.join(fixture_path, 'stylesheets', 'valid')
|
|
10
|
+
@to = File.join(@working_path, 'css')
|
|
11
|
+
remove_to
|
|
12
|
+
Compass.add_configuration({:sass_path => File.join(@working_path, 'sass'), :css_path => @to }, 'test')
|
|
13
|
+
@project_watcher = Compass::Watcher::ProjectWatcher.new(@working_path)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
test "should initalize correctly" do
|
|
17
|
+
assert @project_watcher.listener.is_a?(Listen::Listener)
|
|
18
|
+
assert_equal 2, @project_watcher.sass_watchers.size
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
test "should have 3 watchers" do
|
|
22
|
+
Dir.chdir File.join(@working_path, 'sass') do
|
|
23
|
+
@project_watcher = Compass::Watcher::ProjectWatcher.new(Dir.pwd)
|
|
24
|
+
assert_equal 3, @project_watcher.sass_watchers.size
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test "compiler" do
|
|
29
|
+
assert @project_watcher.compiler.is_a?(Compass::Compiler)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
test "sass callback add" do
|
|
33
|
+
@project_watcher.expects(:sass_added).with(FOO).once
|
|
34
|
+
@project_watcher.send(:sass_callback, @working_path, FOO, :added)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
test "sass callback modified" do
|
|
38
|
+
@project_watcher.expects(:sass_modified).with(FOO).once
|
|
39
|
+
@project_watcher.send(:sass_callback, @working_path, FOO, :modified)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
test "sass callback removed" do
|
|
43
|
+
@project_watcher.expects(:sass_removed).with(FOO).once
|
|
44
|
+
@project_watcher.send(:sass_callback, @working_path, FOO, :removed)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
SAMPLE = ['sass/sample.scss']
|
|
48
|
+
|
|
49
|
+
test "listen callback modified" do
|
|
50
|
+
@project_watcher.expects(:sass_modified).with(SAMPLE[0]).once
|
|
51
|
+
@project_watcher.send(:listen_callback, SAMPLE, [], [])
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
test "listen callback added" do
|
|
55
|
+
@project_watcher.expects(:sass_added).with(SAMPLE[0]).once
|
|
56
|
+
@project_watcher.send(:listen_callback, [], SAMPLE, [])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
test "listen callback removed" do
|
|
60
|
+
@project_watcher.expects(:sass_removed).with(SAMPLE[0]).once
|
|
61
|
+
@project_watcher.send(:listen_callback, [], [], SAMPLE)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def remove_to
|
|
65
|
+
::FileUtils.rm_r @to if File.exists?(@to)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def teardown
|
|
69
|
+
remove_to
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require 'compass'
|
|
3
|
+
|
|
4
|
+
class WatcherWatchTest < Test::Unit::TestCase
|
|
5
|
+
|
|
6
|
+
test "should throw exception if given absolute path" do
|
|
7
|
+
begin
|
|
8
|
+
watcher = Compass::Watcher::Watch.new('/images/*.png') do
|
|
9
|
+
puts "something"
|
|
10
|
+
end
|
|
11
|
+
rescue Compass::Watcher::AbsolutePathError
|
|
12
|
+
assert true, "Compass::Watcher::AbsolutePathError was not raised"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
test "should throw exception if not given a block" do
|
|
17
|
+
begin
|
|
18
|
+
watcher = Compass::Watcher::Watch.new('images/*.png')
|
|
19
|
+
rescue Compass::Watcher::NoCallbackError
|
|
20
|
+
assert true, "Compass::Watcher::NoCallbackError was not raised"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
test "changed path matches glob" do
|
|
25
|
+
watcher = Compass::Watcher::Watch.new('images/*.png') { }
|
|
26
|
+
assert watcher.match?('images/baz.png'), "Path does not match"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
test "changed path doesn't matches glob" do
|
|
30
|
+
watcher = Compass::Watcher::Watch.new('images/*.png') { }
|
|
31
|
+
assert !watcher.match?('foo/baz.png'), "Path does match and it shouldn't"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
test "can run callback" do
|
|
35
|
+
test = 0
|
|
36
|
+
watcher = Compass::Watcher::Watch.new('images/*.png') { test = 1}
|
|
37
|
+
watcher.run_callback(:project, :local, :action)
|
|
38
|
+
assert_equal 1, test
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
end
|