OLD | NEW |
1 part of angular.mock; | 1 part of angular.mock; |
2 | 2 |
3 /** | 3 /** |
4 * A convenient way to assert the order in which the DOM elements are processed. | 4 * A convenient way to assert the order in which the DOM elements are processed. |
5 * | 5 * |
6 * In your test create: | 6 * In your test create: |
7 * | 7 * |
8 * <div log="foo">...</div> | 8 * <div log="foo">...</div> |
9 * | 9 * |
10 * And then assert: | 10 * And then assert: |
11 * | 11 * |
12 * expect(logger).toEqual(['foo']); | 12 * expect(logger).toEqual(['foo']); |
13 */ | 13 */ |
14 @NgDirective( | 14 @Decorator( |
15 selector: '[log]', | 15 selector: '[log]', |
16 map: const { | 16 map: const { |
17 'log': '@logMessage' | 17 'log': '@logMessage' |
18 }) | 18 }) |
19 class LogAttrDirective implements NgAttachAware { | 19 class LogAttrDirective implements AttachAware { |
20 final Logger log; | 20 final Logger log; |
21 String logMessage; | 21 String logMessage; |
22 LogAttrDirective(this.log); | 22 LogAttrDirective(this.log); |
23 void attach() { | 23 void attach() { |
24 log(logMessage == '' ? 'LOG' : logMessage); | 24 log(logMessage == '' ? 'LOG' : logMessage); |
25 } | 25 } |
26 } | 26 } |
27 | 27 |
28 /** | 28 /** |
29 * A convenient way to verify that a set of operations executed in a specific | 29 * A convenient way to verify that a set of operations executed in a specific |
(...skipping 27 matching lines...) Expand all Loading... |
57 operator [](int index) => tokens[index]; | 57 operator [](int index) => tokens[index]; |
58 | 58 |
59 void operator []=(int index, value) { | 59 void operator []=(int index, value) { |
60 tokens[index] = value; | 60 tokens[index] = value; |
61 } | 61 } |
62 | 62 |
63 void set length(int newLength) { | 63 void set length(int newLength) { |
64 tokens.length = newLength; | 64 tokens.length = newLength; |
65 } | 65 } |
66 } | 66 } |
OLD | NEW |