| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | import { | 
					
						
							|  |  |  |   ddescribe, | 
					
						
							|  |  |  |   describe, | 
					
						
							|  |  |  |   xdescribe, | 
					
						
							|  |  |  |   it, | 
					
						
							|  |  |  |   iit, | 
					
						
							|  |  |  |   xit, | 
					
						
							|  |  |  |   expect, | 
					
						
							|  |  |  |   beforeEach, | 
					
						
							|  |  |  |   afterEach, | 
					
						
							|  |  |  |   AsyncTestCompleter, | 
					
						
							|  |  |  |   inject | 
					
						
							| 
									
										
										
										
											2015-10-13 00:29:13 -07:00
										 |  |  | } from 'angular2/testing_internal'; | 
					
						
							| 
									
										
										
										
											2015-11-06 17:34:07 -08:00
										 |  |  | import {IS_DART} from 'angular2/src/facade/lang'; | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import {evalModule} from './eval_module'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // This export is used by this test code
 | 
					
						
							|  |  |  | // when evaling the test module!
 | 
					
						
							|  |  |  | export var TEST_VALUE = 23; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-05 14:07:57 -08:00
										 |  |  | const THIS_MODULE_URL = `package:angular2/test/compiler/eval_module_spec${IS_DART?'.dart':'.js'}`; | 
					
						
							| 
									
										
										
										
											2015-09-14 15:59:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  | export function main() { | 
					
						
							| 
									
										
										
										
											2016-01-25 17:20:06 -08:00
										 |  |  |   // Dart's isolate support is broken, and these tests will be obsolote soon with
 | 
					
						
							|  |  |  |   // https://github.com/angular/angular/issues/6270
 | 
					
						
							|  |  |  |   if (IS_DART) { | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-08-28 11:45:39 -07:00
										 |  |  |   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-10-01 10:07:49 -07:00
										 |  |  |          evalModule(moduleSource, [[THIS_MODULE_URL, '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; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2015-10-02 07:57:29 -07:00
										 |  |  | `;
 |