File tree Expand file tree Collapse file tree 5 files changed +29
-15
lines changed
test/transform/template_compiler Expand file tree Collapse file tree 5 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,14 @@ import {TemplateLoader} from 'angular2/src/render/dom/compiler/template_loader';
1616import { CompileStepFactory , DefaultStepFactory } from './compile_step_factory' ;
1717import { Parser } from 'angular2/change_detection' ;
1818import { ShadowDomStrategy } from '../shadow_dom/shadow_dom_strategy' ;
19- import {
20- PropertySetterFactory
21- } from '../view/property_setter_factory'
19+ import { PropertySetterFactory } from '../view/property_setter_factory' ;
2220
23- /**
24- * The compiler loads and translates the html templates of components into
25- * nested ProtoViews. To decompose its functionality it uses
26- * the CompilePipeline and the CompileSteps.
27- */
28- export class DomCompiler extends RenderCompiler {
21+ /**
22+ * The compiler loads and translates the html templates of components into
23+ * nested ProtoViews. To decompose its functionality it uses
24+ * the CompilePipeline and the CompileSteps.
25+ */
26+ export class DomCompiler extends RenderCompiler {
2927 _templateLoader : TemplateLoader ;
3028 _stepFactory : CompileStepFactory ;
3129 _propertySetterFactory : PropertySetterFactory ;
Original file line number Diff line number Diff line change @@ -93,8 +93,8 @@ export class PropertySetterFactory {
9393 var dashCasedClassName ;
9494 if ( isBlank ( setterFn ) ) {
9595 dashCasedClassName = camelCaseToDashCase ( className ) ;
96- setterFn = ( element , value ) => {
97- if ( value ) {
96+ setterFn = ( element , isAdd ) => {
97+ if ( isAdd ) {
9898 DOM . addClass ( element , dashCasedClassName ) ;
9999 } else {
100100 DOM . removeClass ( element , dashCasedClassName ) ;
Original file line number Diff line number Diff line change @@ -92,6 +92,18 @@ void allTests() {
9292 output = await process (new AssetId ('a' , inputPath));
9393 _formatThenExpectEquals (output, expected);
9494 });
95+
96+ it ('should create the same output for multiple calls.' , () async {
97+ var inputPath =
98+ 'template_compiler/inline_expression_files/hello.ng_deps.dart' ;
99+ var expected = readFile (
100+ 'template_compiler/inline_expression_files/expected/hello.ng_deps.dart' );
101+ var output = await process (new AssetId ('a' , inputPath));
102+ _formatThenExpectEquals (output, expected);
103+ output = await process (new AssetId ('a' , inputPath));
104+ _formatThenExpectEquals (output, expected);
105+ });
106+
95107 });
96108}
97109
Original file line number Diff line number Diff line change @@ -14,9 +14,13 @@ void initReflector(reflector) {
1414 'parameters' : const [const []],
1515 'annotations' : const [
1616 const Component (selector: 'hello-app' ),
17- const View (template: '{{greeting}}' )
17+ const View (template: '<div [a]="b"> {{greeting}}</div> ' )
1818 ]
1919 })
20- ..registerGetters ({'greeting' : (o) => o.greeting})
21- ..registerSetters ({'greeting' : (o, v) => o.greeting = v});
20+ ..registerGetters ({'b' : (o) => o.b, 'greeting' : (o) => o.greeting})
21+ ..registerSetters ({
22+ 'b' : (o, v) => o.b = v,
23+ 'greeting' : (o, v) => o.greeting = v,
24+ 'a' : (o, v) => o.a = v
25+ });
2226}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ void initReflector(reflector) {
1414 'parameters' : const [const []],
1515 'annotations' : const [
1616 const Component (selector: 'hello-app' ),
17- const View (template: '{{greeting}}' )
17+ const View (template: '<div [a]="b"> {{greeting}}</div> ' )
1818 ]
1919 });
2020}
You can’t perform that action at this time.
0 commit comments