feat(change_detector): add support for map literals
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {ddescribe, describe, it, iit, xit, expect} from 'test_lib/test_lib';
|
||||
|
||||
import {List, ListWrapper} from 'facade/collection';
|
||||
import {List, ListWrapper, MapWrapper} from 'facade/collection';
|
||||
import {Parser} from 'change_detection/parser/parser';
|
||||
import {Lexer} from 'change_detection/parser/lexer';
|
||||
import {ClosureMap} from 'change_detection/parser/closure_map';
|
||||
@ -100,6 +100,16 @@ export function main() {
|
||||
expect(c["dispatcher"].loggedValues).toEqual([[1,2]]);
|
||||
});
|
||||
|
||||
it("should support literal maps", () => {
|
||||
var c = createChangeDetector('map', '{z:1}');
|
||||
c["changeDetector"].detectChanges();
|
||||
expect(MapWrapper.get(c["dispatcher"].loggedValues[0], 'z')).toEqual(1);
|
||||
|
||||
c = createChangeDetector('map', '{z:a}', new TestData(1));
|
||||
c["changeDetector"].detectChanges();
|
||||
expect(MapWrapper.get(c["dispatcher"].loggedValues[0], 'z')).toEqual(1);
|
||||
});
|
||||
|
||||
it("should support binary operations", () => {
|
||||
expect(executeWatch('exp', '10 + 2')).toEqual(['exp=12']);
|
||||
expect(executeWatch('exp', '10 - 2')).toEqual(['exp=8']);
|
||||
|
Reference in New Issue
Block a user