File: 21-nesting.t

package info (click to toggle)
libtext-sass-perl 1.0.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 312 kB
  • sloc: perl: 825; makefile: 58
file content (67 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
# vim:ts=8:sw=2:et:sta:sts=2
#########
# Author:        rmp
# Last Modified: $Date: 2012-09-12 09:42:30 +0100 (Wed, 12 Sep 2012) $
# Id:            $Id: 21-nesting.t 71 2012-09-12 08:42:30Z zerojinx $
# $HeadURL: https://text-sass.svn.sourceforge.net/svnroot/text-sass/trunk/t/21-nesting.t $
#
use strict;
use Test::More tests => 2;
use Text::Sass;

{
  my $sass_str = <<EOT;
form
  p label
    display: block
    font-weight: bold
  input.textbox
    background: white
    color: #666
  button
    color: white
    background: red
    padding: 10px 20px
EOT

  #########
  # TODO: the order of these groups is reversed for some reason.
  # form p label | form input.textbox | form button
  #
  my $css_str = <<EOT;
form p label {
  display: block;
  font-weight: bold;
}

form input.textbox {
  background: white;
  color: #666;
}

form button {
  color: white;
  background: red;
  padding: 10px 20px;
}
EOT
  my $sass = Text::Sass->new();
  is($sass->sass2css($sass_str), $css_str, 'sass2css multilevel nesting');
}

{
  my $sass_str = <<EOT;
#content, #sidebar
  p
    margin: 1em 0
EOT

  my $css_str = <<EOT;
#content p, #sidebar p {
  margin: 1em 0;
}
EOT
  my $sass = Text::Sass->new();
  is($sass->sass2css($sass_str), $css_str, 'sass2css multilevel nesting');
}