compass-sourcemaps 0.12.3.sourcemaps.a4836f1 → 0.12.4.sourcemaps.a4836f1
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/LICENSE.markdown +29 -29
- data/README.markdown +39 -39
- data/Rakefile +157 -157
- data/VERSION.yml +5 -5
- data/bin/compass +45 -45
- data/examples/README.markdown +3 -3
- data/examples/blueprint_default/config.rb +7 -7
- data/examples/blueprint_default/index.html.haml +85 -85
- data/examples/blueprint_default/parts/elements.html.haml +282 -282
- data/examples/blueprint_default/parts/forms.html.haml +200 -200
- data/examples/blueprint_default/parts/grid.html.haml +274 -274
- data/examples/blueprint_default/src/ie.scss +3 -3
- data/examples/blueprint_default/src/print.scss +3 -3
- data/examples/blueprint_default/src/screen.scss +9 -9
- data/examples/blueprint_plugins/config.rb +8 -8
- data/examples/blueprint_plugins/index.html.haml +96 -96
- data/examples/blueprint_plugins/plugins/buttons.html.haml +67 -67
- data/examples/blueprint_plugins/plugins/fancy_type.html.haml +100 -100
- data/examples/blueprint_plugins/plugins/link_icons.html.haml +61 -61
- data/examples/blueprint_plugins/plugins/rtl.html.haml +100 -100
- data/examples/blueprint_plugins/src/buttons.scss +47 -47
- data/examples/blueprint_plugins/src/ie.scss +3 -3
- data/examples/blueprint_plugins/src/link_icons.scss +13 -13
- data/examples/blueprint_plugins/src/print.scss +3 -3
- data/examples/blueprint_plugins/src/rtl_screen.scss +15 -15
- data/examples/blueprint_plugins/src/screen.scss +12 -12
- data/examples/blueprint_scoped/src/ie.scss +4 -4
- data/examples/blueprint_scoped/src/print.scss +4 -4
- data/examples/blueprint_scoped/src/screen.scss +5 -5
- data/examples/blueprint_scoped_form/src/ie.scss +3 -3
- data/examples/blueprint_scoped_form/src/print.scss +3 -3
- data/examples/blueprint_scoped_form/src/screen.scss +15 -15
- data/examples/blueprint_semantic/config.rb +7 -7
- data/examples/blueprint_semantic/index.html.haml +86 -86
- data/examples/blueprint_semantic/parts/fancy_type.html.haml +100 -100
- data/examples/blueprint_semantic/parts/liquid.html.haml +100 -100
- data/examples/blueprint_semantic/src/ie.scss +3 -3
- data/examples/blueprint_semantic/src/liquid.scss +69 -69
- data/examples/blueprint_semantic/src/print.scss +3 -3
- data/examples/blueprint_semantic/src/screen.scss +69 -69
- data/examples/compass/bootstrap.rb +3 -3
- data/examples/compass/clean.rb +1 -1
- data/examples/compass/compass.html.haml +39 -39
- data/examples/compass/config.rb +8 -8
- data/examples/compass/pie.html.haml +73 -73
- data/examples/compass/sprites.html.haml +37 -37
- data/examples/compass/src/bp_layout.scss +18 -18
- data/examples/compass/src/compass.scss +46 -46
- data/examples/compass/src/pie.scss +110 -110
- data/examples/compass/src/sprites.scss +24 -24
- data/examples/compass/src/sticky_footer.scss +11 -11
- data/examples/compass/src/utilities.scss +108 -108
- data/examples/compass/sticky_footer.html.haml +13 -13
- data/examples/compass/utilities.html.haml +189 -189
- data/examples/css3/bootstrap.rb +3 -3
- data/examples/css3/clean.rb +2 -2
- data/examples/css3/config.rb +6 -6
- data/examples/css3/extensions/fancy-fonts/templates/project/fancy-fonts.sass +10 -10
- data/examples/css3/extensions/fancy-fonts/templates/project/manifest.rb +6 -6
- data/examples/css3/gradients.html.haml +68 -68
- data/examples/css3/index.html.haml +57 -57
- data/examples/css3/src/_base.scss +13 -13
- data/examples/css3/src/fancy-fonts.scss +13 -13
- data/examples/css3/src/gradients.scss +85 -85
- data/examples/css3/src/main.scss +108 -108
- data/examples/downloader.rb +58 -58
- data/examples/ninesixty/bootstrap.rb +4 -4
- data/examples/ninesixty/clean.rb +1 -1
- data/examples/ninesixty/config.rb +9 -9
- data/examples/ninesixty/src/grid.scss +15 -15
- data/examples/ninesixty/src/text.scss +8 -8
- data/examples/susy/bootstrap.rb +3 -3
- data/examples/susy/clean.rb +1 -1
- data/examples/susy/config.rb +9 -9
- data/examples/susy/src/_base.scss +61 -61
- data/examples/susy/src/_defaults.scss +140 -140
- data/examples/susy/src/screen.scss +100 -100
- data/examples/yui/bootstrap.rb +2 -2
- data/examples/yui/clean.rb +1 -1
- data/examples/yui/divisions.html.haml +179 -179
- data/examples/yui/index.html.haml +19 -19
- data/examples/yui/src/screen.scss +13 -13
- data/examples/yui/sub_divisions.html.haml +169 -169
- data/examples/yui/templates.html.haml +54 -54
- data/examples/yui/typography.html.haml +132 -132
- data/features/command_line.feature +292 -292
- data/features/extensions.feature +27 -27
- data/features/step_definitions/command_line_steps.rb +268 -268
- data/features/step_definitions/extension_steps.rb +24 -24
- data/frameworks/blueprint/stylesheets/_blueprint.scss +37 -37
- data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +100 -100
- data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +36 -36
- data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +28 -28
- data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +88 -88
- data/frameworks/blueprint/stylesheets/blueprint/_form.scss +66 -66
- data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +258 -258
- data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +111 -111
- data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +66 -66
- data/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +37 -37
- data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +152 -152
- data/frameworks/blueprint/stylesheets/blueprint/_print.scss +86 -86
- data/frameworks/blueprint/stylesheets/blueprint/_reset.scss +2 -2
- data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +121 -121
- data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +52 -52
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +90 -90
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +37 -37
- data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +83 -83
- data/frameworks/blueprint/templates/basic/ie.sass +4 -4
- data/frameworks/blueprint/templates/basic/manifest.rb +30 -30
- data/frameworks/blueprint/templates/basic/partials/_base.sass +10 -10
- data/frameworks/blueprint/templates/basic/print.sass +4 -4
- data/frameworks/blueprint/templates/basic/screen.sass +12 -12
- data/frameworks/blueprint/templates/buttons/buttons.sass +49 -49
- 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/manifest.rb +17 -17
- data/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -13
- data/frameworks/blueprint/templates/link_icons/manifest.rb +23 -23
- data/frameworks/blueprint/templates/project/ie.sass +16 -16
- data/frameworks/blueprint/templates/project/manifest.rb +30 -30
- data/frameworks/blueprint/templates/project/partials/_base.sass +11 -11
- data/frameworks/blueprint/templates/project/print.sass +7 -7
- data/frameworks/blueprint/templates/project/screen.sass +46 -46
- data/frameworks/blueprint/templates/semantic/ie.sass +16 -16
- data/frameworks/blueprint/templates/semantic/manifest.rb +33 -33
- data/frameworks/blueprint/templates/semantic/partials/_base.sass +10 -10
- data/frameworks/blueprint/templates/semantic/partials/_form.sass +5 -5
- data/frameworks/blueprint/templates/semantic/partials/_page.sass +17 -17
- data/frameworks/blueprint/templates/semantic/partials/_two_col.sass +38 -38
- data/frameworks/blueprint/templates/semantic/print.sass +4 -4
- data/frameworks/blueprint/templates/semantic/screen.sass +14 -14
- data/frameworks/compass/stylesheets/_compass.scss +3 -3
- data/frameworks/compass/stylesheets/_lemonade.scss +37 -37
- data/frameworks/compass/stylesheets/compass/_css3.scss +20 -20
- data/frameworks/compass/stylesheets/compass/_layout.scss +3 -3
- data/frameworks/compass/stylesheets/compass/_reset-legacy.scss +3 -3
- data/frameworks/compass/stylesheets/compass/_reset.scss +3 -3
- data/frameworks/compass/stylesheets/compass/_support.scss +40 -40
- data/frameworks/compass/stylesheets/compass/_typography.scss +4 -4
- data/frameworks/compass/stylesheets/compass/_utilities.scss +9 -9
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +17 -17
- data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +43 -43
- data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +42 -42
- data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +26 -26
- data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +130 -130
- data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +76 -76
- data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +13 -13
- data/frameworks/compass/stylesheets/compass/css3/_box.scss +111 -111
- data/frameworks/compass/stylesheets/compass/css3/_columns.scss +156 -156
- data/frameworks/compass/stylesheets/compass/css3/_filter.scss +23 -23
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +48 -48
- data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +77 -77
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +132 -132
- data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +22 -22
- data/frameworks/compass/stylesheets/compass/css3/_opacity.scss +19 -19
- data/frameworks/compass/stylesheets/compass/css3/_pie.scss +72 -72
- data/frameworks/compass/stylesheets/compass/css3/_regions.scss +21 -21
- data/frameworks/compass/stylesheets/compass/css3/_shared.scss +38 -38
- data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +87 -87
- data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +87 -87
- data/frameworks/compass/stylesheets/compass/css3/_transform.scss +598 -598
- data/frameworks/compass/stylesheets/compass/css3/_transition.scss +221 -221
- data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +17 -17
- data/frameworks/compass/stylesheets/compass/layout/_grid-background.scss +178 -178
- data/frameworks/compass/stylesheets/compass/layout/_sticky-footer.scss +23 -23
- data/frameworks/compass/stylesheets/compass/layout/_stretching.scss +23 -23
- data/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss +135 -135
- data/frameworks/compass/stylesheets/compass/reset/_utilities.scss +142 -142
- data/frameworks/compass/stylesheets/compass/typography/_links.scss +3 -3
- data/frameworks/compass/stylesheets/compass/typography/_lists.scss +4 -4
- data/frameworks/compass/stylesheets/compass/typography/_text.scss +4 -4
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +221 -221
- data/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss +5 -5
- data/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss +28 -28
- data/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss +7 -7
- data/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss +34 -34
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +61 -61
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss +50 -50
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +44 -44
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +25 -25
- data/frameworks/compass/stylesheets/compass/typography/text/_force-wrap.scss +12 -12
- data/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss +2 -2
- data/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss +68 -68
- data/frameworks/compass/stylesheets/compass/utilities/_general.scss +6 -6
- data/frameworks/compass/stylesheets/compass/utilities/_links.scss +5 -5
- data/frameworks/compass/stylesheets/compass/utilities/_lists.scss +6 -6
- data/frameworks/compass/stylesheets/compass/utilities/_print.scss +17 -17
- data/frameworks/compass/stylesheets/compass/utilities/_sprites.scss +2 -2
- data/frameworks/compass/stylesheets/compass/utilities/_tables.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/_text.scss +5 -5
- data/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss +27 -27
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +44 -44
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +29 -29
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +46 -46
- data/frameworks/compass/stylesheets/compass/utilities/general/_min.scss +16 -16
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.scss +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.scss +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag-cloud.scss +18 -18
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +65 -65
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite-img.scss +78 -78
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +22 -22
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +33 -33
- data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.scss +9 -9
- data/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +3 -3
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +3 -3
- data/frameworks/compass/templates/ellipsis/ellipsis.sass +8 -8
- data/frameworks/compass/templates/ellipsis/manifest.rb +26 -26
- data/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +13 -13
- data/frameworks/compass/templates/extension/manifest.rb +26 -26
- data/frameworks/compass/templates/extension/stylesheets/main.sass +1 -1
- data/frameworks/compass/templates/extension/templates/project/manifest.rb +2 -2
- data/frameworks/compass/templates/extension/templates/project/screen.sass +1 -1
- data/frameworks/compass/templates/pie/LICENSE +12 -12
- data/frameworks/compass/templates/pie/LICENSE-APACHE2.txt +13 -13
- data/frameworks/compass/templates/pie/LICENSE-GPL2.txt +277 -277
- data/frameworks/compass/templates/pie/PIE.htc +96 -96
- data/frameworks/compass/templates/pie/manifest.rb +39 -39
- data/frameworks/compass/templates/pie/pie.scss +73 -73
- data/frameworks/compass/templates/project/USAGE.markdown +32 -32
- data/frameworks/compass/templates/project/ie.sass +6 -6
- data/frameworks/compass/templates/project/manifest.rb +3 -3
- data/frameworks/compass/templates/project/print.sass +6 -6
- data/frameworks/compass/templates/project/screen.sass +7 -7
- data/lib/compass.rb +37 -37
- data/lib/compass/actions.rb +115 -115
- data/lib/compass/app_integration.rb +39 -39
- data/lib/compass/app_integration/rails.rb +18 -18
- data/lib/compass/app_integration/stand_alone.rb +22 -22
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +32 -32
- data/lib/compass/app_integration/stand_alone/installer.rb +83 -83
- data/lib/compass/browser_support.rb +62 -62
- data/lib/compass/commands.rb +12 -12
- data/lib/compass/commands/base.rb +44 -44
- data/lib/compass/commands/clean_project.rb +79 -79
- data/lib/compass/commands/create_project.rb +131 -131
- data/lib/compass/commands/default.rb +50 -50
- data/lib/compass/commands/extension_command.rb +60 -60
- data/lib/compass/commands/generate_grid_background.rb +96 -96
- data/lib/compass/commands/help.rb +85 -85
- data/lib/compass/commands/imports.rb +35 -35
- data/lib/compass/commands/installer_command.rb +32 -32
- data/lib/compass/commands/interactive.rb +61 -61
- data/lib/compass/commands/list_frameworks.rb +38 -38
- data/lib/compass/commands/print_version.rb +99 -99
- data/lib/compass/commands/project_base.rb +103 -103
- data/lib/compass/commands/project_stats.rb +178 -178
- data/lib/compass/commands/project_structure.rb +93 -93
- data/lib/compass/commands/registry.rb +40 -40
- data/lib/compass/commands/sprite.rb +89 -89
- data/lib/compass/commands/stamp_pattern.rb +90 -90
- data/lib/compass/commands/unpack_extension.rb +120 -120
- data/lib/compass/commands/update_project.rb +139 -139
- data/lib/compass/commands/validate_project.rb +77 -77
- data/lib/compass/commands/watch_project.rb +170 -170
- data/lib/compass/commands/write_configuration.rb +125 -125
- data/lib/compass/compiler.rb +200 -200
- data/lib/compass/configuration.rb +91 -91
- data/lib/compass/configuration/adapters.rb +77 -77
- data/lib/compass/configuration/comments.rb +59 -59
- data/lib/compass/configuration/data.rb +193 -193
- data/lib/compass/configuration/defaults.rb +187 -187
- data/lib/compass/configuration/file_data.rb +21 -21
- data/lib/compass/configuration/helpers.rb +160 -160
- data/lib/compass/configuration/inheritance.rb +304 -304
- data/lib/compass/configuration/paths.rb +19 -19
- data/lib/compass/configuration/serialization.rb +88 -88
- data/lib/compass/dependencies.rb +12 -12
- data/lib/compass/errors.rb +11 -11
- data/lib/compass/exec.rb +23 -23
- data/lib/compass/exec/command_option_parser.rb +23 -23
- data/lib/compass/exec/global_options_parser.rb +63 -63
- data/lib/compass/exec/helpers.rb +21 -21
- data/lib/compass/exec/project_options_parser.rb +66 -66
- data/lib/compass/exec/sub_command_ui.rb +51 -51
- data/lib/compass/exec/switch_ui.rb +179 -179
- data/lib/compass/frameworks.rb +133 -133
- data/lib/compass/grid_builder.rb +102 -102
- data/lib/compass/installers.rb +3 -3
- data/lib/compass/installers/bare_installer.rb +58 -58
- data/lib/compass/installers/base.rb +187 -187
- data/lib/compass/installers/manifest.rb +161 -161
- data/lib/compass/installers/manifest_installer.rb +61 -61
- data/lib/compass/installers/template_context.rb +43 -43
- data/lib/compass/logger.rb +103 -103
- data/lib/compass/quick_cache.rb +15 -15
- data/lib/compass/rails.rb +2 -2
- data/lib/compass/sass_extensions.rb +10 -10
- data/lib/compass/sass_extensions/functions.rb +34 -34
- data/lib/compass/sass_extensions/functions/colors.rb +67 -67
- data/lib/compass/sass_extensions/functions/constants.rb +74 -74
- data/lib/compass/sass_extensions/functions/cross_browser_support.rb +70 -70
- data/lib/compass/sass_extensions/functions/display.rb +27 -27
- data/lib/compass/sass_extensions/functions/enumerate.rb +6 -6
- data/lib/compass/sass_extensions/functions/env.rb +5 -5
- data/lib/compass/sass_extensions/functions/font_files.rb +41 -41
- data/lib/compass/sass_extensions/functions/gradient_support.rb +540 -540
- data/lib/compass/sass_extensions/functions/image_size.rb +113 -113
- data/lib/compass/sass_extensions/functions/inline_image.rb +64 -64
- data/lib/compass/sass_extensions/functions/lists.rb +101 -101
- data/lib/compass/sass_extensions/functions/math.rb +63 -63
- data/lib/compass/sass_extensions/functions/selectors.rb +63 -63
- data/lib/compass/sass_extensions/functions/sprites.rb +218 -218
- data/lib/compass/sass_extensions/functions/urls.rb +266 -266
- data/lib/compass/sass_extensions/monkey_patches.rb +3 -3
- data/lib/compass/sass_extensions/monkey_patches/browser_support.rb +95 -95
- data/lib/compass/sass_extensions/monkey_patches/traversal.rb +23 -23
- data/lib/compass/sass_extensions/sprites.rb +19 -19
- data/lib/compass/sass_extensions/sprites/engines.rb +25 -25
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +30 -30
- data/lib/compass/sass_extensions/sprites/image.rb +151 -151
- data/lib/compass/sass_extensions/sprites/image_methods.rb +31 -31
- data/lib/compass/sass_extensions/sprites/image_row.rb +46 -46
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +158 -158
- data/lib/compass/sass_extensions/sprites/row_fitter.rb +91 -91
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +86 -86
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +141 -141
- data/lib/compass/sprite_importer.rb +116 -116
- data/lib/compass/sprite_importer/binding.rb +10 -10
- data/lib/compass/sprite_importer/content.erb +80 -80
- data/lib/compass/stats.rb +99 -99
- data/lib/compass/test_case.rb +38 -38
- data/lib/compass/util.rb +29 -29
- data/lib/compass/validator.rb +16 -16
- data/lib/compass/version.rb +60 -60
- data/test/fixtures/extensions/only_stylesheets/compass_init.rb +1 -1
- data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +3 -3
- data/test/fixtures/fonts/bgrove.base64.txt +1 -1
- data/test/fixtures/fonts/bgrove.ttf +0 -0
- data/test/fixtures/sprites/public/images/ko/starbg26x27.png +0 -0
- data/test/fixtures/stylesheets/blueprint/config.rb +14 -14
- data/test/fixtures/stylesheets/blueprint/css/ie.css +76 -76
- data/test/fixtures/stylesheets/blueprint/css/print.css +56 -56
- data/test/fixtures/stylesheets/blueprint/css/screen.css +815 -815
- data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +56 -56
- data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +80 -80
- data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +11 -11
- data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +30 -30
- data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +42 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +435 -435
- data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +76 -76
- data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +46 -46
- data/test/fixtures/stylesheets/blueprint/css/single-imports/link-icons.css +40 -40
- data/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +651 -651
- data/test/fixtures/stylesheets/blueprint/css/single-imports/print.css +60 -60
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +75 -75
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +42 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +437 -437
- data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +45 -45
- data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +146 -146
- data/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +35 -35
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +18 -18
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/buttons.scss +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/colors.scss +34 -34
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/debug.scss +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/fancy-type.scss +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/form.scss +4 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/grid.scss +2 -2
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/ie.scss +2 -2
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/interaction.scss +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/link-icons.scss +12 -12
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/liquid.scss +2 -2
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/print.scss +4 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset-utilities.scss +4 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset.scss +1 -1
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/rtl.scss +2 -2
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/scaffolding.scss +5 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/typography.scss +3 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/utilities.scss +3 -3
- data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -29
- data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -9
- data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +13 -13
- data/test/fixtures/stylesheets/compass/config.rb +16 -16
- data/test/fixtures/stylesheets/compass/css/background-clip.css +10 -10
- data/test/fixtures/stylesheets/compass/css/border_radius.css +14 -14
- data/test/fixtures/stylesheets/compass/css/box-sizeing.css +9 -9
- data/test/fixtures/stylesheets/compass/css/box.css +103 -103
- data/test/fixtures/stylesheets/compass/css/box_shadow.css +14 -14
- data/test/fixtures/stylesheets/compass/css/columns.css +161 -161
- data/test/fixtures/stylesheets/compass/css/filters.css +29 -29
- data/test/fixtures/stylesheets/compass/css/fonts.css +4 -4
- data/test/fixtures/stylesheets/compass/css/force-wrap.css +9 -9
- data/test/fixtures/stylesheets/compass/css/gradients.css +202 -202
- data/test/fixtures/stylesheets/compass/css/grid_background.css +71 -71
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -16
- data/test/fixtures/stylesheets/compass/css/image_size.css +15 -15
- data/test/fixtures/stylesheets/compass/css/images.css +8 -8
- data/test/fixtures/stylesheets/compass/css/layout.css +16 -16
- data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +26 -26
- data/test/fixtures/stylesheets/compass/css/lists.css +151 -151
- data/test/fixtures/stylesheets/compass/css/opacity.css +3 -3
- data/test/fixtures/stylesheets/compass/css/pie.css +26 -26
- data/test/fixtures/stylesheets/compass/css/print.css +11 -11
- data/test/fixtures/stylesheets/compass/css/regions.css +7 -7
- data/test/fixtures/stylesheets/compass/css/replacement.css +59 -59
- data/test/fixtures/stylesheets/compass/css/reset.css +59 -59
- data/test/fixtures/stylesheets/compass/css/sprites.css +1262 -1262
- data/test/fixtures/stylesheets/compass/css/stretching.css +66 -66
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +29 -29
- data/test/fixtures/stylesheets/compass/css/transform.css +441 -441
- data/test/fixtures/stylesheets/compass/css/transition.css +128 -128
- data/test/fixtures/stylesheets/compass/css/user-interface.css +4 -4
- data/test/fixtures/stylesheets/compass/css/utilities.css +56 -56
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +45 -45
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +7 -7
- data/test/fixtures/stylesheets/compass/sass/border_radius.scss +5 -5
- data/test/fixtures/stylesheets/compass/sass/box-sizeing.scss +7 -7
- data/test/fixtures/stylesheets/compass/sass/box.sass +49 -49
- data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +5 -5
- data/test/fixtures/stylesheets/compass/sass/columns.scss +28 -28
- data/test/fixtures/stylesheets/compass/sass/filters.scss +24 -24
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +2 -2
- data/test/fixtures/stylesheets/compass/sass/force-wrap.scss +3 -3
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +96 -96
- data/test/fixtures/stylesheets/compass/sass/grid_background.scss +33 -33
- data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +10 -10
- data/test/fixtures/stylesheets/compass/sass/image_size.sass +15 -15
- data/test/fixtures/stylesheets/compass/sass/images.scss +8 -8
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -3
- data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +14 -14
- data/test/fixtures/stylesheets/compass/sass/lists.scss +11 -11
- data/test/fixtures/stylesheets/compass/sass/opacity.scss +5 -5
- data/test/fixtures/stylesheets/compass/sass/pie.scss +47 -47
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -5
- data/test/fixtures/stylesheets/compass/sass/regions.scss +3 -3
- data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -22
- data/test/fixtures/stylesheets/compass/sass/reset.sass +12 -12
- data/test/fixtures/stylesheets/compass/sass/sprites.scss +13 -13
- data/test/fixtures/stylesheets/compass/sass/stretching.sass +33 -33
- data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +11 -11
- data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -87
- data/test/fixtures/stylesheets/compass/sass/transition.scss +24 -24
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +4 -4
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +20 -20
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +15 -15
- data/test/fixtures/stylesheets/envtest/config.rb +9 -9
- data/test/fixtures/stylesheets/envtest/css/env.css +2 -2
- data/test/fixtures/stylesheets/envtest/sass/env.scss +3 -3
- data/test/fixtures/stylesheets/error/config.rb +10 -10
- data/test/fixtures/stylesheets/error/sass/screen.sass +2 -2
- data/test/fixtures/stylesheets/image_urls/config.rb +19 -19
- data/test/fixtures/stylesheets/image_urls/css/screen.css +5 -5
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +8 -8
- data/test/fixtures/stylesheets/relative/config.rb +10 -10
- data/test/fixtures/stylesheets/relative/css/ie.css +1 -1
- data/test/fixtures/stylesheets/relative/css/print.css +1 -1
- data/test/fixtures/stylesheets/relative/css/screen.css +1 -1
- data/test/fixtures/stylesheets/relative/sass/ie.sass +5 -5
- data/test/fixtures/stylesheets/relative/sass/print.sass +3 -3
- data/test/fixtures/stylesheets/relative/sass/screen.sass +2 -2
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +25 -25
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +5 -5
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +3 -3
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +6 -6
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +5 -5
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +3 -3
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +68 -68
- data/test/fixtures/stylesheets/valid/config.rb +9 -9
- data/test/fixtures/stylesheets/valid/sass/simple.sass +1 -1
- data/test/helpers/command_line.rb +114 -114
- data/test/helpers/diff.rb +48 -48
- data/test/helpers/io.rb +36 -36
- data/test/helpers/rails.rb +55 -55
- data/test/helpers/test_case.rb +62 -62
- data/test/integrations/compass_test.rb +224 -224
- data/test/integrations/sprites_test.rb +843 -843
- data/test/test_helper.rb +73 -73
- data/test/units/actions_test.rb +23 -23
- data/test/units/command_line_test.rb +60 -60
- data/test/units/compass_module_test.rb +36 -36
- data/test/units/compass_png_test.rb +45 -45
- data/test/units/compiler_test.rb +10 -10
- data/test/units/configuration_test.rb +440 -440
- data/test/units/regressions_test.rb +35 -35
- data/test/units/sass_extensions_test.rb +198 -198
- data/test/units/sprites/engine_test.rb +47 -47
- data/test/units/sprites/image_row_test.rb +57 -57
- data/test/units/sprites/image_test.rb +99 -99
- data/test/units/sprites/importer_test.rb +90 -90
- data/test/units/sprites/layout_test.rb +154 -154
- data/test/units/sprites/row_fitter_test.rb +65 -65
- data/test/units/sprites/sprite_command_test.rb +54 -54
- data/test/units/sprites/sprite_map_test.rb +130 -130
- metadata +1304 -1310
@@ -1,843 +1,843 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'compass'
|
4
|
-
require 'compass/logger'
|
5
|
-
require 'sass/plugin'
|
6
|
-
|
7
|
-
|
8
|
-
class SpritesTest < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def setup
|
11
|
-
Compass.reset_configuration!
|
12
|
-
@images_src_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'images')
|
13
|
-
@images_tmp_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'images-tmp')
|
14
|
-
@generated_images_tmp_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'generated-images-tmp')
|
15
|
-
::FileUtils.cp_r @images_src_path, @images_tmp_path
|
16
|
-
file = StringIO.new("images_path = #{@images_tmp_path.inspect}\n")
|
17
|
-
Compass.add_configuration(file, "sprite_config")
|
18
|
-
Compass.configure_sass_plugin!
|
19
|
-
end
|
20
|
-
|
21
|
-
def teardown
|
22
|
-
Compass.reset_configuration!
|
23
|
-
::FileUtils.rm_r @images_tmp_path
|
24
|
-
::FileUtils.rm_rf @generated_images_tmp_path
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def map_location(file)
|
29
|
-
map_files(file).first
|
30
|
-
end
|
31
|
-
|
32
|
-
def map_files(glob)
|
33
|
-
Dir.glob(File.join(@images_tmp_path, glob))
|
34
|
-
end
|
35
|
-
|
36
|
-
def image_size(file)
|
37
|
-
open(map_location(file), "rb").read[0x10..0x18].unpack('NN')
|
38
|
-
end
|
39
|
-
|
40
|
-
def image_md5(file)
|
41
|
-
md5 = Digest::MD5.new
|
42
|
-
md5.update IO.read(map_location(file))
|
43
|
-
md5.hexdigest
|
44
|
-
end
|
45
|
-
|
46
|
-
def render(scss)
|
47
|
-
scss = %Q(@import "compass"; #{scss})
|
48
|
-
options = Compass.sass_engine_options
|
49
|
-
options[:line_comments] = false
|
50
|
-
options[:style] = :expanded
|
51
|
-
options[:syntax] = :scss
|
52
|
-
options[:compass] ||= {}
|
53
|
-
options[:compass][:logger] ||= Compass::NullLogger.new
|
54
|
-
css = Sass::Engine.new(scss, options).render
|
55
|
-
# reformat to fit result of heredoc:
|
56
|
-
" #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n"
|
57
|
-
end
|
58
|
-
|
59
|
-
def clean(string)
|
60
|
-
string.gsub("\n", '').gsub(' ', '')
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should generate sprite classes" do
|
64
|
-
css = render <<-SCSS
|
65
|
-
@import "squares/*.png";
|
66
|
-
@include all-squares-sprites;
|
67
|
-
SCSS
|
68
|
-
assert_correct css, <<-CSS
|
69
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
70
|
-
background: url('/squares-sbbc18e2129.png') no-repeat;
|
71
|
-
}
|
72
|
-
|
73
|
-
.squares-ten-by-ten {
|
74
|
-
background-position: 0 0;
|
75
|
-
}
|
76
|
-
|
77
|
-
.squares-twenty-by-twenty {
|
78
|
-
background-position: 0 -10px;
|
79
|
-
}
|
80
|
-
CSS
|
81
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
82
|
-
assert_equal image_md5('squares-s*.png'), '7349a0f4e88ea80abddcf6ac2486abe3'
|
83
|
-
end
|
84
|
-
|
85
|
-
it "should output and serve sprite files using the generated images directory" do
|
86
|
-
Compass.reset_configuration!
|
87
|
-
file = StringIO.new(<<-CONFIG)
|
88
|
-
images_path = #{@images_tmp_path.inspect}
|
89
|
-
generated_images_path = #{@generated_images_tmp_path.inspect}
|
90
|
-
http_generated_images_path = "/images/generated"
|
91
|
-
CONFIG
|
92
|
-
Compass.add_configuration(file, "sprite_config")
|
93
|
-
Compass.configure_sass_plugin!
|
94
|
-
css = render <<-SCSS
|
95
|
-
@import "squares/*.png";
|
96
|
-
@include all-squares-sprites;
|
97
|
-
SCSS
|
98
|
-
assert_not_nil Dir.glob("#{@generated_images_tmp_path}/squares-s*.png").first
|
99
|
-
assert_correct <<-CSS, css
|
100
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
101
|
-
background: url('/images/generated/squares-sbbc18e2129.png') no-repeat;
|
102
|
-
}
|
103
|
-
|
104
|
-
.squares-ten-by-ten {
|
105
|
-
background-position: 0 0;
|
106
|
-
}
|
107
|
-
|
108
|
-
.squares-twenty-by-twenty {
|
109
|
-
background-position: 0 -10px;
|
110
|
-
}
|
111
|
-
CSS
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should generate sprite classes with dimensions" do
|
115
|
-
css = render <<-SCSS
|
116
|
-
$squares-sprite-dimensions: true;
|
117
|
-
@import "squares/*.png";
|
118
|
-
@include all-squares-sprites;
|
119
|
-
SCSS
|
120
|
-
assert_correct css, <<-CSS
|
121
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
122
|
-
background: url('/squares-sbbc18e2129.png') no-repeat;
|
123
|
-
}
|
124
|
-
|
125
|
-
.squares-ten-by-ten {
|
126
|
-
background-position: 0 0;
|
127
|
-
height: 10px;
|
128
|
-
width: 10px;
|
129
|
-
}
|
130
|
-
|
131
|
-
.squares-twenty-by-twenty {
|
132
|
-
background-position: 0 -10px;
|
133
|
-
height: 20px;
|
134
|
-
width: 20px;
|
135
|
-
}
|
136
|
-
CSS
|
137
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
138
|
-
end
|
139
|
-
|
140
|
-
it "should provide sprite mixin" do
|
141
|
-
css = render <<-SCSS
|
142
|
-
@import "squares/*.png";
|
143
|
-
|
144
|
-
.cubicle {
|
145
|
-
@include squares-sprite("ten-by-ten");
|
146
|
-
}
|
147
|
-
|
148
|
-
.large-cube {
|
149
|
-
@include squares-sprite("twenty-by-twenty", true);
|
150
|
-
}
|
151
|
-
SCSS
|
152
|
-
assert_correct css, <<-CSS
|
153
|
-
.squares-sprite, .cubicle, .large-cube {
|
154
|
-
background: url('/squares-sbbc18e2129.png') no-repeat;
|
155
|
-
}
|
156
|
-
|
157
|
-
.cubicle {
|
158
|
-
background-position: 0 0;
|
159
|
-
}
|
160
|
-
|
161
|
-
.large-cube {
|
162
|
-
background-position: 0 -10px;
|
163
|
-
height: 20px;
|
164
|
-
width: 20px;
|
165
|
-
}
|
166
|
-
CSS
|
167
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
168
|
-
end
|
169
|
-
|
170
|
-
# CUSTOMIZATIONS:
|
171
|
-
|
172
|
-
it "should be possible to change the base class" do
|
173
|
-
css = render <<-SCSS
|
174
|
-
$squares-sprite-base-class: ".circles";
|
175
|
-
@import "squares/*.png";
|
176
|
-
SCSS
|
177
|
-
assert_correct css, <<-CSS
|
178
|
-
.circles {
|
179
|
-
background: url('/squares-sbbc18e2129.png') no-repeat;
|
180
|
-
}
|
181
|
-
CSS
|
182
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
183
|
-
end
|
184
|
-
|
185
|
-
it "should calculate the spacing between images but not before first image" do
|
186
|
-
css = render <<-SCSS
|
187
|
-
$squares-ten-by-ten-spacing: 33px;
|
188
|
-
@import "squares/*.png";
|
189
|
-
@include all-squares-sprites;
|
190
|
-
SCSS
|
191
|
-
assert_correct css, <<-CSS
|
192
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
193
|
-
background: url('/squares-s563a5e0855.png') no-repeat;
|
194
|
-
}
|
195
|
-
|
196
|
-
.squares-ten-by-ten {
|
197
|
-
background-position: 0 0;
|
198
|
-
}
|
199
|
-
|
200
|
-
.squares-twenty-by-twenty {
|
201
|
-
background-position: 0 -43px;
|
202
|
-
}
|
203
|
-
CSS
|
204
|
-
assert_equal image_size('squares-s*.png'), [20, 63]
|
205
|
-
end
|
206
|
-
|
207
|
-
it "should calculate the spacing between images" do
|
208
|
-
css = render <<-SCSS
|
209
|
-
$squares-twenty-by-twenty-spacing: 33px;
|
210
|
-
@import "squares/*.png";
|
211
|
-
@include all-squares-sprites;
|
212
|
-
SCSS
|
213
|
-
assert_correct css, <<-CSS
|
214
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
215
|
-
background: url('/squares-s4ea353fa6d.png') no-repeat;
|
216
|
-
}
|
217
|
-
|
218
|
-
.squares-ten-by-ten {
|
219
|
-
background-position: 0 0;
|
220
|
-
}
|
221
|
-
|
222
|
-
.squares-twenty-by-twenty {
|
223
|
-
background-position: 0 -43px;
|
224
|
-
}
|
225
|
-
CSS
|
226
|
-
assert_equal image_size('squares-s*.png'), [20, 63]
|
227
|
-
end
|
228
|
-
|
229
|
-
it "should calculate the maximum spacing between images" do
|
230
|
-
css = render <<-SCSS
|
231
|
-
$squares-ten-by-ten-spacing: 44px;
|
232
|
-
$squares-twenty-by-twenty-spacing: 33px;
|
233
|
-
@import "squares/*.png";
|
234
|
-
@include all-squares-sprites;
|
235
|
-
SCSS
|
236
|
-
assert_correct css, <<-CSS
|
237
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
238
|
-
background: url('/squares-sf4771cb124.png') no-repeat;
|
239
|
-
}
|
240
|
-
|
241
|
-
.squares-ten-by-ten {
|
242
|
-
background-position: 0 0;
|
243
|
-
}
|
244
|
-
|
245
|
-
.squares-twenty-by-twenty {
|
246
|
-
background-position: 0 -54px;
|
247
|
-
}
|
248
|
-
CSS
|
249
|
-
assert_equal image_size('squares-s*.png'), [20, 74]
|
250
|
-
end
|
251
|
-
|
252
|
-
it "should calculate the maximum spacing between images in reversed order" do
|
253
|
-
css = render <<-SCSS
|
254
|
-
$squares-ten-by-ten-spacing: 33px;
|
255
|
-
$squares-twenty-by-twenty-spacing: 44px;
|
256
|
-
@import "squares/*.png";
|
257
|
-
@include all-squares-sprites;
|
258
|
-
SCSS
|
259
|
-
assert_correct css, <<-CSS
|
260
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
261
|
-
background: url('/squares-sc82d6f3cf4.png') no-repeat;
|
262
|
-
}
|
263
|
-
|
264
|
-
.squares-ten-by-ten {
|
265
|
-
background-position: 0 0;
|
266
|
-
}
|
267
|
-
|
268
|
-
.squares-twenty-by-twenty {
|
269
|
-
background-position: 0 -54px;
|
270
|
-
}
|
271
|
-
CSS
|
272
|
-
assert_equal image_size('squares-s*.png'), [20, 74]
|
273
|
-
end
|
274
|
-
|
275
|
-
it "should calculate the default spacing between images" do
|
276
|
-
css = render <<-SCSS
|
277
|
-
$squares-spacing: 22px;
|
278
|
-
@import "squares/*.png";
|
279
|
-
@include all-squares-sprites;
|
280
|
-
SCSS
|
281
|
-
assert_correct css, <<-CSS
|
282
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
283
|
-
background: url('/squares-s2f4aa65dcf.png') no-repeat;
|
284
|
-
}
|
285
|
-
|
286
|
-
.squares-ten-by-ten {
|
287
|
-
background-position: 0 0;
|
288
|
-
}
|
289
|
-
|
290
|
-
.squares-twenty-by-twenty {
|
291
|
-
background-position: 0 -32px;
|
292
|
-
}
|
293
|
-
CSS
|
294
|
-
assert_equal image_size('squares-s*.png'), [20, 52]
|
295
|
-
end
|
296
|
-
|
297
|
-
it "should use position adjustments in functions" do
|
298
|
-
css = render <<-SCSS
|
299
|
-
$squares: sprite-map("squares/*.png", $position: 100%);
|
300
|
-
.squares-sprite {
|
301
|
-
background: $squares no-repeat;
|
302
|
-
}
|
303
|
-
|
304
|
-
.adjusted-percentage {
|
305
|
-
background-position: sprite-position($squares, ten-by-ten, 100%);
|
306
|
-
}
|
307
|
-
|
308
|
-
.adjusted-px-1 {
|
309
|
-
background-position: sprite-position($squares, ten-by-ten, 4px);
|
310
|
-
}
|
311
|
-
|
312
|
-
.adjusted-px-2 {
|
313
|
-
background-position: sprite-position($squares, twenty-by-twenty, -3px, 2px);
|
314
|
-
}
|
315
|
-
SCSS
|
316
|
-
assert_correct css, <<-CSS
|
317
|
-
.squares-sprite {
|
318
|
-
background: url('/squares-sce5dc30797.png') no-repeat;
|
319
|
-
}
|
320
|
-
|
321
|
-
.adjusted-percentage {
|
322
|
-
background-position: 100% 0;
|
323
|
-
}
|
324
|
-
|
325
|
-
.adjusted-px-1 {
|
326
|
-
background-position: -6px 0;
|
327
|
-
}
|
328
|
-
|
329
|
-
.adjusted-px-2 {
|
330
|
-
background-position: -3px -8px;
|
331
|
-
}
|
332
|
-
CSS
|
333
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
334
|
-
assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
|
335
|
-
end
|
336
|
-
|
337
|
-
it "should use position adjustments in mixins" do
|
338
|
-
css = render <<-SCSS
|
339
|
-
$squares-position: 100%;
|
340
|
-
@import "squares/*.png";
|
341
|
-
|
342
|
-
.adjusted-percentage {
|
343
|
-
@include squares-sprite("ten-by-ten", $offset-x: 100%);
|
344
|
-
}
|
345
|
-
|
346
|
-
.adjusted-px-1 {
|
347
|
-
@include squares-sprite("ten-by-ten", $offset-x: 4px);
|
348
|
-
}
|
349
|
-
|
350
|
-
.adjusted-px-2 {
|
351
|
-
@include squares-sprite("twenty-by-twenty", $offset-x: -3px, $offset-y: 2px);
|
352
|
-
}
|
353
|
-
SCSS
|
354
|
-
assert_correct css, <<-CSS
|
355
|
-
.squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
|
356
|
-
background: url('/squares-sce5dc30797.png') no-repeat;
|
357
|
-
}
|
358
|
-
|
359
|
-
.adjusted-percentage {
|
360
|
-
background-position: 100% 0;
|
361
|
-
}
|
362
|
-
|
363
|
-
.adjusted-px-1 {
|
364
|
-
background-position: -6px 0;
|
365
|
-
}
|
366
|
-
|
367
|
-
.adjusted-px-2 {
|
368
|
-
background-position: -3px -8px;
|
369
|
-
}
|
370
|
-
CSS
|
371
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
372
|
-
assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
|
373
|
-
end
|
374
|
-
|
375
|
-
it "should repeat the image" do
|
376
|
-
css = render <<-SCSS
|
377
|
-
$squares-repeat: repeat-x;
|
378
|
-
@import "squares/*.png";
|
379
|
-
@include all-squares-sprites;
|
380
|
-
SCSS
|
381
|
-
assert_correct css, <<-CSS
|
382
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
383
|
-
background: url('/squares-s65c43cd573.png') no-repeat;
|
384
|
-
}
|
385
|
-
|
386
|
-
.squares-ten-by-ten {
|
387
|
-
background-position: 0 0;
|
388
|
-
}
|
389
|
-
|
390
|
-
.squares-twenty-by-twenty {
|
391
|
-
background-position: 0 -10px;
|
392
|
-
}
|
393
|
-
CSS
|
394
|
-
assert_equal image_size('squares-s*.png'), [20, 30]
|
395
|
-
assert_equal image_md5('squares-s*.png'), 'a77a2fd43f04d791722b706aa7c9f1c1'
|
396
|
-
end
|
397
|
-
|
398
|
-
it "should allow the position of a sprite to be specified in absolute pixels" do
|
399
|
-
css = render <<-SCSS
|
400
|
-
$squares-ten-by-ten-position: 10px;
|
401
|
-
$squares-twenty-by-twenty-position: 10px;
|
402
|
-
@import "squares/*.png";
|
403
|
-
@include all-squares-sprites;
|
404
|
-
SCSS
|
405
|
-
assert_correct css, <<-CSS
|
406
|
-
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
407
|
-
background: url('/squares-sb9d9a8ca6a.png') no-repeat;
|
408
|
-
}
|
409
|
-
|
410
|
-
.squares-ten-by-ten {
|
411
|
-
background-position: -10px 0;
|
412
|
-
}
|
413
|
-
|
414
|
-
.squares-twenty-by-twenty {
|
415
|
-
background-position: -10px -10px;
|
416
|
-
}
|
417
|
-
CSS
|
418
|
-
assert_equal image_size('squares-s*.png'), [30, 30]
|
419
|
-
assert_equal image_md5('squares-s*.png'), '9856ced9e8211b6b28ff782019a0d905'
|
420
|
-
end
|
421
|
-
|
422
|
-
it "should provide a nice errors for lemonade's old users" do
|
423
|
-
assert_raise(Sass::SyntaxError) do
|
424
|
-
render <<-SCSS
|
425
|
-
.squares {
|
426
|
-
background: sprite-url("squares/*.png") no-repeat;
|
427
|
-
}
|
428
|
-
SCSS
|
429
|
-
end
|
430
|
-
assert_raise(Sass::SyntaxError) do
|
431
|
-
css = render <<-SCSS
|
432
|
-
.squares {
|
433
|
-
background: sprite-image("squares/twenty-by-twenty.png") no-repeat;
|
434
|
-
}
|
435
|
-
SCSS
|
436
|
-
end
|
437
|
-
assert_raise(Sass::SyntaxError) do
|
438
|
-
css = render <<-SCSS
|
439
|
-
@import "squares/*.png";
|
440
|
-
|
441
|
-
.squares {
|
442
|
-
background: sprite-position("squares/twenty-by-twenty.png") no-repeat;
|
443
|
-
}
|
444
|
-
SCSS
|
445
|
-
end
|
446
|
-
end
|
447
|
-
|
448
|
-
it "should work even if @import is missing" do
|
449
|
-
css = render <<-SCSS
|
450
|
-
.squares {
|
451
|
-
background: sprite(sprite-map("squares/*.png"), twenty-by-twenty) no-repeat;
|
452
|
-
}
|
453
|
-
SCSS
|
454
|
-
assert_correct css, <<-CSS
|
455
|
-
.squares {
|
456
|
-
background: url('/squares-sd817b59156.png') 0 -10px no-repeat;
|
457
|
-
}
|
458
|
-
CSS
|
459
|
-
end
|
460
|
-
|
461
|
-
it "should calculate corret sprite demsions when givin spacing via issue#253" do
|
462
|
-
css = render <<-SCSS
|
463
|
-
$squares-spacing: 10px;
|
464
|
-
@import "squares/*.png";
|
465
|
-
.foo {
|
466
|
-
@include sprite-background-position($squares-sprites, "twenty-by-twenty");
|
467
|
-
}
|
468
|
-
.bar {
|
469
|
-
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
470
|
-
}
|
471
|
-
SCSS
|
472
|
-
assert_equal image_size('squares-s*.png'), [20, 40]
|
473
|
-
assert_correct css, <<-CSS
|
474
|
-
.squares-sprite {
|
475
|
-
background: url('/squares-s555875d730.png') no-repeat;
|
476
|
-
}
|
477
|
-
|
478
|
-
.foo {
|
479
|
-
background-position: 0 -20px;
|
480
|
-
}
|
481
|
-
|
482
|
-
.bar {
|
483
|
-
background-position: 0 0;
|
484
|
-
}
|
485
|
-
CSS
|
486
|
-
end
|
487
|
-
|
488
|
-
it "should render correct sprite with css selectors via issue#248" do
|
489
|
-
css = render <<-SCSS
|
490
|
-
@import "selectors/*.png";
|
491
|
-
@include all-selectors-sprites;
|
492
|
-
SCSS
|
493
|
-
assert_correct css, <<-CSS
|
494
|
-
.selectors-sprite, .selectors-ten-by-ten {
|
495
|
-
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
496
|
-
}
|
497
|
-
|
498
|
-
.selectors-ten-by-ten {
|
499
|
-
background-position: 0 0;
|
500
|
-
}
|
501
|
-
.selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover {
|
502
|
-
background-position: 0 -20px;
|
503
|
-
}
|
504
|
-
.selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target {
|
505
|
-
background-position: 0 -30px;
|
506
|
-
}
|
507
|
-
.selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active {
|
508
|
-
background-position: 0 -10px;
|
509
|
-
}
|
510
|
-
CSS
|
511
|
-
end
|
512
|
-
|
513
|
-
it "should honor offsets when rendering selectors via issue#449" do
|
514
|
-
css = render <<-SCSS
|
515
|
-
@import "selectors/*.png";
|
516
|
-
@include all-selectors-sprites($offset-x: 20px, $offset-y: 20px);
|
517
|
-
SCSS
|
518
|
-
assert_correct css, <<-CSS
|
519
|
-
.selectors-sprite, .selectors-ten-by-ten {
|
520
|
-
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
521
|
-
}
|
522
|
-
|
523
|
-
.selectors-ten-by-ten {
|
524
|
-
background-position: 20px 20px;
|
525
|
-
}
|
526
|
-
.selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover {
|
527
|
-
background-position: 20px 0;
|
528
|
-
}
|
529
|
-
.selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target {
|
530
|
-
background-position: 20px -10px;
|
531
|
-
}
|
532
|
-
.selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active {
|
533
|
-
background-position: 20px 10px;
|
534
|
-
}
|
535
|
-
CSS
|
536
|
-
end
|
537
|
-
|
538
|
-
it "should render correct sprite with css selectors via magic mixin" do
|
539
|
-
css = render <<-SCSS
|
540
|
-
@import "selectors/*.png";
|
541
|
-
a {
|
542
|
-
@include selectors-sprite(ten-by-ten)
|
543
|
-
}
|
544
|
-
SCSS
|
545
|
-
assert_correct css, <<-CSS
|
546
|
-
.selectors-sprite, a {
|
547
|
-
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
548
|
-
}
|
549
|
-
|
550
|
-
a {
|
551
|
-
background-position: 0 0;
|
552
|
-
}
|
553
|
-
a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover {
|
554
|
-
background-position: 0 -20px;
|
555
|
-
}
|
556
|
-
a:target, a.ten-by-ten_target, a.ten-by-ten-target {
|
557
|
-
background-position: 0 -30px;
|
558
|
-
}
|
559
|
-
a:active, a.ten-by-ten_active, a.ten-by-ten-active {
|
560
|
-
background-position: 0 -10px;
|
561
|
-
}
|
562
|
-
CSS
|
563
|
-
end
|
564
|
-
|
565
|
-
|
566
|
-
it "should not render corret sprite with css selectors via magic mixin" do
|
567
|
-
css = render <<-SCSS
|
568
|
-
@import "selectors/*.png";
|
569
|
-
a {
|
570
|
-
$disable-magic-sprite-selectors:true;
|
571
|
-
@include selectors-sprite(ten-by-ten)
|
572
|
-
}
|
573
|
-
SCSS
|
574
|
-
assert_correct css, <<-CSS
|
575
|
-
.selectors-sprite, a {
|
576
|
-
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
577
|
-
}
|
578
|
-
|
579
|
-
a {
|
580
|
-
background-position: 0 0;
|
581
|
-
}
|
582
|
-
CSS
|
583
|
-
end
|
584
|
-
|
585
|
-
it "should render corret sprite with css selectors via magic mixin with the correct offsets" do
|
586
|
-
css = render <<-SCSS
|
587
|
-
@import "selectors/*.png";
|
588
|
-
a {
|
589
|
-
@include selectors-sprite(ten-by-ten, false, 5, -5)
|
590
|
-
}
|
591
|
-
SCSS
|
592
|
-
assert_correct css, <<-CSS
|
593
|
-
.selectors-sprite, a {
|
594
|
-
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
595
|
-
}
|
596
|
-
|
597
|
-
a {
|
598
|
-
background-position: 5px -5px;
|
599
|
-
}
|
600
|
-
a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover {
|
601
|
-
background-position: 5px -25px;
|
602
|
-
}
|
603
|
-
a:target, a.ten-by-ten_target, a.ten-by-ten-target {
|
604
|
-
background-position: 5px -35px;
|
605
|
-
}
|
606
|
-
a:active, a.ten-by-ten_active, a.ten-by-ten-active {
|
607
|
-
background-position: 5px -15px;
|
608
|
-
}
|
609
|
-
CSS
|
610
|
-
end
|
611
|
-
|
612
|
-
it "should raise error on filenames that are not valid sass syntax" do
|
613
|
-
assert_raise(Compass::Error) do
|
614
|
-
css = render <<-SCSS
|
615
|
-
@import "prefix/*.png";
|
616
|
-
a {
|
617
|
-
@include squares-sprite(20-by-20);
|
618
|
-
}
|
619
|
-
SCSS
|
620
|
-
end
|
621
|
-
end
|
622
|
-
|
623
|
-
it "should generate sprite with bad repeat-x dimensions" do
|
624
|
-
css = render <<-SCSS
|
625
|
-
$ko-starbg26x27-repeat: repeat-x;
|
626
|
-
@import "ko/*.png";
|
627
|
-
@include all-ko-sprites;
|
628
|
-
SCSS
|
629
|
-
assert_correct css, <<-CSS
|
630
|
-
.ko-sprite, .ko-default_background, .ko-starbg26x27 {
|
631
|
-
background: url('/ko-sd46dfbab4f.png') no-repeat;
|
632
|
-
}
|
633
|
-
|
634
|
-
.ko-default_background {
|
635
|
-
background-position: 0 0;
|
636
|
-
}
|
637
|
-
|
638
|
-
.ko-starbg26x27 {
|
639
|
-
background-position: 0 -128px;
|
640
|
-
}
|
641
|
-
CSS
|
642
|
-
end
|
643
|
-
|
644
|
-
it "should generate a sprite and remove the old file" do
|
645
|
-
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png")
|
646
|
-
assert_equal 1, map_files('selectors-s*.png').size
|
647
|
-
css = render <<-SCSS
|
648
|
-
@import "selectors/*.png";
|
649
|
-
a {
|
650
|
-
$disable-magic-sprite-selectors:true;
|
651
|
-
@include selectors-sprite(ten-by-ten)
|
652
|
-
}
|
653
|
-
SCSS
|
654
|
-
assert_equal 1, map_files('selectors-s*.png').size, "File was not removed"
|
655
|
-
end
|
656
|
-
|
657
|
-
it "should generate a sprite and NOT remove the old file" do
|
658
|
-
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png")
|
659
|
-
assert_equal 1, map_files('selectors-s*.png').size
|
660
|
-
css = render <<-SCSS
|
661
|
-
$selectors-clean-up: false;
|
662
|
-
@import "selectors/*.png";
|
663
|
-
a {
|
664
|
-
$disable-magic-sprite-selectors:true;
|
665
|
-
@include selectors-sprite(ten-by-ten)
|
666
|
-
}
|
667
|
-
SCSS
|
668
|
-
assert_equal 2, map_files('selectors-s*.png').size, "File was removed"
|
669
|
-
end
|
670
|
-
|
671
|
-
it "should generate a sprite if the sprite is a bool" do
|
672
|
-
css = render <<-SCSS
|
673
|
-
@import "bool/*.png";
|
674
|
-
a {
|
675
|
-
@include bool-sprite(false);
|
676
|
-
}
|
677
|
-
a {
|
678
|
-
@include bool-sprite(true);
|
679
|
-
}
|
680
|
-
SCSS
|
681
|
-
assert !css.empty?
|
682
|
-
end
|
683
|
-
|
684
|
-
|
685
|
-
it "should generate a sprite if the sprite is a colorname" do
|
686
|
-
css = render <<-SCSS
|
687
|
-
@import "colors/*.png";
|
688
|
-
a {
|
689
|
-
@include colors-sprite(blue);
|
690
|
-
}
|
691
|
-
SCSS
|
692
|
-
assert !css.empty?
|
693
|
-
end
|
694
|
-
|
695
|
-
it "should generate a sprite from nested folders" do
|
696
|
-
css = render <<-SCSS
|
697
|
-
@import "nested/**/*.png";
|
698
|
-
@include all-nested-sprites;
|
699
|
-
SCSS
|
700
|
-
assert_correct css, <<-CSS
|
701
|
-
.nested-sprite, .nested-ten-by-ten {
|
702
|
-
background: url('/nested-s7b93e0b6bf.png') no-repeat;
|
703
|
-
}
|
704
|
-
|
705
|
-
.nested-ten-by-ten {
|
706
|
-
background-position: 0 0;
|
707
|
-
}
|
708
|
-
CSS
|
709
|
-
end
|
710
|
-
|
711
|
-
it "should create horizontal sprite" do
|
712
|
-
css = render <<-SCSS
|
713
|
-
$squares-layout:horizontal;
|
714
|
-
@import "squares/*.png";
|
715
|
-
.foo {
|
716
|
-
@include sprite-background-position($squares-sprites, "twenty-by-twenty");
|
717
|
-
}
|
718
|
-
.bar {
|
719
|
-
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
720
|
-
}
|
721
|
-
SCSS
|
722
|
-
assert_equal [30, 20], image_size('squares-s*.png')
|
723
|
-
other_css = <<-CSS
|
724
|
-
.squares-sprite {
|
725
|
-
background: url('/squares-s4bd95c5c56.png') no-repeat;
|
726
|
-
}
|
727
|
-
|
728
|
-
.foo {
|
729
|
-
background-position: -10px 0;
|
730
|
-
}
|
731
|
-
|
732
|
-
.bar {
|
733
|
-
background-position: 0 0;
|
734
|
-
}
|
735
|
-
CSS
|
736
|
-
assert_correct clean(css), clean(other_css)
|
737
|
-
end
|
738
|
-
|
739
|
-
it "should allow use of demension functions" do
|
740
|
-
css = render <<-SCSS
|
741
|
-
@import "squares/*.png";
|
742
|
-
$h: squares-sprite-height(twenty-by-twenty);
|
743
|
-
$w: squares-sprite-width(twenty-by-twenty);
|
744
|
-
.div {
|
745
|
-
height:$h + 1px;
|
746
|
-
width:$w + 2px;
|
747
|
-
}
|
748
|
-
SCSS
|
749
|
-
other_css = <<-CSS
|
750
|
-
.squares-sprite {
|
751
|
-
background: url('/squares-sbbc18e2129.png') no-repeat;
|
752
|
-
}
|
753
|
-
.div {
|
754
|
-
height:21px;
|
755
|
-
width:22px;
|
756
|
-
}
|
757
|
-
CSS
|
758
|
-
assert_correct clean(css), clean(other_css)
|
759
|
-
end
|
760
|
-
|
761
|
-
it "should replace text with images and dimensions using sprites" do
|
762
|
-
css = render <<-SCSS
|
763
|
-
@import "colors/*.png";
|
764
|
-
.blue {
|
765
|
-
@include sprite-replace-text($colors-sprites, blue);
|
766
|
-
}
|
767
|
-
.yellow {
|
768
|
-
@include sprite-replace-text-with-dimensions($colors-sprites, yellow);
|
769
|
-
}
|
770
|
-
SCSS
|
771
|
-
other_css = <<-CSS
|
772
|
-
.colors-sprite {
|
773
|
-
background:url('/colors-s58671cb5bb.png') no-repeat;
|
774
|
-
}
|
775
|
-
.blue {
|
776
|
-
text-indent:-119988px;
|
777
|
-
overflow:hidden;
|
778
|
-
text-align:left;
|
779
|
-
background-position:0 0;
|
780
|
-
background-image:url('/colors-s58671cb5bb.png');
|
781
|
-
background-repeat:no-repeat;
|
782
|
-
}
|
783
|
-
|
784
|
-
.yellow {
|
785
|
-
text-indent:-119988px;
|
786
|
-
overflow:hidden;
|
787
|
-
text-align:left;
|
788
|
-
background-position:0 -10px;
|
789
|
-
height:10px;
|
790
|
-
width:10px;
|
791
|
-
background-image:url('/colors-s58671cb5bb.png');
|
792
|
-
background-repeat:no-repeat;
|
793
|
-
}
|
794
|
-
CSS
|
795
|
-
assert_correct clean(css), clean(other_css)
|
796
|
-
end
|
797
|
-
|
798
|
-
it "should inline the sprite file" do
|
799
|
-
css = render <<-SCSS
|
800
|
-
$colors-inline:true;
|
801
|
-
@import "colors/*.png";
|
802
|
-
@include all-colors-sprites;
|
803
|
-
SCSS
|
804
|
-
other_css = <<-CSS
|
805
|
-
.colors-sprite, .colors-blue, .colors-yellow {
|
806
|
-
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAAAAACRhfOKAAAAHElEQVR42mM5wQADLP8JMRlIUIvE/IdgctLTNgCHDhEQVD4ceAAAAABJRU5ErkJggg==');
|
807
|
-
}
|
808
|
-
.colors-blue {
|
809
|
-
background-position:0 0;
|
810
|
-
}
|
811
|
-
.colors-yellow {
|
812
|
-
background-position:0 -10px;
|
813
|
-
}
|
814
|
-
CSS
|
815
|
-
assert_correct clean(css), clean(other_css)
|
816
|
-
end
|
817
|
-
|
818
|
-
it "should have a sprite_name function that returns the names of the sprites in a sass list" do
|
819
|
-
css = render <<-SCSS
|
820
|
-
$colors-inline:true;
|
821
|
-
@import "colors/*.png";
|
822
|
-
@each $color in sprite_names($colors-sprites) {
|
823
|
-
.\#{$color} {
|
824
|
-
width:0px;
|
825
|
-
}
|
826
|
-
}
|
827
|
-
SCSS
|
828
|
-
other_css = <<-CSS
|
829
|
-
.colors-sprite {
|
830
|
-
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAAAAACRhfOKAAAAHElEQVR42mM5wQADLP8JMRlIUIvE/IdgctLTNgCHDhEQVD4ceAAAAABJRU5ErkJggg==');
|
831
|
-
}
|
832
|
-
.blue {
|
833
|
-
width:0px;
|
834
|
-
}
|
835
|
-
.yellow {
|
836
|
-
width:0px;
|
837
|
-
}
|
838
|
-
CSS
|
839
|
-
assert_correct clean(css), clean(other_css)
|
840
|
-
|
841
|
-
end
|
842
|
-
|
843
|
-
end
|
1
|
+
require 'test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'compass'
|
4
|
+
require 'compass/logger'
|
5
|
+
require 'sass/plugin'
|
6
|
+
|
7
|
+
|
8
|
+
class SpritesTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
Compass.reset_configuration!
|
12
|
+
@images_src_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'images')
|
13
|
+
@images_tmp_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'images-tmp')
|
14
|
+
@generated_images_tmp_path = File.join(File.dirname(__FILE__), '..', 'fixtures', 'sprites', 'public', 'generated-images-tmp')
|
15
|
+
::FileUtils.cp_r @images_src_path, @images_tmp_path
|
16
|
+
file = StringIO.new("images_path = #{@images_tmp_path.inspect}\n")
|
17
|
+
Compass.add_configuration(file, "sprite_config")
|
18
|
+
Compass.configure_sass_plugin!
|
19
|
+
end
|
20
|
+
|
21
|
+
def teardown
|
22
|
+
Compass.reset_configuration!
|
23
|
+
::FileUtils.rm_r @images_tmp_path
|
24
|
+
::FileUtils.rm_rf @generated_images_tmp_path
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def map_location(file)
|
29
|
+
map_files(file).first
|
30
|
+
end
|
31
|
+
|
32
|
+
def map_files(glob)
|
33
|
+
Dir.glob(File.join(@images_tmp_path, glob))
|
34
|
+
end
|
35
|
+
|
36
|
+
def image_size(file)
|
37
|
+
open(map_location(file), "rb").read[0x10..0x18].unpack('NN')
|
38
|
+
end
|
39
|
+
|
40
|
+
def image_md5(file)
|
41
|
+
md5 = Digest::MD5.new
|
42
|
+
md5.update IO.read(map_location(file))
|
43
|
+
md5.hexdigest
|
44
|
+
end
|
45
|
+
|
46
|
+
def render(scss)
|
47
|
+
scss = %Q(@import "compass"; #{scss})
|
48
|
+
options = Compass.sass_engine_options
|
49
|
+
options[:line_comments] = false
|
50
|
+
options[:style] = :expanded
|
51
|
+
options[:syntax] = :scss
|
52
|
+
options[:compass] ||= {}
|
53
|
+
options[:compass][:logger] ||= Compass::NullLogger.new
|
54
|
+
css = Sass::Engine.new(scss, options).render
|
55
|
+
# reformat to fit result of heredoc:
|
56
|
+
" #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n"
|
57
|
+
end
|
58
|
+
|
59
|
+
def clean(string)
|
60
|
+
string.gsub("\n", '').gsub(' ', '')
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should generate sprite classes" do
|
64
|
+
css = render <<-SCSS
|
65
|
+
@import "squares/*.png";
|
66
|
+
@include all-squares-sprites;
|
67
|
+
SCSS
|
68
|
+
assert_correct css, <<-CSS
|
69
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
70
|
+
background: url('/squares-sbbc18e2129.png') no-repeat;
|
71
|
+
}
|
72
|
+
|
73
|
+
.squares-ten-by-ten {
|
74
|
+
background-position: 0 0;
|
75
|
+
}
|
76
|
+
|
77
|
+
.squares-twenty-by-twenty {
|
78
|
+
background-position: 0 -10px;
|
79
|
+
}
|
80
|
+
CSS
|
81
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
82
|
+
assert_equal image_md5('squares-s*.png'), '7349a0f4e88ea80abddcf6ac2486abe3'
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should output and serve sprite files using the generated images directory" do
|
86
|
+
Compass.reset_configuration!
|
87
|
+
file = StringIO.new(<<-CONFIG)
|
88
|
+
images_path = #{@images_tmp_path.inspect}
|
89
|
+
generated_images_path = #{@generated_images_tmp_path.inspect}
|
90
|
+
http_generated_images_path = "/images/generated"
|
91
|
+
CONFIG
|
92
|
+
Compass.add_configuration(file, "sprite_config")
|
93
|
+
Compass.configure_sass_plugin!
|
94
|
+
css = render <<-SCSS
|
95
|
+
@import "squares/*.png";
|
96
|
+
@include all-squares-sprites;
|
97
|
+
SCSS
|
98
|
+
assert_not_nil Dir.glob("#{@generated_images_tmp_path}/squares-s*.png").first
|
99
|
+
assert_correct <<-CSS, css
|
100
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
101
|
+
background: url('/images/generated/squares-sbbc18e2129.png') no-repeat;
|
102
|
+
}
|
103
|
+
|
104
|
+
.squares-ten-by-ten {
|
105
|
+
background-position: 0 0;
|
106
|
+
}
|
107
|
+
|
108
|
+
.squares-twenty-by-twenty {
|
109
|
+
background-position: 0 -10px;
|
110
|
+
}
|
111
|
+
CSS
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should generate sprite classes with dimensions" do
|
115
|
+
css = render <<-SCSS
|
116
|
+
$squares-sprite-dimensions: true;
|
117
|
+
@import "squares/*.png";
|
118
|
+
@include all-squares-sprites;
|
119
|
+
SCSS
|
120
|
+
assert_correct css, <<-CSS
|
121
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
122
|
+
background: url('/squares-sbbc18e2129.png') no-repeat;
|
123
|
+
}
|
124
|
+
|
125
|
+
.squares-ten-by-ten {
|
126
|
+
background-position: 0 0;
|
127
|
+
height: 10px;
|
128
|
+
width: 10px;
|
129
|
+
}
|
130
|
+
|
131
|
+
.squares-twenty-by-twenty {
|
132
|
+
background-position: 0 -10px;
|
133
|
+
height: 20px;
|
134
|
+
width: 20px;
|
135
|
+
}
|
136
|
+
CSS
|
137
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
138
|
+
end
|
139
|
+
|
140
|
+
it "should provide sprite mixin" do
|
141
|
+
css = render <<-SCSS
|
142
|
+
@import "squares/*.png";
|
143
|
+
|
144
|
+
.cubicle {
|
145
|
+
@include squares-sprite("ten-by-ten");
|
146
|
+
}
|
147
|
+
|
148
|
+
.large-cube {
|
149
|
+
@include squares-sprite("twenty-by-twenty", true);
|
150
|
+
}
|
151
|
+
SCSS
|
152
|
+
assert_correct css, <<-CSS
|
153
|
+
.squares-sprite, .cubicle, .large-cube {
|
154
|
+
background: url('/squares-sbbc18e2129.png') no-repeat;
|
155
|
+
}
|
156
|
+
|
157
|
+
.cubicle {
|
158
|
+
background-position: 0 0;
|
159
|
+
}
|
160
|
+
|
161
|
+
.large-cube {
|
162
|
+
background-position: 0 -10px;
|
163
|
+
height: 20px;
|
164
|
+
width: 20px;
|
165
|
+
}
|
166
|
+
CSS
|
167
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
168
|
+
end
|
169
|
+
|
170
|
+
# CUSTOMIZATIONS:
|
171
|
+
|
172
|
+
it "should be possible to change the base class" do
|
173
|
+
css = render <<-SCSS
|
174
|
+
$squares-sprite-base-class: ".circles";
|
175
|
+
@import "squares/*.png";
|
176
|
+
SCSS
|
177
|
+
assert_correct css, <<-CSS
|
178
|
+
.circles {
|
179
|
+
background: url('/squares-sbbc18e2129.png') no-repeat;
|
180
|
+
}
|
181
|
+
CSS
|
182
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should calculate the spacing between images but not before first image" do
|
186
|
+
css = render <<-SCSS
|
187
|
+
$squares-ten-by-ten-spacing: 33px;
|
188
|
+
@import "squares/*.png";
|
189
|
+
@include all-squares-sprites;
|
190
|
+
SCSS
|
191
|
+
assert_correct css, <<-CSS
|
192
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
193
|
+
background: url('/squares-s563a5e0855.png') no-repeat;
|
194
|
+
}
|
195
|
+
|
196
|
+
.squares-ten-by-ten {
|
197
|
+
background-position: 0 0;
|
198
|
+
}
|
199
|
+
|
200
|
+
.squares-twenty-by-twenty {
|
201
|
+
background-position: 0 -43px;
|
202
|
+
}
|
203
|
+
CSS
|
204
|
+
assert_equal image_size('squares-s*.png'), [20, 63]
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should calculate the spacing between images" do
|
208
|
+
css = render <<-SCSS
|
209
|
+
$squares-twenty-by-twenty-spacing: 33px;
|
210
|
+
@import "squares/*.png";
|
211
|
+
@include all-squares-sprites;
|
212
|
+
SCSS
|
213
|
+
assert_correct css, <<-CSS
|
214
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
215
|
+
background: url('/squares-s4ea353fa6d.png') no-repeat;
|
216
|
+
}
|
217
|
+
|
218
|
+
.squares-ten-by-ten {
|
219
|
+
background-position: 0 0;
|
220
|
+
}
|
221
|
+
|
222
|
+
.squares-twenty-by-twenty {
|
223
|
+
background-position: 0 -43px;
|
224
|
+
}
|
225
|
+
CSS
|
226
|
+
assert_equal image_size('squares-s*.png'), [20, 63]
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should calculate the maximum spacing between images" do
|
230
|
+
css = render <<-SCSS
|
231
|
+
$squares-ten-by-ten-spacing: 44px;
|
232
|
+
$squares-twenty-by-twenty-spacing: 33px;
|
233
|
+
@import "squares/*.png";
|
234
|
+
@include all-squares-sprites;
|
235
|
+
SCSS
|
236
|
+
assert_correct css, <<-CSS
|
237
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
238
|
+
background: url('/squares-sf4771cb124.png') no-repeat;
|
239
|
+
}
|
240
|
+
|
241
|
+
.squares-ten-by-ten {
|
242
|
+
background-position: 0 0;
|
243
|
+
}
|
244
|
+
|
245
|
+
.squares-twenty-by-twenty {
|
246
|
+
background-position: 0 -54px;
|
247
|
+
}
|
248
|
+
CSS
|
249
|
+
assert_equal image_size('squares-s*.png'), [20, 74]
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should calculate the maximum spacing between images in reversed order" do
|
253
|
+
css = render <<-SCSS
|
254
|
+
$squares-ten-by-ten-spacing: 33px;
|
255
|
+
$squares-twenty-by-twenty-spacing: 44px;
|
256
|
+
@import "squares/*.png";
|
257
|
+
@include all-squares-sprites;
|
258
|
+
SCSS
|
259
|
+
assert_correct css, <<-CSS
|
260
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
261
|
+
background: url('/squares-sc82d6f3cf4.png') no-repeat;
|
262
|
+
}
|
263
|
+
|
264
|
+
.squares-ten-by-ten {
|
265
|
+
background-position: 0 0;
|
266
|
+
}
|
267
|
+
|
268
|
+
.squares-twenty-by-twenty {
|
269
|
+
background-position: 0 -54px;
|
270
|
+
}
|
271
|
+
CSS
|
272
|
+
assert_equal image_size('squares-s*.png'), [20, 74]
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should calculate the default spacing between images" do
|
276
|
+
css = render <<-SCSS
|
277
|
+
$squares-spacing: 22px;
|
278
|
+
@import "squares/*.png";
|
279
|
+
@include all-squares-sprites;
|
280
|
+
SCSS
|
281
|
+
assert_correct css, <<-CSS
|
282
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
283
|
+
background: url('/squares-s2f4aa65dcf.png') no-repeat;
|
284
|
+
}
|
285
|
+
|
286
|
+
.squares-ten-by-ten {
|
287
|
+
background-position: 0 0;
|
288
|
+
}
|
289
|
+
|
290
|
+
.squares-twenty-by-twenty {
|
291
|
+
background-position: 0 -32px;
|
292
|
+
}
|
293
|
+
CSS
|
294
|
+
assert_equal image_size('squares-s*.png'), [20, 52]
|
295
|
+
end
|
296
|
+
|
297
|
+
it "should use position adjustments in functions" do
|
298
|
+
css = render <<-SCSS
|
299
|
+
$squares: sprite-map("squares/*.png", $position: 100%);
|
300
|
+
.squares-sprite {
|
301
|
+
background: $squares no-repeat;
|
302
|
+
}
|
303
|
+
|
304
|
+
.adjusted-percentage {
|
305
|
+
background-position: sprite-position($squares, ten-by-ten, 100%);
|
306
|
+
}
|
307
|
+
|
308
|
+
.adjusted-px-1 {
|
309
|
+
background-position: sprite-position($squares, ten-by-ten, 4px);
|
310
|
+
}
|
311
|
+
|
312
|
+
.adjusted-px-2 {
|
313
|
+
background-position: sprite-position($squares, twenty-by-twenty, -3px, 2px);
|
314
|
+
}
|
315
|
+
SCSS
|
316
|
+
assert_correct css, <<-CSS
|
317
|
+
.squares-sprite {
|
318
|
+
background: url('/squares-sce5dc30797.png') no-repeat;
|
319
|
+
}
|
320
|
+
|
321
|
+
.adjusted-percentage {
|
322
|
+
background-position: 100% 0;
|
323
|
+
}
|
324
|
+
|
325
|
+
.adjusted-px-1 {
|
326
|
+
background-position: -6px 0;
|
327
|
+
}
|
328
|
+
|
329
|
+
.adjusted-px-2 {
|
330
|
+
background-position: -3px -8px;
|
331
|
+
}
|
332
|
+
CSS
|
333
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
334
|
+
assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
|
335
|
+
end
|
336
|
+
|
337
|
+
it "should use position adjustments in mixins" do
|
338
|
+
css = render <<-SCSS
|
339
|
+
$squares-position: 100%;
|
340
|
+
@import "squares/*.png";
|
341
|
+
|
342
|
+
.adjusted-percentage {
|
343
|
+
@include squares-sprite("ten-by-ten", $offset-x: 100%);
|
344
|
+
}
|
345
|
+
|
346
|
+
.adjusted-px-1 {
|
347
|
+
@include squares-sprite("ten-by-ten", $offset-x: 4px);
|
348
|
+
}
|
349
|
+
|
350
|
+
.adjusted-px-2 {
|
351
|
+
@include squares-sprite("twenty-by-twenty", $offset-x: -3px, $offset-y: 2px);
|
352
|
+
}
|
353
|
+
SCSS
|
354
|
+
assert_correct css, <<-CSS
|
355
|
+
.squares-sprite, .adjusted-percentage, .adjusted-px-1, .adjusted-px-2 {
|
356
|
+
background: url('/squares-sce5dc30797.png') no-repeat;
|
357
|
+
}
|
358
|
+
|
359
|
+
.adjusted-percentage {
|
360
|
+
background-position: 100% 0;
|
361
|
+
}
|
362
|
+
|
363
|
+
.adjusted-px-1 {
|
364
|
+
background-position: -6px 0;
|
365
|
+
}
|
366
|
+
|
367
|
+
.adjusted-px-2 {
|
368
|
+
background-position: -3px -8px;
|
369
|
+
}
|
370
|
+
CSS
|
371
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
372
|
+
assert_equal image_md5('squares-s*.png'), '9cc7ce48cfaf304381c2d08adefd2fb6'
|
373
|
+
end
|
374
|
+
|
375
|
+
it "should repeat the image" do
|
376
|
+
css = render <<-SCSS
|
377
|
+
$squares-repeat: repeat-x;
|
378
|
+
@import "squares/*.png";
|
379
|
+
@include all-squares-sprites;
|
380
|
+
SCSS
|
381
|
+
assert_correct css, <<-CSS
|
382
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
383
|
+
background: url('/squares-s65c43cd573.png') no-repeat;
|
384
|
+
}
|
385
|
+
|
386
|
+
.squares-ten-by-ten {
|
387
|
+
background-position: 0 0;
|
388
|
+
}
|
389
|
+
|
390
|
+
.squares-twenty-by-twenty {
|
391
|
+
background-position: 0 -10px;
|
392
|
+
}
|
393
|
+
CSS
|
394
|
+
assert_equal image_size('squares-s*.png'), [20, 30]
|
395
|
+
assert_equal image_md5('squares-s*.png'), 'a77a2fd43f04d791722b706aa7c9f1c1'
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should allow the position of a sprite to be specified in absolute pixels" do
|
399
|
+
css = render <<-SCSS
|
400
|
+
$squares-ten-by-ten-position: 10px;
|
401
|
+
$squares-twenty-by-twenty-position: 10px;
|
402
|
+
@import "squares/*.png";
|
403
|
+
@include all-squares-sprites;
|
404
|
+
SCSS
|
405
|
+
assert_correct css, <<-CSS
|
406
|
+
.squares-sprite, .squares-ten-by-ten, .squares-twenty-by-twenty {
|
407
|
+
background: url('/squares-sb9d9a8ca6a.png') no-repeat;
|
408
|
+
}
|
409
|
+
|
410
|
+
.squares-ten-by-ten {
|
411
|
+
background-position: -10px 0;
|
412
|
+
}
|
413
|
+
|
414
|
+
.squares-twenty-by-twenty {
|
415
|
+
background-position: -10px -10px;
|
416
|
+
}
|
417
|
+
CSS
|
418
|
+
assert_equal image_size('squares-s*.png'), [30, 30]
|
419
|
+
assert_equal image_md5('squares-s*.png'), '9856ced9e8211b6b28ff782019a0d905'
|
420
|
+
end
|
421
|
+
|
422
|
+
it "should provide a nice errors for lemonade's old users" do
|
423
|
+
assert_raise(Sass::SyntaxError) do
|
424
|
+
render <<-SCSS
|
425
|
+
.squares {
|
426
|
+
background: sprite-url("squares/*.png") no-repeat;
|
427
|
+
}
|
428
|
+
SCSS
|
429
|
+
end
|
430
|
+
assert_raise(Sass::SyntaxError) do
|
431
|
+
css = render <<-SCSS
|
432
|
+
.squares {
|
433
|
+
background: sprite-image("squares/twenty-by-twenty.png") no-repeat;
|
434
|
+
}
|
435
|
+
SCSS
|
436
|
+
end
|
437
|
+
assert_raise(Sass::SyntaxError) do
|
438
|
+
css = render <<-SCSS
|
439
|
+
@import "squares/*.png";
|
440
|
+
|
441
|
+
.squares {
|
442
|
+
background: sprite-position("squares/twenty-by-twenty.png") no-repeat;
|
443
|
+
}
|
444
|
+
SCSS
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
it "should work even if @import is missing" do
|
449
|
+
css = render <<-SCSS
|
450
|
+
.squares {
|
451
|
+
background: sprite(sprite-map("squares/*.png"), twenty-by-twenty) no-repeat;
|
452
|
+
}
|
453
|
+
SCSS
|
454
|
+
assert_correct css, <<-CSS
|
455
|
+
.squares {
|
456
|
+
background: url('/squares-sd817b59156.png') 0 -10px no-repeat;
|
457
|
+
}
|
458
|
+
CSS
|
459
|
+
end
|
460
|
+
|
461
|
+
it "should calculate corret sprite demsions when givin spacing via issue#253" do
|
462
|
+
css = render <<-SCSS
|
463
|
+
$squares-spacing: 10px;
|
464
|
+
@import "squares/*.png";
|
465
|
+
.foo {
|
466
|
+
@include sprite-background-position($squares-sprites, "twenty-by-twenty");
|
467
|
+
}
|
468
|
+
.bar {
|
469
|
+
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
470
|
+
}
|
471
|
+
SCSS
|
472
|
+
assert_equal image_size('squares-s*.png'), [20, 40]
|
473
|
+
assert_correct css, <<-CSS
|
474
|
+
.squares-sprite {
|
475
|
+
background: url('/squares-s555875d730.png') no-repeat;
|
476
|
+
}
|
477
|
+
|
478
|
+
.foo {
|
479
|
+
background-position: 0 -20px;
|
480
|
+
}
|
481
|
+
|
482
|
+
.bar {
|
483
|
+
background-position: 0 0;
|
484
|
+
}
|
485
|
+
CSS
|
486
|
+
end
|
487
|
+
|
488
|
+
it "should render correct sprite with css selectors via issue#248" do
|
489
|
+
css = render <<-SCSS
|
490
|
+
@import "selectors/*.png";
|
491
|
+
@include all-selectors-sprites;
|
492
|
+
SCSS
|
493
|
+
assert_correct css, <<-CSS
|
494
|
+
.selectors-sprite, .selectors-ten-by-ten {
|
495
|
+
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
496
|
+
}
|
497
|
+
|
498
|
+
.selectors-ten-by-ten {
|
499
|
+
background-position: 0 0;
|
500
|
+
}
|
501
|
+
.selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover {
|
502
|
+
background-position: 0 -20px;
|
503
|
+
}
|
504
|
+
.selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target {
|
505
|
+
background-position: 0 -30px;
|
506
|
+
}
|
507
|
+
.selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active {
|
508
|
+
background-position: 0 -10px;
|
509
|
+
}
|
510
|
+
CSS
|
511
|
+
end
|
512
|
+
|
513
|
+
it "should honor offsets when rendering selectors via issue#449" do
|
514
|
+
css = render <<-SCSS
|
515
|
+
@import "selectors/*.png";
|
516
|
+
@include all-selectors-sprites($offset-x: 20px, $offset-y: 20px);
|
517
|
+
SCSS
|
518
|
+
assert_correct css, <<-CSS
|
519
|
+
.selectors-sprite, .selectors-ten-by-ten {
|
520
|
+
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
521
|
+
}
|
522
|
+
|
523
|
+
.selectors-ten-by-ten {
|
524
|
+
background-position: 20px 20px;
|
525
|
+
}
|
526
|
+
.selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover {
|
527
|
+
background-position: 20px 0;
|
528
|
+
}
|
529
|
+
.selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target {
|
530
|
+
background-position: 20px -10px;
|
531
|
+
}
|
532
|
+
.selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active {
|
533
|
+
background-position: 20px 10px;
|
534
|
+
}
|
535
|
+
CSS
|
536
|
+
end
|
537
|
+
|
538
|
+
it "should render correct sprite with css selectors via magic mixin" do
|
539
|
+
css = render <<-SCSS
|
540
|
+
@import "selectors/*.png";
|
541
|
+
a {
|
542
|
+
@include selectors-sprite(ten-by-ten)
|
543
|
+
}
|
544
|
+
SCSS
|
545
|
+
assert_correct css, <<-CSS
|
546
|
+
.selectors-sprite, a {
|
547
|
+
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
548
|
+
}
|
549
|
+
|
550
|
+
a {
|
551
|
+
background-position: 0 0;
|
552
|
+
}
|
553
|
+
a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover {
|
554
|
+
background-position: 0 -20px;
|
555
|
+
}
|
556
|
+
a:target, a.ten-by-ten_target, a.ten-by-ten-target {
|
557
|
+
background-position: 0 -30px;
|
558
|
+
}
|
559
|
+
a:active, a.ten-by-ten_active, a.ten-by-ten-active {
|
560
|
+
background-position: 0 -10px;
|
561
|
+
}
|
562
|
+
CSS
|
563
|
+
end
|
564
|
+
|
565
|
+
|
566
|
+
it "should not render corret sprite with css selectors via magic mixin" do
|
567
|
+
css = render <<-SCSS
|
568
|
+
@import "selectors/*.png";
|
569
|
+
a {
|
570
|
+
$disable-magic-sprite-selectors:true;
|
571
|
+
@include selectors-sprite(ten-by-ten)
|
572
|
+
}
|
573
|
+
SCSS
|
574
|
+
assert_correct css, <<-CSS
|
575
|
+
.selectors-sprite, a {
|
576
|
+
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
577
|
+
}
|
578
|
+
|
579
|
+
a {
|
580
|
+
background-position: 0 0;
|
581
|
+
}
|
582
|
+
CSS
|
583
|
+
end
|
584
|
+
|
585
|
+
it "should render corret sprite with css selectors via magic mixin with the correct offsets" do
|
586
|
+
css = render <<-SCSS
|
587
|
+
@import "selectors/*.png";
|
588
|
+
a {
|
589
|
+
@include selectors-sprite(ten-by-ten, false, 5, -5)
|
590
|
+
}
|
591
|
+
SCSS
|
592
|
+
assert_correct css, <<-CSS
|
593
|
+
.selectors-sprite, a {
|
594
|
+
background: url('/selectors-s7e84acb3d2.png') no-repeat;
|
595
|
+
}
|
596
|
+
|
597
|
+
a {
|
598
|
+
background-position: 5px -5px;
|
599
|
+
}
|
600
|
+
a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover {
|
601
|
+
background-position: 5px -25px;
|
602
|
+
}
|
603
|
+
a:target, a.ten-by-ten_target, a.ten-by-ten-target {
|
604
|
+
background-position: 5px -35px;
|
605
|
+
}
|
606
|
+
a:active, a.ten-by-ten_active, a.ten-by-ten-active {
|
607
|
+
background-position: 5px -15px;
|
608
|
+
}
|
609
|
+
CSS
|
610
|
+
end
|
611
|
+
|
612
|
+
it "should raise error on filenames that are not valid sass syntax" do
|
613
|
+
assert_raise(Compass::Error) do
|
614
|
+
css = render <<-SCSS
|
615
|
+
@import "prefix/*.png";
|
616
|
+
a {
|
617
|
+
@include squares-sprite(20-by-20);
|
618
|
+
}
|
619
|
+
SCSS
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
it "should generate sprite with bad repeat-x dimensions" do
|
624
|
+
css = render <<-SCSS
|
625
|
+
$ko-starbg26x27-repeat: repeat-x;
|
626
|
+
@import "ko/*.png";
|
627
|
+
@include all-ko-sprites;
|
628
|
+
SCSS
|
629
|
+
assert_correct css, <<-CSS
|
630
|
+
.ko-sprite, .ko-default_background, .ko-starbg26x27 {
|
631
|
+
background: url('/ko-sd46dfbab4f.png') no-repeat;
|
632
|
+
}
|
633
|
+
|
634
|
+
.ko-default_background {
|
635
|
+
background-position: 0 0;
|
636
|
+
}
|
637
|
+
|
638
|
+
.ko-starbg26x27 {
|
639
|
+
background-position: 0 -128px;
|
640
|
+
}
|
641
|
+
CSS
|
642
|
+
end
|
643
|
+
|
644
|
+
it "should generate a sprite and remove the old file" do
|
645
|
+
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Fdd.png")
|
646
|
+
assert_equal 1, map_files('selectors-s*.png').size
|
647
|
+
css = render <<-SCSS
|
648
|
+
@import "selectors/*.png";
|
649
|
+
a {
|
650
|
+
$disable-magic-sprite-selectors:true;
|
651
|
+
@include selectors-sprite(ten-by-ten)
|
652
|
+
}
|
653
|
+
SCSS
|
654
|
+
assert_equal 1, map_files('selectors-s*.png').size, "File was not removed"
|
655
|
+
end
|
656
|
+
|
657
|
+
it "should generate a sprite and NOT remove the old file" do
|
658
|
+
FileUtils.touch File.join(@images_tmp_path, "selectors-scc8834Ftest.png")
|
659
|
+
assert_equal 1, map_files('selectors-s*.png').size
|
660
|
+
css = render <<-SCSS
|
661
|
+
$selectors-clean-up: false;
|
662
|
+
@import "selectors/*.png";
|
663
|
+
a {
|
664
|
+
$disable-magic-sprite-selectors:true;
|
665
|
+
@include selectors-sprite(ten-by-ten)
|
666
|
+
}
|
667
|
+
SCSS
|
668
|
+
assert_equal 2, map_files('selectors-s*.png').size, "File was removed"
|
669
|
+
end
|
670
|
+
|
671
|
+
it "should generate a sprite if the sprite is a bool" do
|
672
|
+
css = render <<-SCSS
|
673
|
+
@import "bool/*.png";
|
674
|
+
a {
|
675
|
+
@include bool-sprite(false);
|
676
|
+
}
|
677
|
+
a {
|
678
|
+
@include bool-sprite(true);
|
679
|
+
}
|
680
|
+
SCSS
|
681
|
+
assert !css.empty?
|
682
|
+
end
|
683
|
+
|
684
|
+
|
685
|
+
it "should generate a sprite if the sprite is a colorname" do
|
686
|
+
css = render <<-SCSS
|
687
|
+
@import "colors/*.png";
|
688
|
+
a {
|
689
|
+
@include colors-sprite(blue);
|
690
|
+
}
|
691
|
+
SCSS
|
692
|
+
assert !css.empty?
|
693
|
+
end
|
694
|
+
|
695
|
+
it "should generate a sprite from nested folders" do
|
696
|
+
css = render <<-SCSS
|
697
|
+
@import "nested/**/*.png";
|
698
|
+
@include all-nested-sprites;
|
699
|
+
SCSS
|
700
|
+
assert_correct css, <<-CSS
|
701
|
+
.nested-sprite, .nested-ten-by-ten {
|
702
|
+
background: url('/nested-s7b93e0b6bf.png') no-repeat;
|
703
|
+
}
|
704
|
+
|
705
|
+
.nested-ten-by-ten {
|
706
|
+
background-position: 0 0;
|
707
|
+
}
|
708
|
+
CSS
|
709
|
+
end
|
710
|
+
|
711
|
+
it "should create horizontal sprite" do
|
712
|
+
css = render <<-SCSS
|
713
|
+
$squares-layout:horizontal;
|
714
|
+
@import "squares/*.png";
|
715
|
+
.foo {
|
716
|
+
@include sprite-background-position($squares-sprites, "twenty-by-twenty");
|
717
|
+
}
|
718
|
+
.bar {
|
719
|
+
@include sprite-background-position($squares-sprites, "ten-by-ten");
|
720
|
+
}
|
721
|
+
SCSS
|
722
|
+
assert_equal [30, 20], image_size('squares-s*.png')
|
723
|
+
other_css = <<-CSS
|
724
|
+
.squares-sprite {
|
725
|
+
background: url('/squares-s4bd95c5c56.png') no-repeat;
|
726
|
+
}
|
727
|
+
|
728
|
+
.foo {
|
729
|
+
background-position: -10px 0;
|
730
|
+
}
|
731
|
+
|
732
|
+
.bar {
|
733
|
+
background-position: 0 0;
|
734
|
+
}
|
735
|
+
CSS
|
736
|
+
assert_correct clean(css), clean(other_css)
|
737
|
+
end
|
738
|
+
|
739
|
+
it "should allow use of demension functions" do
|
740
|
+
css = render <<-SCSS
|
741
|
+
@import "squares/*.png";
|
742
|
+
$h: squares-sprite-height(twenty-by-twenty);
|
743
|
+
$w: squares-sprite-width(twenty-by-twenty);
|
744
|
+
.div {
|
745
|
+
height:$h + 1px;
|
746
|
+
width:$w + 2px;
|
747
|
+
}
|
748
|
+
SCSS
|
749
|
+
other_css = <<-CSS
|
750
|
+
.squares-sprite {
|
751
|
+
background: url('/squares-sbbc18e2129.png') no-repeat;
|
752
|
+
}
|
753
|
+
.div {
|
754
|
+
height:21px;
|
755
|
+
width:22px;
|
756
|
+
}
|
757
|
+
CSS
|
758
|
+
assert_correct clean(css), clean(other_css)
|
759
|
+
end
|
760
|
+
|
761
|
+
it "should replace text with images and dimensions using sprites" do
|
762
|
+
css = render <<-SCSS
|
763
|
+
@import "colors/*.png";
|
764
|
+
.blue {
|
765
|
+
@include sprite-replace-text($colors-sprites, blue);
|
766
|
+
}
|
767
|
+
.yellow {
|
768
|
+
@include sprite-replace-text-with-dimensions($colors-sprites, yellow);
|
769
|
+
}
|
770
|
+
SCSS
|
771
|
+
other_css = <<-CSS
|
772
|
+
.colors-sprite {
|
773
|
+
background:url('/colors-s58671cb5bb.png') no-repeat;
|
774
|
+
}
|
775
|
+
.blue {
|
776
|
+
text-indent:-119988px;
|
777
|
+
overflow:hidden;
|
778
|
+
text-align:left;
|
779
|
+
background-position:0 0;
|
780
|
+
background-image:url('/colors-s58671cb5bb.png');
|
781
|
+
background-repeat:no-repeat;
|
782
|
+
}
|
783
|
+
|
784
|
+
.yellow {
|
785
|
+
text-indent:-119988px;
|
786
|
+
overflow:hidden;
|
787
|
+
text-align:left;
|
788
|
+
background-position:0 -10px;
|
789
|
+
height:10px;
|
790
|
+
width:10px;
|
791
|
+
background-image:url('/colors-s58671cb5bb.png');
|
792
|
+
background-repeat:no-repeat;
|
793
|
+
}
|
794
|
+
CSS
|
795
|
+
assert_correct clean(css), clean(other_css)
|
796
|
+
end
|
797
|
+
|
798
|
+
it "should inline the sprite file" do
|
799
|
+
css = render <<-SCSS
|
800
|
+
$colors-inline:true;
|
801
|
+
@import "colors/*.png";
|
802
|
+
@include all-colors-sprites;
|
803
|
+
SCSS
|
804
|
+
other_css = <<-CSS
|
805
|
+
.colors-sprite, .colors-blue, .colors-yellow {
|
806
|
+
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAAAAACRhfOKAAAAHElEQVR42mM5wQADLP8JMRlIUIvE/IdgctLTNgCHDhEQVD4ceAAAAABJRU5ErkJggg==');
|
807
|
+
}
|
808
|
+
.colors-blue {
|
809
|
+
background-position:0 0;
|
810
|
+
}
|
811
|
+
.colors-yellow {
|
812
|
+
background-position:0 -10px;
|
813
|
+
}
|
814
|
+
CSS
|
815
|
+
assert_correct clean(css), clean(other_css)
|
816
|
+
end
|
817
|
+
|
818
|
+
it "should have a sprite_name function that returns the names of the sprites in a sass list" do
|
819
|
+
css = render <<-SCSS
|
820
|
+
$colors-inline:true;
|
821
|
+
@import "colors/*.png";
|
822
|
+
@each $color in sprite_names($colors-sprites) {
|
823
|
+
.\#{$color} {
|
824
|
+
width:0px;
|
825
|
+
}
|
826
|
+
}
|
827
|
+
SCSS
|
828
|
+
other_css = <<-CSS
|
829
|
+
.colors-sprite {
|
830
|
+
background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAUCAAAAACRhfOKAAAAHElEQVR42mM5wQADLP8JMRlIUIvE/IdgctLTNgCHDhEQVD4ceAAAAABJRU5ErkJggg==');
|
831
|
+
}
|
832
|
+
.blue {
|
833
|
+
width:0px;
|
834
|
+
}
|
835
|
+
.yellow {
|
836
|
+
width:0px;
|
837
|
+
}
|
838
|
+
CSS
|
839
|
+
assert_correct clean(css), clean(other_css)
|
840
|
+
|
841
|
+
end
|
842
|
+
|
843
|
+
end
|