sass 3.1.0.alpha.15 → 3.1.0.alpha.16

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.
@@ -53,6 +53,11 @@ class SassScriptConversionTest < Test::Unit::TestCase
53
53
  assert_renders "-foo(12px)"
54
54
  end
55
55
 
56
+ def test_funcall_with_keyword_args
57
+ assert_renders "foo(arg1, arg2, $karg1: val, $karg2: val2)"
58
+ assert_renders "foo($karg1: val, $karg2: val2)"
59
+ end
60
+
56
61
  def test_url
57
62
  assert_renders "url(foo.gif)"
58
63
  assert_renders "url($var)"
@@ -1072,6 +1072,69 @@ ul li\#{$bar} a span.label { foo: bar; }
1072
1072
  SCSS
1073
1073
  end
1074
1074
 
1075
+ def test_mixin_with_keyword_args
1076
+ assert_equal <<CSS, render(<<SCSS)
1077
+ .mixed {
1078
+ required: foo;
1079
+ arg1: default-val1;
1080
+ arg2: non-default-val2; }
1081
+ CSS
1082
+ @mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
1083
+ required: $required;
1084
+ arg1: $arg1;
1085
+ arg2: $arg2;
1086
+ }
1087
+ .mixed { @include a-mixin(foo, $arg2: non-default-val2); }
1088
+ SCSS
1089
+ end
1090
+
1091
+ def test_passing_required_args_as_a_keyword_arg
1092
+ assert_equal <<CSS, render(<<SCSS)
1093
+ .mixed {
1094
+ required: foo;
1095
+ arg1: default-val1;
1096
+ arg2: default-val2; }
1097
+ CSS
1098
+ @mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
1099
+ required: $required;
1100
+ arg1: $arg1;
1101
+ arg2: $arg2; }
1102
+ .mixed { @include a-mixin($required: foo); }
1103
+ SCSS
1104
+ end
1105
+
1106
+ def test_passing_all_as_keyword_args_in_opposite_order
1107
+ assert_equal <<CSS, render(<<SCSS)
1108
+ .mixed {
1109
+ required: foo;
1110
+ arg1: non-default-val1;
1111
+ arg2: non-default-val2; }
1112
+ CSS
1113
+ @mixin a-mixin($required, $arg1: default-val1, $arg2: default-val2) {
1114
+ required: $required;
1115
+ arg1: $arg1;
1116
+ arg2: $arg2; }
1117
+ .mixed { @include a-mixin($arg2: non-default-val2, $arg1: non-default-val1, $required: foo); }
1118
+ SCSS
1119
+ end
1120
+
1121
+ def test_keyword_args_in_functions
1122
+ assert_equal <<CSS, render(<<SCSS)
1123
+ .keyed {
1124
+ color: rgba(170, 119, 204, 0.4); }
1125
+ CSS
1126
+ .keyed { color: rgba($color: #a7c, $alpha: 0.4) }
1127
+ SCSS
1128
+ end
1129
+
1130
+ def test_unknown_keyword_arg_raises_error
1131
+ assert_raise_message(Sass::SyntaxError, "Mixin a doesn't have an argument named $c") {render <<SCSS}
1132
+ @mixin a($b: 1) { a: $b; }
1133
+ div { @include a(1, $c: 3); }
1134
+ SCSS
1135
+ end
1136
+
1137
+
1075
1138
  def test_newlines_removed_from_selectors_when_compressed
1076
1139
  assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
1077
1140
  z a,z b{display:block}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.alpha.15
4
+ version: 3.1.0.alpha.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-10-03 00:00:00 -04:00
14
+ date: 2010-10-05 00:00:00 -04:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency