Comparing version 0.3.0 to 0.3.1
@@ -22,2 +22,3 @@ /// <reference types="angular" /> | ||
export declare let $parse: angular.IParseService; | ||
export declare let $provide: angular.auto.IProvideService; | ||
export declare let $q: angular.IQService; | ||
@@ -24,0 +25,0 @@ export declare let $rootElement: angular.IRootElementService; |
import * as angular from 'angular'; | ||
export let $anchorScroll = undefined; | ||
export let $cacheFactory = undefined; | ||
export let $compile = undefined; | ||
export let $controller = undefined; | ||
export let $document = undefined; | ||
export let $exceptionHandler = undefined; | ||
export let $filter = undefined; | ||
export let $http = undefined; | ||
export let $httpBackend = undefined; | ||
export let $httpParamSerializer = undefined; | ||
export let $httpParamSerializerJQLike = undefined; | ||
export let $injector = undefined; | ||
export let $interpolate = undefined; | ||
export let $interval = undefined; | ||
export let $locale = undefined; | ||
export let $location = undefined; | ||
export let $log = undefined; | ||
export let $parse = undefined; | ||
export let $q = undefined; | ||
export let $rootElement = undefined; | ||
export let $rootScope = undefined; | ||
export let $sce = undefined; | ||
export let $sceDelegate = undefined; | ||
export let $templateCache = undefined; | ||
export let $templateRequest = undefined; | ||
export let $timeout = undefined; | ||
export let $window = undefined; | ||
export let $xhrFactory = undefined; | ||
export var $anchorScroll = undefined; | ||
export var $cacheFactory = undefined; | ||
export var $compile = undefined; | ||
export var $controller = undefined; | ||
export var $document = undefined; | ||
export var $exceptionHandler = undefined; | ||
export var $filter = undefined; | ||
export var $http = undefined; | ||
export var $httpBackend = undefined; | ||
export var $httpParamSerializer = undefined; | ||
export var $httpParamSerializerJQLike = undefined; | ||
export var $injector = undefined; | ||
export var $interpolate = undefined; | ||
export var $interval = undefined; | ||
export var $locale = undefined; | ||
export var $location = undefined; | ||
export var $log = undefined; | ||
export var $parse = undefined; | ||
export var $provide = undefined; | ||
export var $q = undefined; | ||
export var $rootElement = undefined; | ||
export var $rootScope = undefined; | ||
export var $sce = undefined; | ||
export var $sceDelegate = undefined; | ||
export var $templateCache = undefined; | ||
export var $templateRequest = undefined; | ||
export var $timeout = undefined; | ||
export var $window = undefined; | ||
export var $xhrFactory = undefined; | ||
// bootstrap a dummy application using our module, so the #run block | ||
@@ -36,3 +37,3 @@ // below is synchronously called, and all of the injectables in it are | ||
export function bootstrap(moduleName) { | ||
const div = document.createElement('div'); | ||
var div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
@@ -44,3 +45,3 @@ angular.bootstrap(div, [moduleName]); | ||
// to prevent sharing state between services | ||
let m = null; | ||
var m = null; | ||
try { | ||
@@ -52,2 +53,5 @@ m = angular.module('bcherny/ngimport'); | ||
} | ||
m.config(['$provide', function ($p) { | ||
$provide = $p; | ||
}]); | ||
// TODO: add mgMock/ngMockE2E services | ||
@@ -54,0 +58,0 @@ m.run(['$injector', function ($i) { |
"use strict"; | ||
const angular = require('angular'); | ||
var angular = require('angular'); | ||
exports.$anchorScroll = undefined; | ||
@@ -21,2 +21,3 @@ exports.$cacheFactory = undefined; | ||
exports.$parse = undefined; | ||
exports.$provide = undefined; | ||
exports.$q = undefined; | ||
@@ -38,3 +39,3 @@ exports.$rootElement = undefined; | ||
function bootstrap(moduleName) { | ||
const div = document.createElement('div'); | ||
var div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
@@ -47,3 +48,3 @@ angular.bootstrap(div, [moduleName]); | ||
// to prevent sharing state between services | ||
let m = null; | ||
var m = null; | ||
try { | ||
@@ -55,2 +56,5 @@ m = angular.module('bcherny/ngimport'); | ||
} | ||
m.config(['$provide', function ($p) { | ||
exports.$provide = $p; | ||
}]); | ||
// TODO: add mgMock/ngMockE2E services | ||
@@ -57,0 +61,0 @@ m.run(['$injector', function ($i) { |
@@ -21,2 +21,3 @@ import * as angular from 'angular' | ||
export let $parse: angular.IParseService = undefined | ||
export let $provide: angular.auto.IProvideService = undefined | ||
export let $q: angular.IQService = undefined | ||
@@ -54,4 +55,8 @@ export let $rootElement: angular.IRootElementService = undefined | ||
m.config(['$provide', ($p: angular.auto.IProvideService) => { | ||
$provide = $p | ||
}]) | ||
// TODO: add mgMock/ngMockE2E services | ||
m.run(['$injector', function($i: angular.auto.IInjectorService) { | ||
m.run(['$injector', ($i: angular.auto.IInjectorService) => { | ||
$anchorScroll = <angular.IAnchorScrollService>$i.get('$anchorScroll') | ||
@@ -58,0 +63,0 @@ $cacheFactory = <angular.ICacheFactoryService>$i.get('$cacheFactory') |
{ | ||
"name": "ngimport", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Finally, imports for Angular 1 builtins!", | ||
@@ -9,3 +9,3 @@ "main": "./ngimport.js", | ||
"scripts": { | ||
"build": "tsc -d -m es2015 -t es2015 --outDir . && mv ./ngimport.js ./ngimport.es2015.js && tsc -m commonjs -t es5 --outDir .;", | ||
"build": "tsc -d -m es2015 -t es5 --outDir . && mv ./ngimport.js ./ngimport.es2015.js && tsc -m commonjs -t es5 --outDir .;", | ||
"watch": "tsc -w", | ||
@@ -12,0 +12,0 @@ "test": "karma start --single-run", |
18
test.js
@@ -5,9 +5,9 @@ import { $http, $rootScope, bootstrap } from './ngimport.es2015' | ||
// TODO: map global angular to angular import in rollup config instead | ||
const { angular } = window | ||
const angular = window.angular | ||
describe('ngimport', () => { | ||
afterEach(() => { | ||
describe('ngimport', function() { | ||
afterEach(function() { | ||
$http.defaults.headers.common = {} | ||
}) | ||
it('should define angular builtins immediately, before the app is bootstrapped', () => { | ||
it('should define angular builtins immediately, before the app is bootstrapped', function() { | ||
angular.module('a', []) | ||
@@ -19,7 +19,7 @@ expect($http).toBeDefined() | ||
}) | ||
it('should not override ngimported provider state', () => { | ||
it('should not override ngimported provider state', function() { | ||
angular.module('a', []) | ||
angular.bootstrap(angular.element(), ['a']) | ||
$http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w' | ||
angular.module('a').run(() => { | ||
angular.module('a').run(function() { | ||
expect($http.defaults.headers.common.Authorization).toBe('Basic YmVlcDpib29w') | ||
@@ -29,3 +29,3 @@ }) | ||
}) | ||
it('should not share ngimported service state between ngimported and injected instances', () => { | ||
it('should not share ngimported service state between ngimported and injected instances', function() { | ||
angular.module('a', []) | ||
@@ -36,3 +36,3 @@ const $injector = angular.bootstrap(document.createElement('div'), ['a']) | ||
}) | ||
it('should not share ngimported service state between injected and ngimported instances', () => { | ||
it('should not share ngimported service state between injected and ngimported instances', function() { | ||
angular.module('a', []) | ||
@@ -43,3 +43,3 @@ const $injector = angular.bootstrap(document.createElement('div'), ['a']) | ||
}) | ||
// it('should be able to mock dependencies with $provide', () => { | ||
// it('should be able to mock dependencies with $provide', function() { | ||
// angular.module('a', []) | ||
@@ -46,0 +46,0 @@ // const $injector = angular.bootstrap(document.createElement('div'), ['a']) |
@@ -11,3 +11,3 @@ { | ||
"sourceMap": false, | ||
"target": "es6" | ||
"target": "es5" | ||
}, | ||
@@ -14,0 +14,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22905
387