Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1142)

Unified Diff: third_party/pkg/angular/test/core_dom/shadow_root_options_spec.dart

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/test/core_dom/shadow_root_options_spec.dart
diff --git a/third_party/pkg/angular/test/core_dom/shadow_root_options_spec.dart b/third_party/pkg/angular/test/core_dom/shadow_root_options_spec.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9cfa4026103280f5baac9128340f639413f0f858
--- /dev/null
+++ b/third_party/pkg/angular/test/core_dom/shadow_root_options_spec.dart
@@ -0,0 +1,88 @@
+library shadow_root_options_spec;
+
+import '../_specs.dart';
+
+@NgComponent(
+ selector: 'reset-style-inheritance',
+ template: '<div class="c">Reset me foo</div>',
+ applyAuthorStyles: false,
+ resetStyleInheritance: true
+)
+class ResetStyleInheritanceComponent {
+ static var lastTemplateLoader;
+ ResetStyleInheritanceComponent(Element elt, TemplateLoader tl) {
+ lastTemplateLoader = tl.template;
+ }
+}
+
+@NgComponent(
+ selector: 'apply-author-style',
+ template: '<div>Style me foo</div>',
+ applyAuthorStyles: true
+)
+class ApplyAuthorStyleComponent {
+ static var lastTemplateLoader;
+ ApplyAuthorStyleComponent(Element elt, TemplateLoader tl) {
+ lastTemplateLoader = tl.template;
+ }
+}
+
+@NgComponent(
+ selector: 'default-options',
+ template: '<div class="c">Style me foo</div>'
+)
+class DefaultOptionsComponent {
+ static var lastTemplateLoader;
+ DefaultOptionsComponent(Element elt, TemplateLoader tl) {
+ lastTemplateLoader = tl.template;
+ }
+}
+
+main() {
+ describe('shadow dom options', () {
+ Compiler $compile;
+ DirectiveMap directives;
+ Injector injector;
+ Scope $rootScope;
+
+ beforeEach(module((Module module) {
+ module
+ ..type(ApplyAuthorStyleComponent)
+ ..type(ResetStyleInheritanceComponent)
+ ..type(DefaultOptionsComponent);
+ return (Injector _injector) {
+ injector = _injector;
+ $compile = injector.get(Compiler);
+ $rootScope = injector.get(Scope);
+ directives = injector.get(DirectiveMap);
+ };
+ }));
+
+ it('should respect the apply-author-style option', async(inject(() {
+ var element = $(
+ '<style>div { border: 3px solid green }</style>' +
+ '<apply-author-style>not included</apply-author-style>' +
+ '<default-options>not included</default-options>');
+ element.forEach((elt) { document.body.append(elt); }); // we need the computed style.
+ $compile(element, directives)(injector, element);
+
+ microLeap();
+ expect(element[1].shadowRoot.query('div').getComputedStyle().border).toContain('3px solid');
+ // ""0px none"" is the default style.
+ expect(element[2].shadowRoot.query('div').getComputedStyle().border).toContain('0px none');
+ })));
+
+ it('should respect the reset-style-inheritance option', async(inject(() {
+ var element = $(
+ '<style>body { font-size: 20px; }</style>' + // font-size inherit's by default
+ '<reset-style-inheritance>not included</reset-style-inheritance>' +
+ '<default-options>not included</default-options>');
+ element.forEach((elt) { document.body.append(elt); }); // we need the computed style.
+ $compile(element, directives)(injector, element);
+
+ microLeap();
+ expect(element[1].shadowRoot.query('div').getComputedStyle().fontSize).toEqual('16px');
+ expect(element[2].shadowRoot.query('div').getComputedStyle().fontSize).toEqual('20px');
+ })));
+ });
+}
« no previous file with comments | « third_party/pkg/angular/test/core_dom/selector_spec.dart ('k') | third_party/pkg/angular/test/core_dom/view_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698