| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   xdescribe, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   afterEach, | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   inject | 
					
						
							|  |  |  | } from 'angular2/test_lib'; | 
					
						
							|  |  |  | import {IS_DART} from '../platform'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import {evalModule} from './eval_module'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // This export is used by this test code
 | 
					
						
							|  |  |  | // when evaling the test module!
 | 
					
						
							|  |  |  | export var TEST_VALUE = 23; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  | const THIS_MODULE = 'angular2/test/compiler/eval_module_spec'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | export function main() { | 
					
						
							|  |  |  |   describe('evalModule', () => { | 
					
						
							| 
									
										
										
										
											2015-09-02 15:07:31 -07:00
										 |  |  |     it('should call the "run" function and allow to use imports', | 
					
						
							|  |  |  |        inject([AsyncTestCompleter], (async) => { | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  |          var moduleSource = IS_DART ? testDartModule : testJsModule; | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |          evalModule(moduleSource, [[THIS_MODULE, 'tst']], [1]) | 
					
						
							| 
									
										
										
										
											2015-09-02 15:07:31 -07:00
										 |  |  |              .then((value) => { | 
					
						
							|  |  |  |                expect(value).toEqual([1, 23]); | 
					
						
							|  |  |  |                async.done(); | 
					
						
							|  |  |  |              }); | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  |        })); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var testDartModule = `
 | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  |   run(data) { | 
					
						
							|  |  |  | 	  data.add(tst.TEST_VALUE); | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | 		return data; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | `;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var testJsModule = `
 | 
					
						
							|  |  |  |   exports.run = function(data) { | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  | 	  data.push(tst.TEST_VALUE); | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | 		return data; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | `;
 |