Currently, core depends on the browser, which means that other platforms (e.g., NativeScript or webworker) cannot use the bootstrapping logic core provides. This PR extract makes bootstrapping logic in core completely platform-independent. The browser-specific code was moved to "angular2/platforms/browser". BREAKING CHANGE A few private helpers (e.g., platformCommon or applicationCommon) were removed or replaced with other helpers. Look at PLATFORM_COMMON_PROVIDERS, APPLICATION_COMMON_PROVIDERS, BROWSER_PROVIDERS, BROWSER_APP_PROVIDERS to see if they export the providers you need. Closes #5219 Closes #5280
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {
 | |
|   AsyncTestCompleter,
 | |
|   beforeEach,
 | |
|   ddescribe,
 | |
|   describe,
 | |
|   expect,
 | |
|   iit,
 | |
|   inject,
 | |
|   it,
 | |
|   xit
 | |
| } from 'angular2/testing_internal';
 | |
| 
 | |
| import {XHRImpl} from 'angular2/src/platform/browser/xhr_impl';
 | |
| import {PromiseWrapper} from 'angular2/src/facade/async';
 | |
| 
 | |
| export function main() {
 | |
|   describe('XHRImpl', () => {
 | |
|     var xhr: XHRImpl;
 | |
|     var url200 = '/base/modules/angular2/test/core/services/static_assets/200.html';
 | |
|     var url404 = '/base/modules/angular2/test/core/services/static_assets/404.html';
 | |
| 
 | |
|     beforeEach(() => { xhr = new XHRImpl(); });
 | |
| 
 | |
|     it('should resolve the Promise with the file content on success',
 | |
|        inject([AsyncTestCompleter], (async) => {
 | |
|          xhr.get(url200).then((text) => {
 | |
|            expect(text.trim()).toEqual('<p>hey</p>');
 | |
|            async.done();
 | |
|          });
 | |
|        }), 10000);
 | |
| 
 | |
|     it('should reject the Promise on failure', inject([AsyncTestCompleter], (async) => {
 | |
|          PromiseWrapper.catchError(xhr.get(url404), (e) => {
 | |
|            expect(e).toEqual(`Failed to load ${url404}`);
 | |
|            async.done();
 | |
|            return null;
 | |
|          });
 | |
|        }), 10000);
 | |
|   });
 | |
| }
 |