Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
feat(directives): Add deprecated warning to applyAuthorStyle, resetSt…
Browse files Browse the repository at this point in the history
…yleInheritance

Closes #838
For #801
  • Loading branch information
jbdeboer committed Apr 2, 2014
1 parent 2d8615f commit afcb2ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 96 deletions.
33 changes: 29 additions & 4 deletions lib/core/directive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ abstract class NgAnnotation {
}


bool _applyAuthorStylesDeprecationWarningPrinted = false;
bool _resetStyleInheritanceDeprecationWarningPrinted = false;

/**
* Meta-data marker placed on a class which should act as a controller for the
* component. Angular components are a light-weight version of web-components.
Expand Down Expand Up @@ -214,14 +217,34 @@ class NgComponent extends NgAnnotation {
/**
* Set the shadow root applyAuthorStyles property. See shadow-DOM
* documentation for further details.
*
* This feature will be removed in Chrome 35.
*/
final bool applyAuthorStyles;
@deprecated
bool get applyAuthorStyles {
if (!_applyAuthorStylesDeprecationWarningPrinted && _applyAuthorStyles == true) {
print("WARNING applyAuthorStyles is deprecated in component $selector");
_applyAuthorStylesDeprecationWarningPrinted = true;
}
return _applyAuthorStyles;
}
final bool _applyAuthorStyles;

/**
* Set the shadow root resetStyleInheritance property. See shadow-DOM
* documentation for further details.
*
* This feature will be removed in Chrome 35.
*/
final bool resetStyleInheritance;
@deprecated
bool get resetStyleInheritance {
if (!_resetStyleInheritanceDeprecationWarningPrinted && _resetStyleInheritance == true) {
print("WARNING resetStyleInheritance is deprecated in component $selector");
_resetStyleInheritanceDeprecationWarningPrinted = true;
}
return _resetStyleInheritance;
}
final bool _resetStyleInheritance;

/**
* An expression under which the component's controller instance will be
Expand All @@ -234,8 +257,8 @@ class NgComponent extends NgAnnotation {
this.template,
this.templateUrl,
cssUrl,
this.applyAuthorStyles,
this.resetStyleInheritance,
applyAuthorStyles,
resetStyleInheritance,
this.publishAs,
module,
map,
Expand All @@ -244,6 +267,8 @@ class NgComponent extends NgAnnotation {
exportExpressions,
exportExpressionAttrs})
: _cssUrls = cssUrl,
_applyAuthorStyles = applyAuthorStyles,
_resetStyleInheritance = resetStyleInheritance,
super(selector: selector,
children: NgAnnotation.COMPILE_CHILDREN,
visibility: visibility,
Expand Down
4 changes: 0 additions & 4 deletions test/core/core_directive_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ void main() {
expect(annotation.template).toEqual('template');
expect(annotation.templateUrl).toEqual('templateUrl');
expect(annotation.cssUrls).toEqual(['cssUrls']);
expect(annotation.applyAuthorStyles).toEqual(true);
expect(annotation.resetStyleInheritance).toEqual(true);
expect(annotation.publishAs).toEqual('ctrl');
expect(annotation.map).toEqual({
'foo': '=>foo',
Expand Down Expand Up @@ -83,8 +81,6 @@ class NullParser implements Parser {
template: 'template',
templateUrl: 'templateUrl',
cssUrl: const ['cssUrls'],
applyAuthorStyles: true,
resetStyleInheritance: true,
publishAs: 'ctrl',
module: AnnotatedIoComponent.module,
visibility: NgDirective.LOCAL_VISIBILITY,
Expand Down
88 changes: 0 additions & 88 deletions test/core_dom/shadow_root_options_spec.dart

This file was deleted.

0 comments on commit afcb2ea

Please sign in to comment.