1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Adding new tests for complex stuff...

not sure if its what we want yet.




git-svn-id: svn://hamptoncatlin.com/haml/branches/1.5dev@178 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
hcatlin 2006-11-28 22:35:35 +00:00
parent e811263ced
commit 4d4ffb178c
4 changed files with 377 additions and 1 deletions

View file

@ -18,7 +18,9 @@ module Sass
buffer << "}\n"
end
if level <= last_level
stack.delete_at(stack.size - 1)
(last_level - level + 1).times do
stack.delete_at(stack.size - 1)
end
if stack.empty?
buffer << "\n"
end

104
test/css/complex.css Normal file
View file

@ -0,0 +1,104 @@
%body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; color: #fff; background: url(/images/global_bg.gif); }
#page { width: 900px; margin: 0 auto; background: #440008; border-top: 5px solid #ff8500; }
#header { height: 75px; padding: 0; }
#header %h1 { float: left; width: 274px; height: 75px; margin: 0; background: url(/images/global_logo.gif) no-repeat; text-indent: -9999px; }
#header .status { float: right; padding: .5em .5em 0 .5em; }
#header .status %p { float: left; margin: 0 0.5em 0 0; }
#header .status %ul { float: left; margin: 0; padding: 0; }
#header .status %li { list-style-type: none; display: inline; margin: 0 5px; }
#header .status %a:link, a:visited { color: #ff8500; text-decoration: none; }
#header .status %a:hover { text-decoration: underline; }
#header .search { float: right; clear: right; margin: 12px 0 0 0; }
#header .search %form { margin: 0; }
#header .search %input { margin: 0 3px 0 0; padding:: 2px; border:: none; }
#menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background:: #00a4e4; }
#menu .contests { }
#menu .contests %ul { margin: 0 5px 0 0; padding: 0; }
#menu .contests %ul %li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: #fff; background: #00a4e4; }
#menu .contests %a:link, a:visited { color: #fff; text-decoration: none; font-weight: bold; }
#menu .contests %a:hover { text-decoration: underline; }
#content { clear: both; }
#content .container { clear: both; }
#content .container .column { float: left; }
#content .container .column .left { }
#content .container .column .middle { }
#content .container .column .right { float: right; }
#content %a:link, a:visited { color: #93d700; text-decoration: none; }
#content %a:hover { text-decoration: underline; }
#content { }
#content .container.video { }
#content .container.video .column.left { width: 200px; }
#content .container.video .column.left .box { margin-top: 10px; }
#content .container.video .column.left .box %p { margin: 0 1em auto 1em; }
#content .container.video .column.left .box.participants { }
#content .container.video .column.left .box.participants %img { float: left; margin: 0 1em auto 1em; border: 1px solid #6e000d; }
#content .container.video .column.left .box.participants %h2 { margin: 0 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
#content .container.video .column.middle { width: 500px; }
#content .container.video .column.right { width: 200px; }
#content .container.video .column.right .box { margin-top: 0; }
#content .container.video .column.right .box %p { margin: 0 1em auto 1em; }
#content .container.video .column { }
#content .container.video .column %p { margin-top: 0; }
#content.contests { }
#content.contests .container.information { }
#content.contests .container.information .column.right { }
#content.contests .container.information .column.right .box { margin: 1em 0; }
#content.contests .container.information .column.right .box.videos { }
#content.contests .container.information .column.right .box.videos .thumbnail img { width: 200px; height: 150px; margin-bottom: 5px; }
#content.contests .container.information .column.right .box.videos %a:link, a:visited { color: #93d700; text-decoration: none; }
#content.contests .container.information .column.right .box.videos %a:hover { text-decoration: underline; }
#content.contests .container.information .column.right .box.votes { }
#content.contests .container.information .column.right .box.votes %a { display: block; width: 200px; height: 60px; margin: 15px 0; background: url(/images/btn_votenow.gif) no-repeat; text-indent: -9999px; outline: none; border: none; }
#content.contests .container.information .column.right .box.votes %h2 { margin: 52px 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
#content.contests { }
#content.contests .container.video { }
#content.contests .container.video .box.videos { }
#content.contests .container.video .box.videos %h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
#content.contests .container.video .box.videos %table { width: 100%; }
#content.contests .container.video .box.videos %table %td { padding: 1em; width: 25%; vertical-align: top; }
#content.contests .container.video .box.videos %table %td %p { margin: 0 0 5px 0; }
#content.contests .container.video .box.videos %table %td %a:link, a:visited { color: #93d700; text-decoration: none; }
#content.contests .container.video .box.videos %table %td %a:hover { text-decoration: underline; }
#content.contests .container.video .box.videos .thumbnail { float: left; }
#content.contests .container.video .box.videos .thumbnail %img { width: 80px; height: 60px; margin: 0 10px 0 0; border: 1px solid #6e000d; }
#content { }
#content .container.comments { }
#content .container.comments .column { margin-top: 15px; }
#content .container.comments .column.left { width: 600px; }
#content .container.comments .column.left .box { }
#content .container.comments .column.left .box %ol { margin: 0; padding: 0; }
#content .container.comments .column.left .box %li { list-style-type: none; padding: 10px; margin: 0 0 1em 0; background: #6e000d; border-top: 5px solid #a20013; }
#content .container.comments .column.left .box %li %div { margin-bottom: 1em; }
#content .container.comments .column.left .box %li %ul { text-align: right; }
#content .container.comments .column.left .box %li %ul %li { display: inline; border: none; padding: 0; }; }
#content .container.comments .column.right { width: 290px; padding-left: 10px; }
#content .container.comments .column.right %h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; }
#content .container.comments .column.right .box { }
#content .container.comments .column.right .box %textarea { width: 290px; height: 100px; border: none; }
#footer { margin-top: 10px; padding: 1.2em 1.5em; background: #ff8500; }
#footer %ul { margin: 0; padding: 0; list-style-type: none; }
#footer %ul %li { display: inline; margin: 0 0.5em; color: #440008; }
#footer %ul.links { float: left; }
#footer %ul.links %a:link, a:visited { color: #440008; text-decoration: none; }
#footer %ul.links %a:hover { text-decoration: underline; }
#footer %ul.copyright { float: right; }
.clear { clear: both; }
.centered { text-align: center; }
%img { border: none; }
%button.short { width: 60px; height: 22px; padding: 0 0 2px 0; color: #fff; border: none; background: url(/images/btn_short.gif) no-repeat; }
%table { border-collapse: collapse; }

266
test/sass/complex.sass Normal file
View file

@ -0,0 +1,266 @@
%body
:margin 0
:font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif
:color #fff
:background url(/images/global_bg.gif)
#page
:width 900px
:margin 0 auto
:background #440008
:border-top 5px solid #ff8500
#header
:height 75px
:padding 0
%h1
:float left
:width 274px
:height 75px
:margin 0
:background url(/images/global_logo.gif) no-repeat
:text-indent -9999px
.status
:float right
:padding .5em .5em 0 .5em
%p
:float left
:margin 0 0.5em 0 0
%ul
:float left
:margin 0
:padding 0
%li
:list-style-type none
:display inline
:margin 0 5px
%a:link, a:visited
:color #ff8500
:text-decoration none
%a:hover
:text-decoration underline
.search
:float right
:clear right
:margin 12px 0 0 0
%form
:margin 0
%input
:margin 0 3px 0 0
:padding: 2px
:border: none
#menu
:clear both
:text-align right
:height 20px
:border-bottom 5px solid #006b95
:background: #00a4e4
.contests
%ul
:margin 0 5px 0 0
:padding 0
%li
:list-style-type none
:margin 0 5px
:padding 5px 5px 0 5px
:display inline
:font-size 1.1em
:color #fff
:background #00a4e4
%a:link, a:visited
:color #fff
:text-decoration none
:font-weight bold
%a:hover
:text-decoration underline
//General content information
#content
:clear both
.container
:clear both
.column
:float left
.left
.middle
.right
:float right
%a:link, a:visited
:color #93d700
:text-decoration none
%a:hover
:text-decoration underline
#content
.container.video
.column.left
:width 200px
.box
:margin-top 10px
%p
:margin 0 1em auto 1em
.box.participants
%img
:float left
:margin 0 1em auto 1em
:border 1px solid #6e000d
%h2
:margin 0 0 10px 0
:padding 0.5em
:background #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat
:text-indent -9999px
:border-top 5px solid #a20013
.column.middle
:width 500px
.column.right
:width 200px
.box
:margin-top 0
%p
:margin 0 1em auto 1em
.column
%p
:margin-top 0
#content.contests
.container.information
.column.right
.box
:margin 1em 0
.box.videos
.thumbnail img
:width 200px
:height 150px
:margin-bottom 5px
%a:link, a:visited
:color #93d700
:text-decoration none
%a:hover
:text-decoration underline
.box.votes
%a
:display block
:width 200px
:height 60px
:margin 15px 0
:background url(/images/btn_votenow.gif) no-repeat
:text-indent -9999px
:outline none
:border none
%h2
:margin 52px 0 10px 0
:padding 0.5em
:background #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat
:text-indent -9999px
:border-top 5px solid #a20013
#content.contests
.container.video
.box.videos
%h2
:margin 0
:padding 0.5em
:background #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat
:text-indent -9999px
:border-top 5px solid #a20013
%table
:width 100%
%td
:padding 1em
:width 25%
:vertical-align top
%p
:margin 0 0 5px 0
%a:link, a:visited
:color #93d700
:text-decoration none
%a:hover
:text-decoration underline
.thumbnail
:float left
%img
:width 80px
:height 60px
:margin 0 10px 0 0
:border 1px solid #6e000d
#content
.container.comments
.column
:margin-top 15px
.column.left
:width 600px
.box
%ol
:margin 0
:padding 0
%li
:list-style-type none
:padding 10px
:margin 0 0 1em 0
:background #6e000d
:border-top 5px solid #a20013
%div
:margin-bottom 1em
%ul
:text-align right
%li
:display inline; border: none; padding: 0; }
.column.right
:width 290px
:padding-left 10px
%h2
:margin 0
:padding 0.5em
:background #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat
:text-indent -9999px
:border-top 5px solid #a20013
.box
%textarea
:width 290px
:height 100px
:border none
#footer
:margin-top 10px
:padding 1.2em 1.5em
:background #ff8500
%ul
:margin 0
:padding 0
:list-style-type none
%li
:display inline
:margin 0 0.5em
:color #440008
%ul.links
:float left
%a:link, a:visited
:color #440008
:text-decoration none
%a:hover
:text-decoration underline
%ul.copyright
:float right
.clear
:clear both
.centered
:text-align center
%img
:border none
%button.short
:width 60px
:height 22px
:padding 0 0 2px 0
:color #fff
:border none
:background url(/images/btn_short.gif) no-repeat
%table
:border-collapse collapse

View file

@ -17,6 +17,10 @@ class SassPluginTest < Test::Unit::TestCase
clear_file_render :basic
end
def test_complex_render
do_file_render :complex
end
def test_no_update
base_file_location = base_file_location(:basic)
assert Sass::SassHelper.stylesheet_needs_update?(base_file_location)