refactor(transformer): precompile stylesheets

Part of #3605
This commit is contained in:
Yegor Jbanov
2015-09-29 17:27:44 -07:00
committed by Tobias Bosch
parent 52236bd765
commit 841f8789fd
10 changed files with 771 additions and 17 deletions
@@ -0,0 +1,11 @@
library angular2.compiler.shadow_css_html5lib.test;
import 'package:angular2/src/core/dom/html_adapter.dart';
import 'package:angular2/src/test_lib/test_lib.dart' show testSetup;
import 'shadow_css_spec.dart' as shadow_css_spec_test;
void main() {
Html5LibDomAdapter.makeCurrent();
testSetup();
shadow_css_spec_test.main();
}
@@ -33,7 +33,7 @@ export function main() {
expect(s(css, 'a')).toEqual(expected);
});
it('should hanlde invalid css', () => {
it('should handle invalid css', () => {
var css = 'one {color: red;}garbage';
var expected = 'one[a] {color:red;}';
expect(s(css, 'a')).toEqual(expected);
@@ -58,8 +58,7 @@ export function main() {
});
// Check that the browser supports unprefixed CSS animation
if (isPresent(DOM.defaultDoc().body.style) &&
isPresent(DOM.defaultDoc().body.style.animationName)) {
if (DOM.supportsUnprefixedCssAnimation()) {
it('should handle keyframes rules', () => {
var css = '@keyframes foo {0% {transform: translate(-50%) scaleX(0);}}';
var passRe =
@@ -80,9 +79,9 @@ export function main() {
it('should handle complicated selectors', () => {
expect(s('one::before {}', 'a')).toEqual('one[a]::before {}');
expect(s('one two {}', 'a')).toEqual('one[a] two[a] {}');
expect(s('one>two {}', 'a')).toEqual('one[a] > two[a] {}');
expect(s('one+two {}', 'a')).toEqual('one[a] + two[a] {}');
expect(s('one~two {}', 'a')).toEqual('one[a] ~ two[a] {}');
expect(s('one > two {}', 'a')).toEqual('one[a] > two[a] {}');
expect(s('one + two {}', 'a')).toEqual('one[a] + two[a] {}');
expect(s('one ~ two {}', 'a')).toEqual('one[a] ~ two[a] {}');
var res = s('.one.two > three {}', 'a'); // IE swap classes
expect(res == '.one.two[a] > three[a] {}' || res == '.two.one[a] > three[a] {}')
.toEqual(true);