| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import("../../../css/css.dart"); | 5 #import("../../css/css.dart"); |
| 6 | 6 |
| 7 class SelectorLiteralTest { | 7 class SelectorLiteralTest { |
| 8 static final String ERROR = 'CompilerException: <buffer>:'; | 8 static final String ERROR = 'CompilerException: <buffer>:'; |
| 9 | 9 |
| 10 static testMain() { | 10 static testMain() { |
| 11 initCssWorld(); | 11 initCssWorld(); |
| 12 options.useColors = false; | 12 options.useColors = false; |
| 13 | 13 |
| 14 testSimpleClassSelectorSuccesses(); | 14 testSimpleClassSelectorSuccesses(); |
| 15 testSimpleClassSelectorFailures(); | 15 testSimpleClassSelectorFailures(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Namespace selector not valid in @{css_expression} | 129 // Namespace selector not valid in @{css_expression} |
| 130 css = '@{foo|div}'; | 130 css = '@{foo|div}'; |
| 131 try { | 131 try { |
| 132 cssParseAndValidate('${css}', cssWorld); | 132 cssParseAndValidate('${css}', cssWorld); |
| 133 Expect.fail("${css} should not succeed."); | 133 Expect.fail("${css} should not succeed."); |
| 134 } catch (final e) { | 134 } catch (final e) { |
| 135 Expect.equals("CssSelectorException: Invalid template selector foo|div", | 135 Expect.equals("CssSelectorException: Invalid template selector foo|div", |
| 136 e.toString()); | 136 e.toString()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 // class and element id not allowed together. | 139 // class and element id not allowed together. |
| 140 css = '@{.foobar foo|div}'; | 140 css = '@{.foobar foo|div}'; |
| 141 try { | 141 try { |
| 142 cssParseAndValidate('${css}', cssWorld); | 142 cssParseAndValidate('${css}', cssWorld); |
| 143 Expect.fail("$css} should not succeed."); | 143 Expect.fail("$css} should not succeed."); |
| 144 } catch (final e) { | 144 } catch (final e) { |
| 145 Expect.equals("CssSelectorException: Invalid template selector foo|div", | 145 Expect.equals("CssSelectorException: Invalid template selector foo|div", |
| 146 e.toString()); | 146 e.toString()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Element id and namespace not allowed together. | 149 // Element id and namespace not allowed together. |
| 150 css = '@{#id1 foo|div}'; | 150 css = '@{#id1 foo|div}'; |
| 151 try { | 151 try { |
| 152 cssParseAndValidate('${css}', cssWorld); | 152 cssParseAndValidate('${css}', cssWorld); |
| 153 Expect.fail("${css} should not succeed."); | 153 Expect.fail("${css} should not succeed."); |
| 154 } catch (final e) { | 154 } catch (final e) { |
| 155 Expect.equals("CssSelectorException: Invalid template selector foo|div", | 155 Expect.equals("CssSelectorException: Invalid template selector foo|div", |
| 156 e.toString()); | 156 e.toString()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // namespace and element id not allowed together. | 159 // namespace and element id not allowed together. |
| 160 css = '@{foo|div #id1}'; | 160 css = '@{foo|div #id1}'; |
| 161 try { | 161 try { |
| 162 cssParseAndValidate('${css}', cssWorld); | 162 cssParseAndValidate('${css}', cssWorld); |
| 163 Expect.fail("${css} should not succeed."); | 163 Expect.fail("${css} should not succeed."); |
| 164 } catch (final e) { | 164 } catch (final e) { |
| 165 Expect.equals("CssSelectorException: Invalid template selector foo|div", | 165 Expect.equals("CssSelectorException: Invalid template selector foo|div", |
| 166 e.toString()); | 166 e.toString()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // namespace / element not allowed. | 169 // namespace / element not allowed. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 Expect.equals("CssSelectorException: Use of Id selector must be " + | 232 Expect.equals("CssSelectorException: Use of Id selector must be " + |
| 233 "singleton starting at #_privateId2", e.toString()); | 233 "singleton starting at #_privateId2", e.toString()); |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 } | 237 } |
| 238 | 238 |
| 239 main() { | 239 main() { |
| 240 SelectorLiteralTest.testMain(); | 240 SelectorLiteralTest.testMain(); |
| 241 } | 241 } |
| OLD | NEW |