Tim Blasi 104302a958 refactor(dart/transform): Remove unnecessary getter/setter codegen
Currently the transformer generates all getters and setters even when
creating pre-generated change detectors, which remove the need for them.

Generate getters and setters via the model provided by `ProtoViewDto`,
which contains enough information to allow omitting unnecessary getters
and setters from code output.

Allow generating getters, setters, and method names which are Dart
pseudo keywords.

Closes #3489
2015-08-19 17:36:12 +00:00

32 lines
1.3 KiB
TypeScript

import {EventConfig} from 'angular2/src/render/dom/util';
import {ddescribe, describe, expect, it} from 'angular2/test_lib';
export function main() {
describe('EventConfig', () => {
describe('parse', () => {
it('should handle short form events', () => {
var eventConfig = EventConfig.parse('shortForm');
expect(eventConfig.fieldName).toEqual('shortForm');
expect(eventConfig.eventName).toEqual('shortForm');
expect(eventConfig.isLongForm).toEqual(false);
});
it('should handle long form events', () => {
var eventConfig = EventConfig.parse('fieldName: eventName');
expect(eventConfig.fieldName).toEqual('fieldName');
expect(eventConfig.eventName).toEqual('eventName');
expect(eventConfig.isLongForm).toEqual(true);
});
});
describe('getFullName', () => {
it('should handle short form events', () => {
var eventConfig = new EventConfig('shortForm', 'shortForm', false);
expect(eventConfig.getFullName()).toEqual('shortForm');
});
it('should handle long form events', () => {
var eventConfig = new EventConfig('fieldName', 'eventName', true);
expect(eventConfig.getFullName()).toEqual('fieldName:eventName');
});
});
});
}