@@ -16,7 +16,13 @@ class ViewFactoryInvocaton {
16
16
List <Node > elements;
17
17
18
18
ViewFactoryInvocaton (String template) {
19
- final injector = applicationFactory ().run ();
19
+ final m = new Module ()
20
+ ..bind (ComponentWithCss )
21
+ ..bind (ComponentWithoutCss )
22
+ ..bind (ComponentWithEmulatedShadowDomComponent )
23
+ ..bind (EmulatedShadowDomComponentWithCss );
24
+
25
+ final injector = applicationFactory ().addModule (m).run ();
20
26
final directiveMap = injector.get (DirectiveMap );
21
27
final compiler = injector.get (Compiler );
22
28
@@ -59,13 +65,58 @@ final TEMPLATE_TEXT_WITH_NG_BINDING_3_TIMES = '<span>'
59
65
'<span ng-if="1 != 2">right</span>'
60
66
'</span>' ;
61
67
68
+ final TEMPLATE_COMPONENT_NO_CSS = '<component-without-css></component-without-css>' ;
69
+
70
+ final TEMPLATE_COMPONENT_WITH_CSS = '<component-with-css></component-with-css>' ;
71
+
72
+ final TEMPLATE_CONTAINER_COMPONENT = '<component-with-emulated></component-with-emulated>' ;
73
+
74
+
75
+ @Component (
76
+ selector: 'component-without-css' ,
77
+ template: 'empty' ,
78
+ useShadowDom: true
79
+ )
80
+ class ComponentWithoutCss {
81
+ }
82
+
83
+ @Component (
84
+ selector: 'component-with-css' ,
85
+ template: 'empty' ,
86
+ cssUrl: const ['css1.css' , 'css2.css' ],
87
+ useShadowDom: true
88
+ )
89
+ class ComponentWithCss {
90
+ }
91
+
92
+ @Component (
93
+ selector: 'emulated-with-css' ,
94
+ template: 'empty' ,
95
+ cssUrl: const ['css1.css' , 'css2.css' ],
96
+ useShadowDom: false
97
+ )
98
+ class EmulatedShadowDomComponentWithCss {
99
+ }
100
+
101
+ @Component (
102
+ selector: 'component-with-emulated' ,
103
+ template: '<emulated-with-css></emulated-with-css>'
104
+ '<emulated-with-css></emulated-with-css>'
105
+ '<emulated-with-css></emulated-with-css>' ,
106
+ useShadowDom: true
107
+ )
108
+ class ComponentWithEmulatedShadowDomComponent {
109
+ }
62
110
63
111
void main () {
64
112
final templates = {
65
113
"(text + ng-binding) * 3" : TEMPLATE_TEXT_WITH_NG_BINDING_3_TIMES ,
66
114
"text" : TEMPLATE_TEXT_NO_NG_BINDING ,
67
115
"text + ng-binding" : TEMPLATE_TEXT_WITH_NG_BINDING ,
68
- "ng-binding" : TEMPLATE_NO_TEXT_WITH_NG_BINDING
116
+ "ng-binding" : TEMPLATE_NO_TEXT_WITH_NG_BINDING ,
117
+ "component without css" : TEMPLATE_COMPONENT_NO_CSS ,
118
+ "component with css" : TEMPLATE_COMPONENT_WITH_CSS ,
119
+ "component with emulated shadow dom component" : TEMPLATE_CONTAINER_COMPONENT
69
120
};
70
121
71
122
final t = document.querySelector ("#templates" );
0 commit comments