diff --git a/.gitignore b/.gitignore index 1264ee5e77..dcab35bb14 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,6 @@ npm-debug.log # built dart payload tests /modules_dart/payload/**/build + +# rollup-test output +/modules/rollup-test/dist/ diff --git a/.travis.yml b/.travis.yml index 631ba683c2..139de1c3b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,132 +3,190 @@ sudo: false node_js: - '5.4.1' +addons: +# firefox: "38.0" + apt: + sources: + # needed to install g++ that is used by npms's native modules + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + branches: except: - g3_v2_0 cache: directories: - - $HOME/.pub-cache - - $HOME/.chrome/chromium + - ./node_modules + - ./.chrome/chromium +# - $HOME/.pub-cache -before_cache: - # Undo the pollution of the typescript_next build before the cache is primed for future use - - if [[ "$MODE" == "typescript_next" ]]; then npm install typescript; fi + +#before_cache: +# # Undo the pollution of the typescript_next build before the cache is primed for future use +# - if [[ "$MODE" == "typescript_next" ]]; then npm install typescript; fi env: global: - # Use newer verison of GCC to that is required to compile native npm modules for Node v4+ on Ubuntu Precise - # more info: https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements - - CXX=g++-4.8 - - KARMA_DART_BROWSERS=DartiumWithWebPlatform - # No sandbox mode is needed for Chromium in Travis, it crashes otherwise: https://sites.google.com/a/chromium.org/chromedriver/help/chrome-doesn-t-start - - KARMA_JS_BROWSERS=ChromeNoSandbox - - E2E_BROWSERS=ChromeOnTravis - - LOGS_DIR=/tmp/angular-build/logs - - SAUCE_USERNAME=angular-ci - - SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 - - BROWSER_STACK_USERNAME=angularteam1 - - BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB - - ARCH=linux-x64 - - DART_DEV_VERSION=latest - - DART_STABLE_VERSION=latest - - DART_CHANNEL=stable - - DART_VERSION=$DART_STABLE_VERSION - # Token for tsd to increase github rate limit - # See https://github.com/DefinitelyTyped/tsd#tsdrc - # This does not use http://docs.travis-ci.com/user/environment-variables/#Secure-Variables - # because those are not visible for pull requests, and those should also be reliable. - # This SSO token belongs to github account angular-github-ratelimit-token which has no access - # (password is in Valentine) - - TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}' - # GITHUB_TOKEN_ANGULAR - - secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo=" +# - KARMA_JS_BROWSERS=ChromeNoSandbox +# - E2E_BROWSERS=ChromeOnTravis +# - LOGS_DIR=/tmp/angular-build/logs +# - ARCH=linux-x64 + matrix: # Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete. - - MODE=dart - - MODE=dart DART_CHANNEL=dev - - MODE=saucelabs_required - - MODE=browserstack_required - - MODE=saucelabs_optional - - MODE=browserstack_optional - - MODE=dart_ddc - - MODE=js - - MODE=router - - MODE=build_only - - MODE=typescript_next - - MODE=lint + - CI_MODE=js +# - CI_MODE=dart + - CI_MODE=build_only + - CI_MODE=saucelabs_required + - CI_MODE=browserstack_required -matrix: - allow_failures: - - env: "MODE=saucelabs_optional" - - env: "MODE=browserstack_optional" +#matrix: +# allow_failures: +# - env: "MODE=saucelabs_optional" +# - env: "MODE=browserstack_optional" -addons: - firefox: "38.0" - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 - -before_install: - - node tools/analytics/build-analytics start ci job - - node tools/analytics/build-analytics start ci before_install - - echo ${TSDRC} > .tsdrc - - export CHROME_BIN=$HOME/.chrome/chromium/chrome-linux/chrome - - export DISPLAY=:99.0 - - export GIT_SHA=$(git rev-parse HEAD) - - ./scripts/ci/init_android.sh - - sh -e /etc/init.d/xvfb start - # Use a separate SauseLabs account for upstream/master builds in order for Sauce to create a badge representing the status of just upstream/master - - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && SAUCE_USERNAME="angular2-ci" && SAUCE_ACCESS_KEY="693ebc16208a-0b5b-1614-8d66-a2662f4e" || true' - - node tools/analytics/build-analytics success ci before_install install: - - node tools/analytics/build-analytics start ci install - # Install version of npm that we are locked against - - npm install -g npm@3.5.3 - # Install version of Chromium that we are locked against - - ./scripts/ci/install_chromium.sh - # Install version of Dart based on the matrix build variables - - ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${DART_VERSION} ${ARCH} - # Print the size of caches to ease debugging - - du -sh ./node_modules || true - # Install npm dependecies - # check-node-modules will exit(1) if we don't need to install - # we need to manually kick off the postinstall script if check-node-modules exit(0)s - - node tools/npm/check-node-modules --purge && npm install || npm run postinstall - - node tools/analytics/build-analytics success ci install + - ./scripts/ci-lite/install.sh before_script: - - node tools/analytics/build-analytics start ci before_script - - mkdir -p $LOGS_DIR - - ./scripts/ci/presubmit-queue-setup.sh - - node tools/analytics/build-analytics success ci before_script + script: - - node tools/analytics/build-analytics start ci script - - ./scripts/ci/build_and_test.sh ${MODE} - - node tools/analytics/build-analytics success ci script + - ./scripts/ci-lite/build.sh && ./scripts/ci-lite/test.sh after_script: - - node tools/analytics/build-analytics start ci after_script - - ./scripts/ci/print-logs.sh - - ./scripts/ci/after-script.sh - - ./scripts/publish/publish-build-artifacts.sh - - node tools/analytics/build-analytics success ci after_script - - tools/analytics/build-analytics $TRAVIS_TEST_RESULT ci job + - ./scripts/ci-lite/cleanup.sh -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/1ef62e23078036f9cee4 - # trigger Buildtime Trend Service to parse Travis CI log - - https://buildtimetrend.herokuapp.com/travis - - http://104.197.9.155:8484/hubot/travis/activity - on_success: always # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # default: never - slack: - secure: EP4MzZ8JMyNQJ4S3cd5LEPWSMjC7ZRdzt3veelDiOeorJ6GwZfCDHncR+4BahDzQAuqyE/yNpZqaLbwRWloDi15qIUsm09vgl/1IyNky1Sqc6lEknhzIXpWSalo4/T9ZP8w870EoDvM/UO+LCV99R3wS8Nm9o99eLoWVb2HIUu0= + +#branches: +# except: +# - g3_v2_0 +# +#cache: +# directories: +# - $HOME/.pub-cache +# - $HOME/.chrome/chromium +# +#before_cache: +# # Undo the pollution of the typescript_next build before the cache is primed for future use +# - if [[ "$MODE" == "typescript_next" ]]; then npm install typescript; fi +# +#env: +# global: +# # Use newer verison of GCC to that is required to compile native npm modules for Node v4+ on Ubuntu Precise +# # more info: https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements +# - CXX=g++-4.8 +# - KARMA_DART_BROWSERS=DartiumWithWebPlatform +# # No sandbox mode is needed for Chromium in Travis, it crashes otherwise: https://sites.google.com/a/chromium.org/chromedriver/help/chrome-doesn-t-start +# - KARMA_JS_BROWSERS=ChromeNoSandbox +# - E2E_BROWSERS=ChromeOnTravis +# - LOGS_DIR=/tmp/angular-build/logs +# - SAUCE_USERNAME=angular-ci +# - SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987 +# - BROWSER_STACK_USERNAME=angularteam1 +# - BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB +# - ARCH=linux-x64 +# - DART_DEV_VERSION=latest +# - DART_STABLE_VERSION=latest +# - DART_CHANNEL=stable +# - DART_VERSION=$DART_STABLE_VERSION +# # Token for tsd to increase github rate limit +# # See https://github.com/DefinitelyTyped/tsd#tsdrc +# # This does not use http://docs.travis-ci.com/user/environment-variables/#Secure-Variables +# # because those are not visible for pull requests, and those should also be reliable. +# # This SSO token belongs to github account angular-github-ratelimit-token which has no access +# # (password is in Valentine) +# - TSDRC='{"token":"ef474500309daea53d5991b3079159a29520a40b"}' +# # GITHUB_TOKEN_ANGULAR +# - secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo=" +# matrix: +# # Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete. +# - MODE=dart +# - MODE=dart DART_CHANNEL=dev +# - MODE=saucelabs_required +# - MODE=browserstack_required +# - MODE=saucelabs_optional +# - MODE=browserstack_optional +# - MODE=dart_ddc +# - MODE=js +# - MODE=router +# - MODE=build_only +# - MODE=typescript_next +# - MODE=lint +# +#matrix: +# allow_failures: +# - env: "MODE=saucelabs_optional" +# - env: "MODE=browserstack_optional" +# +#addons: +# firefox: "38.0" +# apt: +# sources: +# - ubuntu-toolchain-r-test +# packages: +# - g++-4.8 +# +#before_install: +# - node tools/analytics/build-analytics start ci job +# - node tools/analytics/build-analytics start ci before_install +# - echo ${TSDRC} > .tsdrc +# - export CHROME_BIN=$HOME/.chrome/chromium/chrome-linux/chrome +# - export DISPLAY=:99.0 +# - export GIT_SHA=$(git rev-parse HEAD) +# - ./scripts/ci/init_android.sh +# - sh -e /etc/init.d/xvfb start +# # Use a separate SauseLabs account for upstream/master builds in order for Sauce to create a badge representing the status of just upstream/master +# - '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && SAUCE_USERNAME="angular2-ci" && SAUCE_ACCESS_KEY="693ebc16208a-0b5b-1614-8d66-a2662f4e" || true' +# - node tools/analytics/build-analytics success ci before_install +# +#install: +# - node tools/analytics/build-analytics start ci install +# # Install version of npm that we are locked against +# - npm install -g npm@3.5.3 +# # Install version of Chromium that we are locked against +# - ./scripts/ci/install_chromium.sh +# # Install version of Dart based on the matrix build variables +# - ./scripts/ci/install_dart.sh ${DART_CHANNEL} ${DART_VERSION} ${ARCH} +# # Print the size of caches to ease debugging +# - du -sh ./node_modules || true +# # Install npm dependecies +# # check-node-modules will exit(1) if we don't need to install +# # we need to manually kick off the postinstall script if check-node-modules exit(0)s +# - node tools/npm/check-node-modules --purge && npm install || npm run postinstall +# - node tools/analytics/build-analytics success ci install +# +#before_script: +# - node tools/analytics/build-analytics start ci before_script +# - mkdir -p $LOGS_DIR +# - ./scripts/ci/presubmit-queue-setup.sh +# - node tools/analytics/build-analytics success ci before_script +# +#script: +# - node tools/analytics/build-analytics start ci script +# - ./scripts/ci/build_and_test.sh ${MODE} +# - node tools/analytics/build-analytics success ci script +# +#after_script: +# - node tools/analytics/build-analytics start ci after_script +# - ./scripts/ci/print-logs.sh +# - ./scripts/ci/after-script.sh +# - ./scripts/publish/publish-build-artifacts.sh +# - node tools/analytics/build-analytics success ci after_script +# - tools/analytics/build-analytics $TRAVIS_TEST_RESULT ci job +# +#notifications: +# webhooks: +# urls: +# - https://webhooks.gitter.im/e/1ef62e23078036f9cee4 +# # trigger Buildtime Trend Service to parse Travis CI log +# - https://buildtimetrend.herokuapp.com/travis +# - http://104.197.9.155:8484/hubot/travis/activity +# on_success: always # options: [always|never|change] default: always +# on_failure: always # options: [always|never|change] default: always +# on_start: never # default: never +# slack: +# secure: EP4MzZ8JMyNQJ4S3cd5LEPWSMjC7ZRdzt3veelDiOeorJ6GwZfCDHncR+4BahDzQAuqyE/yNpZqaLbwRWloDi15qIUsm09vgl/1IyNky1Sqc6lEknhzIXpWSalo4/T9ZP8w870EoDvM/UO+LCV99R3wS8Nm9o99eLoWVb2HIUu0= diff --git a/browser-providers.conf.js b/browser-providers.conf.js index c6d1da11e7..d8dd776228 100644 --- a/browser-providers.conf.js +++ b/browser-providers.conf.js @@ -38,7 +38,7 @@ var customLaunchers = { 'SL_CHROME': { base: 'SauceLabs', browserName: 'chrome', - version: '46' + version: '50' }, 'SL_CHROMEBETA': { base: 'SauceLabs', @@ -53,7 +53,7 @@ var customLaunchers = { 'SL_FIREFOX': { base: 'SauceLabs', browserName: 'firefox', - version: '42' + version: '45' }, 'SL_FIREFOXBETA': { base: 'SauceLabs', @@ -299,12 +299,7 @@ module.exports = { customLaunchers: customLaunchers, sauceAliases: sauceAliases, browserstackAliases: browserstackAliases -} - -if (process.env.TRAVIS) { - process.env.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY.split('').reverse().join(''); - process.env.BROWSER_STACK_ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY.split('').reverse().join(''); -} +}; function buildConfiguration(type, target, required) { return Object.keys(CIconfiguration) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..6c32b40797 --- /dev/null +++ b/build.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +cd `dirname $0` + + +TSCONFIG=./modules/tsconfig.json +echo "====== (all)COMPILING: \$(npm bin)/tsc -p ${TSCONFIG} =====" +rm -rf ./dist/all/ +$(npm bin)/tsc -p ${TSCONFIG} + + +rm -rf ./dist/packages-dist + +for PACKAGE in \ + core \ + compiler \ + common \ + platform-browser \ + platform-browser-dynamic \ + platform-server \ + http \ + router \ + upgrade +do + SRCDIR=./modules/@angular/${PACKAGE} + DESTDIR=./dist/packages-dist/${PACKAGE} + UMDES6PATH=${DESTDIR}/esm/${PACKAGE}.umd.js + UMDES5PATH=${DESTDIR}/${PACKAGE}.umd.js + + + echo "====== COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig.json =====" + $(npm bin)/tsc -p ${SRCDIR}/tsconfig.json + cp ${SRCDIR}/package.json ${DESTDIR}/ + + + echo "====== TSC 1.8 d.ts compat for ${DESTDIR} =====" + # safely strips 'readonly' specifier from d.ts files to make them compatible with tsc 1.8 + if [[ ${TRAVIS} ]]; then + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i -e 's/\(^ *(static |private )*\)*readonly */\1/g' + else + find ${DESTDIR} -type f -name '*.d.ts' -print0 | xargs -0 sed -i '' -e 's/\(^ *(static |private )*\)*readonly */\1/g' + fi + + + echo "====== (esm)COMPILING: \$(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json =====" + $(npm bin)/tsc -p ${SRCDIR}/tsconfig-es2015.json + + + echo "====== BUNDLING: ${SRCDIR} =====" + ( + cd ${SRCDIR} + echo "..." # here just to have grep match something and not exit with 1 + ../../../node_modules/.bin/rollup -c rollup.config.js + ) 2>&1 | grep -v "as external dependency" + + # workaround for https://github.com/rollup/rollup/issues/626 + if [[ ${TRAVIS} ]]; then + sed -i "s/ class exports\./ class /g" ${DESTDIR}/esm/${PACKAGE}.umd.js + else + sed -i '' "s/ class exports\./ class /g" ${DESTDIR}/esm/${PACKAGE}.umd.js + fi + + $(npm bin)/tsc \ + --out ${UMDES5PATH} \ + --target es5 \ + --allowJs \ + ${UMDES6PATH} \ + modules/\@angular/manual_typings/globals.d.ts \ + modules/\@angular/typings/es6-collections/es6-collections.d.ts \ + modules/\@angular/typings/es6-promise/es6-promise.d.ts + rm ${UMDES6PATH} + +done diff --git a/gulpfile.js b/gulpfile.js index 6ddde03900..cbc0b04e22 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -923,7 +923,7 @@ gulp.task('test.unit.cjs/ci', function(done) { runJasmineTests(['dist/js/cjs/{angular2,benchpress}/test/**/*_spec.js'], done); }); -gulp.task('check-public-api', +gulp.task('check-public-api', ['build.tools'], function(done) { runJasmineTests(['dist/tools/public_api_guard/**/*_spec.js'], done); }); gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function(neverDone) { @@ -1566,6 +1566,10 @@ process.on('beforeExit', function() { var firstTask = true; + + + + gulp.on('task_start', (e) => { if (firstTask) { firstTask = false; diff --git a/karma-js.conf.js b/karma-js.conf.js index 437a1ae2ec..d13f01f8ab 100644 --- a/karma-js.conf.js +++ b/karma-js.conf.js @@ -11,7 +11,8 @@ module.exports = function(config) { files: [ // Sources and specs. // Loaded through the System loader, in `test-main.js`. - {pattern: 'dist/js/dev/es5/**', included: false, watched: false}, + {pattern: 'dist/all/@angular/**/*.js', included: false, watched: true}, + {pattern: 'dist/all/angular2/**/*.js', included: false, watched: true}, 'node_modules/es6-shim/es6-shim.js', // include Angular v1 for upgrade module testing @@ -24,16 +25,23 @@ module.exports = function(config) { 'node_modules/zone.js/dist/fake-async-test.js', // Including systemjs because it defines `__eval`, which produces correct stack traces. - 'modules/angular2/src/testing/shims_for_IE.js', + 'shims_for_IE.js', 'node_modules/systemjs/dist/system.src.js', {pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true}, 'node_modules/reflect-metadata/Reflect.js', 'tools/build/file2modulename.js', 'test-main.js', - {pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false} + {pattern: 'dist/all/empty.*', included: false, watched: false}, + {pattern: 'modules/@angular/platform-browser/test/static_assets/**', included: false, watched: false}, + {pattern: 'modules/@angular/platform-browser-dynamic/test/browser/static_assets/**', included: false, watched: false} ], - exclude: ['dist/js/dev/es5/**/e2e_test/**', 'dist/js/dev/es5/angular2/examples/**', 'dist/angular1_router.js'], + exclude: [ + 'dist/all/@angular/**/e2e_test/**', + 'dist/all/@angular/examples/**', + 'dist/all/angular1_router.js', + 'dist/all/@angular/platform-browser/testing/e2e_util.js' + ], customLaunchers: browserProvidersConf.customLaunchers, @@ -54,6 +62,7 @@ module.exports = function(config) { reporters: ['internal-angular'], sauceLabs: { testName: 'Angular2', + retryLimit: 3, startConnect: false, recordVideo: false, recordScreenshots: false, @@ -68,7 +77,7 @@ module.exports = function(config) { browserStack: { project: 'Angular2', startTunnel: false, - retryLimit: 1, + retryLimit: 3, timeout: 600, pollingTimeout: 10000 }, @@ -80,7 +89,7 @@ module.exports = function(config) { if (process.env.TRAVIS) { var buildId = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')'; - if (process.env.MODE.startsWith('saucelabs')) { + if (process.env.CI_MODE.startsWith('saucelabs')) { config.sauceLabs.build = buildId; config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; @@ -90,7 +99,7 @@ module.exports = function(config) { config.transports = ['polling']; } - if (process.env.MODE.startsWith('browserstack')) { + if (process.env.CI_MODE.startsWith('browserstack')) { config.browserStack.build = buildId; config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER; } diff --git a/modules/@angular/common/common.dart b/modules/@angular/common/common.dart new file mode 100644 index 0000000000..1592d948a1 --- /dev/null +++ b/modules/@angular/common/common.dart @@ -0,0 +1 @@ +export 'index.dart'; diff --git a/modules/@angular/common/index.ts b/modules/@angular/common/index.ts new file mode 100644 index 0000000000..a63e66af67 --- /dev/null +++ b/modules/@angular/common/index.ts @@ -0,0 +1,6 @@ +export * from './src/pipes'; +export * from './src/directives'; +export * from './src/forms'; +export * from './src/common_directives'; +export * from './src/location'; + diff --git a/modules/@angular/common/package.json b/modules/@angular/common/package.json new file mode 100644 index 0000000000..f717a032cb --- /dev/null +++ b/modules/@angular/common/package.json @@ -0,0 +1,13 @@ +{ + "name": "@angular/common", + "version": "$$ANGULAR_VERSION$$", + "description": "", + "main": "index.js", + "jsnext:main": "esm/index.js", + "typings": "index.d.ts", + "author": "angular", + "license": "MIT", + "peerDependencies": { + "@angular/core": "$$ANGULAR_VERSION$$" + } +} diff --git a/modules/@angular/common/rollup.config.js b/modules/@angular/common/rollup.config.js new file mode 100644 index 0000000000..08bc4aa6f9 --- /dev/null +++ b/modules/@angular/common/rollup.config.js @@ -0,0 +1,18 @@ + +export default { + entry: '../../../dist/packages-dist/common/esm/index.js', + dest: '../../../dist/packages-dist/common/esm/common.umd.js', + sourceMap: true, + format: 'umd', + moduleName: 'ng.common', + globals: { + '@angular/core': 'ng.core', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + }, + plugins: [ +// nodeResolve({ jsnext: true, main: true }), + ] +} diff --git a/modules/@angular/common/src/common_directives.ts b/modules/@angular/common/src/common_directives.ts index 5b12520b35..4b5b5505ab 100644 --- a/modules/@angular/common/src/common_directives.ts +++ b/modules/@angular/common/src/common_directives.ts @@ -1,5 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; - +import {Type} from '@angular/core'; import {FORM_DIRECTIVES} from './forms'; import {CORE_DIRECTIVES} from './directives'; @@ -17,7 +16,7 @@ import {CORE_DIRECTIVES} from './directives'; * * ```typescript * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault, NgModel, NgForm} from - * 'angular2/common'; + * '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ @@ -33,7 +32,7 @@ import {CORE_DIRECTIVES} from './directives'; * one could import all the common directives at once: * * ```typescript - * import {COMMON_DIRECTIVES} from 'angular2/common'; + * import {COMMON_DIRECTIVES} from '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ diff --git a/modules/@angular/common/src/directives/core_directives.ts b/modules/@angular/common/src/directives/core_directives.ts index ee4c83a349..3cc397897b 100644 --- a/modules/@angular/common/src/directives/core_directives.ts +++ b/modules/@angular/common/src/directives/core_directives.ts @@ -1,4 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '../../src/facade/lang'; import {NgClass} from './ng_class'; import {NgFor} from './ng_for'; import {NgIf} from './ng_if'; @@ -19,7 +19,7 @@ import {NgPlural, NgPluralCase} from './ng_plural'; * Instead of writing: * * ```typescript - * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/common'; + * import {NgClass, NgIf, NgFor, NgSwitch, NgSwitchWhen, NgSwitchDefault} from '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ @@ -34,7 +34,7 @@ import {NgPlural, NgPluralCase} from './ng_plural'; * one could import all the core directives at once: * * ```typescript - * import {CORE_DIRECTIVES} from 'angular2/common'; + * import {CORE_DIRECTIVES} from '@angular/common'; * import {OtherDirective} from './myDirectives'; * * @Component({ diff --git a/modules/@angular/common/src/directives/ng_class.ts b/modules/@angular/common/src/directives/ng_class.ts index 0b997a8a88..d6bda4e6c9 100644 --- a/modules/@angular/common/src/directives/ng_class.ts +++ b/modules/@angular/common/src/directives/ng_class.ts @@ -1,4 +1,3 @@ -import {isPresent, isString, isArray} from 'angular2/src/facade/lang'; import { DoCheck, OnDestroy, @@ -11,8 +10,9 @@ import { KeyValueDiffer, CollectionChangeRecord, KeyValueChangeRecord -} from 'angular2/core'; -import {StringMapWrapper, isListLikeIterable} from 'angular2/src/facade/collection'; +} from '@angular/core'; +import {isPresent, isString, isArray} from '../../src/facade/lang'; +import {StringMapWrapper, isListLikeIterable} from '../../src/facade/collection'; /** * The `NgClass` directive conditionally adds and removes CSS classes on an HTML element based on @@ -33,8 +33,8 @@ import {StringMapWrapper, isListLikeIterable} from 'angular2/src/facade/collecti * ### Example ([live demo](http://plnkr.co/edit/a4YdtmWywhJ33uqfpPPn?p=preview)): * * ``` - * import {Component} from 'angular2/core'; - * import {NgClass} from 'angular2/common'; + * import {Component} from '@angular/core'; + * import {NgClass} from '@angular/common'; * * @Component({ * selector: 'toggle-button', diff --git a/modules/@angular/common/src/directives/ng_for.ts b/modules/@angular/common/src/directives/ng_for.ts index 18d2074b73..5474831688 100644 --- a/modules/@angular/common/src/directives/ng_for.ts +++ b/modules/@angular/common/src/directives/ng_for.ts @@ -7,14 +7,12 @@ import { ViewContainerRef, TemplateRef, EmbeddedViewRef, - TrackByFn -} from 'angular2/core'; -import {isPresent, isBlank, stringify, getTypeNameForDebugging} from 'angular2/src/facade/lang'; -import { + TrackByFn, DefaultIterableDiffer, CollectionChangeRecord -} from "../../core/change_detection/differs/default_iterable_differ"; -import {BaseException} from "../../facade/exceptions"; +} from '@angular/core'; +import {isPresent, isBlank, getTypeNameForDebugging} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; export class NgForRow { constructor(public $implicit: any, public index: number, public count: number) {} diff --git a/modules/@angular/common/src/directives/ng_if.ts b/modules/@angular/common/src/directives/ng_if.ts index 8ff804ba3a..a3b6ecb488 100644 --- a/modules/@angular/common/src/directives/ng_if.ts +++ b/modules/@angular/common/src/directives/ng_if.ts @@ -1,5 +1,5 @@ -import {Directive, ViewContainerRef, TemplateRef} from 'angular2/core'; -import {isBlank} from 'angular2/src/facade/lang'; +import {Directive, ViewContainerRef, TemplateRef} from '@angular/core'; +import {isBlank} from '../../src/facade/lang'; /** * Removes or recreates a portion of the DOM tree based on an {expression}. diff --git a/modules/@angular/common/src/directives/ng_plural.ts b/modules/@angular/common/src/directives/ng_plural.ts index 4326f480f4..ed79280e95 100644 --- a/modules/@angular/common/src/directives/ng_plural.ts +++ b/modules/@angular/common/src/directives/ng_plural.ts @@ -7,9 +7,10 @@ import { Attribute, AfterContentInit, Input -} from 'angular2/core'; -import {isPresent, NumberWrapper} from 'angular2/src/facade/lang'; -import {Map} from 'angular2/src/facade/collection'; +} from '@angular/core'; +import {isPresent, NumberWrapper} from '../../src/facade/lang'; +import {Map} from '../../src/facade/collection'; + import {SwitchView} from './ng_switch'; const _CATEGORY_DEFAULT = 'other'; diff --git a/modules/@angular/common/src/directives/ng_style.ts b/modules/@angular/common/src/directives/ng_style.ts index 3b5824277f..88f1c6f957 100644 --- a/modules/@angular/common/src/directives/ng_style.ts +++ b/modules/@angular/common/src/directives/ng_style.ts @@ -1,3 +1,4 @@ +import {KeyValueChangeRecord} from '@angular/core'; import { DoCheck, KeyValueDiffer, @@ -5,9 +6,8 @@ import { ElementRef, Directive, Renderer -} from 'angular2/core'; -import {isPresent, isBlank, print} from 'angular2/src/facade/lang'; -import {KeyValueChangeRecord} from "../../core/change_detection/differs/default_keyvalue_differ"; +} from '@angular/core'; +import {isPresent, isBlank} from '../../src/facade/lang'; /** * The `NgStyle` directive changes styles based on a result of expression evaluation. @@ -24,8 +24,8 @@ import {KeyValueChangeRecord} from "../../core/change_detection/differs/default_ * ### Example ([live demo](http://plnkr.co/edit/YamGS6GkUh9GqWNQhCyM?p=preview)): * * ``` - * import {Component} from 'angular2/core'; - * import {NgStyle} from 'angular2/common'; + * import {Component} from '@angular/core'; + * import {NgStyle} from '@angular/common'; * * @Component({ * selector: 'ngStyle-example', diff --git a/modules/@angular/common/src/directives/ng_switch.ts b/modules/@angular/common/src/directives/ng_switch.ts index 74db4ab2cf..b8893144e2 100644 --- a/modules/@angular/common/src/directives/ng_switch.ts +++ b/modules/@angular/common/src/directives/ng_switch.ts @@ -1,6 +1,6 @@ -import {Directive, Host, ViewContainerRef, TemplateRef} from 'angular2/core'; -import {isPresent, isBlank, normalizeBlank} from 'angular2/src/facade/lang'; -import {ListWrapper, Map} from 'angular2/src/facade/collection'; +import {Directive, Host, ViewContainerRef, TemplateRef} from '@angular/core'; +import {isPresent, isBlank, normalizeBlank} from '../../src/facade/lang'; +import {ListWrapper, Map} from '../../src/facade/collection'; const _WHEN_DEFAULT = /*@ts2dart_const*/ new Object(); diff --git a/modules/@angular/common/src/directives/ng_template_outlet.ts b/modules/@angular/common/src/directives/ng_template_outlet.ts index e8810f1a47..b34ff8d610 100644 --- a/modules/@angular/common/src/directives/ng_template_outlet.ts +++ b/modules/@angular/common/src/directives/ng_template_outlet.ts @@ -1,5 +1,5 @@ -import {Directive, Input, ViewContainerRef, ViewRef, TemplateRef} from 'angular2/core'; -import {isPresent} from 'angular2/src/facade/lang'; +import {Directive, Input, ViewContainerRef, ViewRef, TemplateRef} from '@angular/core'; +import {isPresent} from '../../src/facade/lang'; /** * Creates and inserts an embedded view based on a prepared `TemplateRef`. diff --git a/modules/@angular/common/src/directives/observable_list_diff.ts b/modules/@angular/common/src/directives/observable_list_diff.ts index ee99cf4047..cbc7df8772 100644 --- a/modules/@angular/common/src/directives/observable_list_diff.ts +++ b/modules/@angular/common/src/directives/observable_list_diff.ts @@ -1,7 +1,7 @@ // TS does not have Observables // I need to be here to make TypeScript think this is a module. -import {} from 'angular2/src/facade/lang'; +import {} from '../../src/facade/lang'; /** * This module exists in Dart, but not in Typescript. This exported symbol diff --git a/modules/@angular/common/src/facade b/modules/@angular/common/src/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/common/src/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/common/src/forms.ts b/modules/@angular/common/src/forms.ts index 2d17fc37ef..9fa986387f 100644 --- a/modules/@angular/common/src/forms.ts +++ b/modules/@angular/common/src/forms.ts @@ -7,9 +7,7 @@ * to read information * from the form DOM elements. * - * This module is not included in the `angular2` module; you must import the forms module - * explicitly. - * + * Forms providers are not included in default providers; you must import these providers explicitly. */ export {AbstractControl, Control, ControlGroup, ControlArray} from './forms/model'; @@ -43,7 +41,7 @@ export { export {FormBuilder} from './forms/form_builder'; import {FormBuilder} from './forms/form_builder'; import {RadioControlRegistry} from './forms/directives/radio_control_value_accessor'; -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '@angular/core'; /** * Shorthand set of providers used for building Angular forms. diff --git a/modules/@angular/common/src/forms/directives.ts b/modules/@angular/common/src/forms/directives.ts index 4e0463dae1..f1b67e0b76 100644 --- a/modules/@angular/common/src/forms/directives.ts +++ b/modules/@angular/common/src/forms/directives.ts @@ -1,4 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '@angular/core'; import {NgControlName} from './directives/ng_control_name'; import {NgFormControl} from './directives/ng_form_control'; import {NgModel} from './directives/ng_model'; diff --git a/modules/@angular/common/src/forms/directives/abstract_control_directive.ts b/modules/@angular/common/src/forms/directives/abstract_control_directive.ts index a31a05ed11..52c221e9f1 100644 --- a/modules/@angular/common/src/forms/directives/abstract_control_directive.ts +++ b/modules/@angular/common/src/forms/directives/abstract_control_directive.ts @@ -1,6 +1,6 @@ import {AbstractControl} from '../model'; -import {isPresent} from 'angular2/src/facade/lang'; -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {isPresent} from '../../../src/facade/lang'; +import {unimplemented} from '../../../src/facade/exceptions'; /** * Base class for control directives. diff --git a/modules/@angular/common/src/forms/directives/checkbox_value_accessor.ts b/modules/@angular/common/src/forms/directives/checkbox_value_accessor.ts index 22c167e482..b342f56209 100644 --- a/modules/@angular/common/src/forms/directives/checkbox_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/checkbox_value_accessor.ts @@ -1,5 +1,4 @@ -import {Directive, Renderer, ElementRef, Self, forwardRef, Provider} from 'angular2/core'; - +import {Directive, Renderer, ElementRef, Self, forwardRef, Provider} from '@angular/core'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; export const CHECKBOX_VALUE_ACCESSOR: any = /*@ts2dart_const*/ { diff --git a/modules/@angular/common/src/forms/directives/control_value_accessor.ts b/modules/@angular/common/src/forms/directives/control_value_accessor.ts index 76482248a6..de7c114590 100644 --- a/modules/@angular/common/src/forms/directives/control_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/control_value_accessor.ts @@ -1,4 +1,4 @@ -import {OpaqueToken} from 'angular2/core'; +import {OpaqueToken} from '@angular/core'; /** * A bridge between a control and a native element. diff --git a/modules/@angular/common/src/forms/directives/default_value_accessor.ts b/modules/@angular/common/src/forms/directives/default_value_accessor.ts index 83514299a3..7c64fe28e8 100644 --- a/modules/@angular/common/src/forms/directives/default_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/default_value_accessor.ts @@ -1,6 +1,6 @@ -import {Directive, ElementRef, Renderer, Self, forwardRef, Provider} from 'angular2/core'; +import {Directive, ElementRef, Renderer, forwardRef} from '@angular/core'; +import {isBlank} from '../../../src/facade/lang'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; -import {isBlank} from 'angular2/src/facade/lang'; export const DEFAULT_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /* @ts2dart_Provider */ { diff --git a/modules/@angular/common/src/forms/directives/form_interface.ts b/modules/@angular/common/src/forms/directives/form_interface.ts index 7e3f04651c..70aded2bb8 100644 --- a/modules/@angular/common/src/forms/directives/form_interface.ts +++ b/modules/@angular/common/src/forms/directives/form_interface.ts @@ -42,4 +42,4 @@ export interface Form { * Update the model for a particular control with a new value. */ updateModel(dir: NgControl, value: any): void; -} \ No newline at end of file +} diff --git a/modules/@angular/common/src/forms/directives/ng_control.ts b/modules/@angular/common/src/forms/directives/ng_control.ts index 565e13561b..5cbe83e79b 100644 --- a/modules/@angular/common/src/forms/directives/ng_control.ts +++ b/modules/@angular/common/src/forms/directives/ng_control.ts @@ -1,6 +1,7 @@ +import {unimplemented} from '../../../src/facade/exceptions'; + import {ControlValueAccessor} from './control_value_accessor'; import {AbstractControlDirective} from './abstract_control_directive'; -import {unimplemented} from 'angular2/src/facade/exceptions'; import {AsyncValidatorFn, ValidatorFn} from './validators'; /** diff --git a/modules/@angular/common/src/forms/directives/ng_control_group.ts b/modules/@angular/common/src/forms/directives/ng_control_group.ts index 2a1ca6d216..add096b835 100644 --- a/modules/@angular/common/src/forms/directives/ng_control_group.ts +++ b/modules/@angular/common/src/forms/directives/ng_control_group.ts @@ -9,8 +9,7 @@ import { forwardRef, Provider, Self -} from 'angular2/core'; - +} from '@angular/core'; import {ControlContainer} from './control_container'; import {controlPath, composeValidators, composeAsyncValidators} from './shared'; import {ControlGroup} from '../model'; @@ -37,7 +36,7 @@ export const controlGroupProvider: any = * directives: [FORM_DIRECTIVES], * template: ` *
- *

Angular2 Control & ControlGroup Example

+ *

Angular Control & ControlGroup Example

*
*
*

Enter your name:

diff --git a/modules/@angular/common/src/forms/directives/ng_control_name.ts b/modules/@angular/common/src/forms/directives/ng_control_name.ts index 5217375cd8..c702ba5e15 100644 --- a/modules/@angular/common/src/forms/directives/ng_control_name.ts +++ b/modules/@angular/common/src/forms/directives/ng_control_name.ts @@ -1,5 +1,3 @@ -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; - import { OnChanges, OnDestroy, @@ -13,8 +11,9 @@ import { Inject, Optional, Self -} from 'angular2/core'; +} from '@angular/core'; +import {EventEmitter, ObservableWrapper} from '../../../src/facade/async'; import {ControlContainer} from './control_container'; import {NgControl} from './ng_control'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor'; diff --git a/modules/@angular/common/src/forms/directives/ng_control_status.ts b/modules/@angular/common/src/forms/directives/ng_control_status.ts index 38b7ccdabb..43761e4ca4 100644 --- a/modules/@angular/common/src/forms/directives/ng_control_status.ts +++ b/modules/@angular/common/src/forms/directives/ng_control_status.ts @@ -1,6 +1,6 @@ -import {Directive, Self} from 'angular2/core'; +import {Directive, Self} from '@angular/core'; import {NgControl} from './ng_control'; -import {isBlank, isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../../../src/facade/lang'; /** * Directive automatically applied to Angular forms that sets CSS classes diff --git a/modules/@angular/common/src/forms/directives/ng_form.ts b/modules/@angular/common/src/forms/directives/ng_form.ts index 9efbff5f3b..10fe323e3e 100644 --- a/modules/@angular/common/src/forms/directives/ng_form.ts +++ b/modules/@angular/common/src/forms/directives/ng_form.ts @@ -1,25 +1,22 @@ +import {Directive, forwardRef, Provider, Optional, Inject, Self} from '@angular/core'; import { PromiseWrapper, ObservableWrapper, EventEmitter, PromiseCompleter -} from 'angular2/src/facade/async'; -import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {Directive, forwardRef, Provider, Optional, Inject, Self} from 'angular2/core'; +} from '../../../src/facade/async'; +import {ListWrapper} from '../../../src/facade/collection'; +import {isPresent} from '../../../src/facade/lang'; import {NgControl} from './ng_control'; import {Form} from './form_interface'; import {NgControlGroup} from './ng_control_group'; import {ControlContainer} from './control_container'; import {AbstractControl, ControlGroup, Control} from '../model'; import {setUpControl, setUpControlGroup, composeValidators, composeAsyncValidators} from './shared'; -import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; +import {NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; export const formDirectiveProvider: any = - /*@ts2dart_const*/ /* @ts2dart_Provider */ { - provide: ControlContainer, - useExisting: forwardRef(() => NgForm) - }; + /*@ts2dart_const*/ {provide: ControlContainer, useExisting: forwardRef(() => NgForm)}; /** * If `NgForm` is bound in a component, `` elements in that component will be diff --git a/modules/@angular/common/src/forms/directives/ng_form_control.ts b/modules/@angular/common/src/forms/directives/ng_form_control.ts index d54119f456..1930561011 100644 --- a/modules/@angular/common/src/forms/directives/ng_form_control.ts +++ b/modules/@angular/common/src/forms/directives/ng_form_control.ts @@ -1,5 +1,3 @@ -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; import { OnChanges, SimpleChange, @@ -10,10 +8,14 @@ import { Inject, Optional, Self -} from 'angular2/core'; +} from '@angular/core'; + +import {StringMapWrapper} from '../../../src/facade/collection'; +import {EventEmitter, ObservableWrapper} from '../../../src/facade/async'; + import {NgControl} from './ng_control'; import {Control} from '../model'; -import {Validators, NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; +import {NG_VALIDATORS, NG_ASYNC_VALIDATORS} from '../validators'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor'; import { setUpControl, diff --git a/modules/@angular/common/src/forms/directives/ng_form_model.ts b/modules/@angular/common/src/forms/directives/ng_form_model.ts index 82c5bab8c5..ba41ff355a 100644 --- a/modules/@angular/common/src/forms/directives/ng_form_model.ts +++ b/modules/@angular/common/src/forms/directives/ng_form_model.ts @@ -1,7 +1,3 @@ -import {isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async'; import { SimpleChange, OnChanges, @@ -11,7 +7,11 @@ import { Inject, Optional, Self -} from 'angular2/core'; +} from '@angular/core'; +import {isBlank} from '../../../src/facade/lang'; +import {ListWrapper, StringMapWrapper} from '../../../src/facade/collection'; +import {BaseException} from '../../../src/facade/exceptions'; +import {ObservableWrapper, EventEmitter} from '../../../src/facade/async'; import {NgControl} from './ng_control'; import {NgControlGroup} from './ng_control_group'; import {ControlContainer} from './control_container'; diff --git a/modules/@angular/common/src/forms/directives/ng_model.ts b/modules/@angular/common/src/forms/directives/ng_model.ts index 9ac04d3f67..e56d907b2b 100644 --- a/modules/@angular/common/src/forms/directives/ng_model.ts +++ b/modules/@angular/common/src/forms/directives/ng_model.ts @@ -1,4 +1,3 @@ -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; import { OnChanges, SimpleChange, @@ -8,7 +7,8 @@ import { Inject, Optional, Self -} from 'angular2/core'; +} from '@angular/core'; +import {EventEmitter, ObservableWrapper} from '../../../src/facade/async'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from './control_value_accessor'; import {NgControl} from './ng_control'; import {Control} from '../model'; diff --git a/modules/@angular/common/src/forms/directives/normalize_validator.ts b/modules/@angular/common/src/forms/directives/normalize_validator.ts index 85e2ebdfbb..c956c8d4ae 100644 --- a/modules/@angular/common/src/forms/directives/normalize_validator.ts +++ b/modules/@angular/common/src/forms/directives/normalize_validator.ts @@ -1,4 +1,4 @@ -import {AbstractControl} from "../model"; +import {AbstractControl} from '../model'; import {Validator, ValidatorFn, AsyncValidatorFn} from './validators'; export function normalizeValidator(validator: ValidatorFn | Validator): ValidatorFn { diff --git a/modules/@angular/common/src/forms/directives/number_value_accessor.ts b/modules/@angular/common/src/forms/directives/number_value_accessor.ts index 67f02f5795..16762c00c4 100644 --- a/modules/@angular/common/src/forms/directives/number_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/number_value_accessor.ts @@ -1,6 +1,6 @@ -import {Directive, ElementRef, Renderer, Self, forwardRef} from 'angular2/core'; +import {Directive, ElementRef, Renderer, Self, forwardRef, Provider} from '@angular/core'; +import {NumberWrapper} from '../../../src/facade/lang'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; -import {isBlank, NumberWrapper} from 'angular2/src/facade/lang'; export const NUMBER_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ { provide: NG_VALUE_ACCESSOR, diff --git a/modules/@angular/common/src/forms/directives/radio_control_value_accessor.ts b/modules/@angular/common/src/forms/directives/radio_control_value_accessor.ts index 6f549259b3..1df2ded4b7 100644 --- a/modules/@angular/common/src/forms/directives/radio_control_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/radio_control_value_accessor.ts @@ -2,23 +2,21 @@ import { Directive, ElementRef, Renderer, - Self, forwardRef, Provider, - Attribute, Input, OnInit, OnDestroy, Injector, Injectable -} from 'angular2/core'; +} from '@angular/core'; +import {isPresent} from '../../../src/facade/lang'; +import {ListWrapper} from '../../../src/facade/collection'; import { NG_VALUE_ACCESSOR, ControlValueAccessor -} from 'angular2/src/common/forms/directives/control_value_accessor'; -import {NgControl} from 'angular2/src/common/forms/directives/ng_control'; -import {looseIdentical, isPresent} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +} from './control_value_accessor'; +import {NgControl} from './ng_control'; export const RADIO_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ { provide: NG_VALUE_ACCESSOR, diff --git a/modules/@angular/common/src/forms/directives/select_control_value_accessor.ts b/modules/@angular/common/src/forms/directives/select_control_value_accessor.ts index ec29c0035a..0c9fdabe42 100644 --- a/modules/@angular/common/src/forms/directives/select_control_value_accessor.ts +++ b/modules/@angular/common/src/forms/directives/select_control_value_accessor.ts @@ -8,17 +8,17 @@ import { Host, OnDestroy, Optional -} from 'angular2/core'; -import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; +} from '@angular/core'; import { StringWrapper, isPrimitive, isPresent, isBlank, looseIdentical -} from 'angular2/src/facade/lang'; +} from '../../../src/facade/lang'; +import {MapWrapper} from '../../../src/facade/collection'; -import {MapWrapper} from 'angular2/src/facade/collection'; +import {NG_VALUE_ACCESSOR, ControlValueAccessor} from './control_value_accessor'; export const SELECT_VALUE_ACCESSOR: any = /*@ts2dart_const*/ /*@ts2dart_Provider*/ { provide: NG_VALUE_ACCESSOR, diff --git a/modules/@angular/common/src/forms/directives/shared.ts b/modules/@angular/common/src/forms/directives/shared.ts index d4b776dd4c..6af4c48a01 100644 --- a/modules/@angular/common/src/forms/directives/shared.ts +++ b/modules/@angular/common/src/forms/directives/shared.ts @@ -1,6 +1,6 @@ -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {isBlank, isPresent, looseIdentical, hasConstructor} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +import {ListWrapper, StringMapWrapper} from '../../../src/facade/collection'; +import {isBlank, isPresent, looseIdentical, hasConstructor} from '../../../src/facade/lang'; +import {BaseException} from '../../../src/facade/exceptions'; import {ControlContainer} from './control_container'; import {NgControl} from './ng_control'; diff --git a/modules/@angular/common/src/forms/directives/validators.ts b/modules/@angular/common/src/forms/directives/validators.ts index 1c6ba4d9a9..ded3f1b961 100644 --- a/modules/@angular/common/src/forms/directives/validators.ts +++ b/modules/@angular/common/src/forms/directives/validators.ts @@ -1,5 +1,5 @@ -import {forwardRef, Attribute, Directive} from 'angular2/core'; -import {NumberWrapper} from 'angular2/src/facade/lang'; +import {forwardRef, Attribute, Directive} from '@angular/core'; +import {NumberWrapper} from '../../facade/lang'; import {Validators, NG_VALIDATORS} from '../validators'; import {AbstractControl} from '../model'; import * as modelModule from '../model'; diff --git a/modules/@angular/common/src/forms/form_builder.ts b/modules/@angular/common/src/forms/form_builder.ts index d34ebda883..1a2bc938e8 100644 --- a/modules/@angular/common/src/forms/form_builder.ts +++ b/modules/@angular/common/src/forms/form_builder.ts @@ -1,6 +1,6 @@ -import {Injectable} from 'angular2/core'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {isPresent, isArray, Type} from 'angular2/src/facade/lang'; +import {Injectable} from '@angular/core'; +import {StringMapWrapper} from '../../src/facade/collection'; +import {isPresent, isArray} from '../../src/facade/lang'; import * as modelModule from './model'; import {ValidatorFn, AsyncValidatorFn} from './directives/validators'; diff --git a/modules/@angular/common/src/forms/model.ts b/modules/@angular/common/src/forms/model.ts index 5e032223ee..ca04c4c0ce 100644 --- a/modules/@angular/common/src/forms/model.ts +++ b/modules/@angular/common/src/forms/model.ts @@ -1,7 +1,7 @@ -import {isPresent, isBlank, normalizeBool} from 'angular2/src/facade/lang'; -import {Observable, EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; -import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection'; +import {isPresent, isBlank, normalizeBool} from '../../src/facade/lang'; +import {Observable, EventEmitter, ObservableWrapper} from '../../src/facade/async'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {StringMapWrapper, ListWrapper} from '../../src/facade/collection'; import {ValidatorFn, AsyncValidatorFn} from './directives/validators'; /** diff --git a/modules/@angular/common/src/forms/validators.ts b/modules/@angular/common/src/forms/validators.ts index 43a6e9a817..5498617acc 100644 --- a/modules/@angular/common/src/forms/validators.ts +++ b/modules/@angular/common/src/forms/validators.ts @@ -1,9 +1,9 @@ -import {isBlank, isPresent, isString} from 'angular2/src/facade/lang'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; -import {ObservableWrapper} from 'angular2/src/facade/async'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {OpaqueToken} from 'angular2/core'; +import {OpaqueToken} from '@angular/core'; +import {isBlank, isPresent, isString} from '../../src/facade/lang'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {ObservableWrapper} from '../../src/facade/async'; +import {StringMapWrapper} from '../../src/facade/collection'; import * as modelModule from './model'; import {ValidatorFn, AsyncValidatorFn} from './directives/validators'; diff --git a/modules/@angular/common/src/location.ts b/modules/@angular/common/src/location.ts index 947856be74..0c3e8fa5b3 100644 --- a/modules/@angular/common/src/location.ts +++ b/modules/@angular/common/src/location.ts @@ -1,5 +1,5 @@ -export * from './browser/location/platform_location'; -export * from './browser/location/location_strategy'; -export * from './browser/location/hash_location_strategy'; -export * from './browser/location/path_location_strategy'; -export * from './browser/location/location'; +export * from './location/platform_location'; +export * from './location/location_strategy'; +export * from './location/hash_location_strategy'; +export * from './location/path_location_strategy'; +export * from './location/location'; diff --git a/modules/@angular/common/src/location/hash_location_strategy.ts b/modules/@angular/common/src/location/hash_location_strategy.ts index 0f1fccd994..7ee09e2e0f 100644 --- a/modules/@angular/common/src/location/hash_location_strategy.ts +++ b/modules/@angular/common/src/location/hash_location_strategy.ts @@ -1,8 +1,10 @@ -import {Injectable, Inject, Optional} from 'angular2/core'; +import {Injectable, Inject, Optional} from '@angular/core'; +import {isPresent} from '../../src/facade/lang'; + import {LocationStrategy, APP_BASE_HREF} from './location_strategy'; import {Location} from './location'; import {UrlChangeListener, PlatformLocation} from './platform_location'; -import {isPresent} from 'angular2/src/facade/lang'; + /** * `HashLocationStrategy` is a {@link LocationStrategy} used to configure the @@ -16,17 +18,17 @@ import {isPresent} from 'angular2/src/facade/lang'; * ### Example * * ``` - * import {Component, provide} from 'angular2/core'; + * import {Component, provide} from '@angular/core'; * import { * Location, * LocationStrategy, * HashLocationStrategy - * } from 'angular2/platform/common'; + * } from '@angular/common'; * import { * ROUTER_DIRECTIVES, * ROUTER_PROVIDERS, * RouteConfig - * } from 'angular2/router'; + * } from '@angular/router'; * * @Component({directives: [ROUTER_DIRECTIVES]}) * @RouteConfig([ diff --git a/modules/@angular/common/src/location/location.ts b/modules/@angular/common/src/location/location.ts index ef4254be27..6997356d94 100644 --- a/modules/@angular/common/src/location/location.ts +++ b/modules/@angular/common/src/location/location.ts @@ -1,5 +1,6 @@ -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; -import {Injectable, Inject} from 'angular2/core'; +import {Injectable, Inject} from '@angular/core'; +import {EventEmitter, ObservableWrapper} from '../../src/facade/async'; + import {LocationStrategy} from './location_strategy'; /** @@ -21,13 +22,13 @@ import {LocationStrategy} from './location_strategy'; * ### Example * * ``` - * import {Component} from 'angular2/core'; - * import {Location} from 'angular2/platform/common'; + * import {Component} from '@angular/core'; + * import {Location} from '@angular/common'; * import { * ROUTER_DIRECTIVES, * ROUTER_PROVIDERS, * RouteConfig - * } from 'angular2/router'; + * } from '@angular/router'; * * @Component({directives: [ROUTER_DIRECTIVES]}) * @RouteConfig([ diff --git a/modules/@angular/common/src/location/location_strategy.ts b/modules/@angular/common/src/location/location_strategy.ts index 0079000ac6..03db6278ec 100644 --- a/modules/@angular/common/src/location/location_strategy.ts +++ b/modules/@angular/common/src/location/location_strategy.ts @@ -1,4 +1,4 @@ -import {OpaqueToken} from 'angular2/core'; +import {OpaqueToken} from '@angular/core'; import {UrlChangeListener} from './platform_location'; /** @@ -40,9 +40,9 @@ export abstract class LocationStrategy { * ### Example * * ``` - * import {Component} from 'angular2/core'; - * import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router'; - * import {APP_BASE_HREF} from 'angular2/platform/common'; + * import {Component} from '@angular/core'; + * import {ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from '@angular/router'; + * import {APP_BASE_HREF} from '@angular/common'; * * @Component({directives: [ROUTER_DIRECTIVES]}) * @RouteConfig([ diff --git a/modules/@angular/common/src/location/path_location_strategy.ts b/modules/@angular/common/src/location/path_location_strategy.ts index e5d953a045..f58968d01a 100644 --- a/modules/@angular/common/src/location/path_location_strategy.ts +++ b/modules/@angular/common/src/location/path_location_strategy.ts @@ -1,6 +1,7 @@ -import {Injectable, Inject, Optional} from 'angular2/core'; -import {isBlank} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {Injectable, Inject, Optional} from '@angular/core'; +import {isBlank} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; + import {PlatformLocation, UrlChangeListener} from './platform_location'; import {LocationStrategy, APP_BASE_HREF} from './location_strategy'; import {Location} from './location'; @@ -25,17 +26,17 @@ import {Location} from './location'; * ### Example * * ``` - * import {Component, provide} from 'angular2/core'; - * import {bootstrap} from 'angular2/platform/browser'; + * import {Component, provide} from '@angular/core'; + * import {bootstrap} from '@angular/platform-browser/browser'; * import { * Location, * APP_BASE_HREF - * } from 'angular2/platform/common'; + * } from '@angular/common'; * import { * ROUTER_DIRECTIVES, * ROUTER_PROVIDERS, * RouteConfig - * } from 'angular2/router'; + * } from '@angular/router'; * * @Component({directives: [ROUTER_DIRECTIVES]}) * @RouteConfig([ diff --git a/modules/@angular/common/src/pipes/async_pipe.ts b/modules/@angular/common/src/pipes/async_pipe.ts index 1aa6502ac3..1fff610ff6 100644 --- a/modules/@angular/common/src/pipes/async_pipe.ts +++ b/modules/@angular/common/src/pipes/async_pipe.ts @@ -1,6 +1,13 @@ -import {isBlank, isPresent, isPromise} from 'angular2/src/facade/lang'; -import {ObservableWrapper, Observable, EventEmitter} from 'angular2/src/facade/async'; -import {Pipe, Injectable, ChangeDetectorRef, OnDestroy, WrappedValue} from 'angular2/core'; +import { + Pipe, + Injectable, + ChangeDetectorRef, + OnDestroy, + WrappedValue +} from '@angular/core'; + +import {isBlank, isPresent, isPromise} from '../../src/facade/lang'; +import {ObservableWrapper, Observable, EventEmitter} from '../../src/facade/async'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; diff --git a/modules/@angular/common/src/pipes/date_pipe.ts b/modules/@angular/common/src/pipes/date_pipe.ts index 3439d51814..8e0f3d8376 100644 --- a/modules/@angular/common/src/pipes/date_pipe.ts +++ b/modules/@angular/common/src/pipes/date_pipe.ts @@ -1,15 +1,12 @@ +import {PipeTransform, Pipe, Injectable} from '@angular/core'; import { isDate, isNumber, - isPresent, - Date, DateWrapper, isBlank, - FunctionWrapper -} from 'angular2/src/facade/lang'; -import {DateFormatter} from 'angular2/src/facade/intl'; -import {PipeTransform, WrappedValue, Pipe, Injectable} from 'angular2/core'; -import {StringMapWrapper, ListWrapper} from 'angular2/src/facade/collection'; +} from '../../src/facade/lang'; +import {DateFormatter} from '../../src/facade/intl'; +import {StringMapWrapper} from '../../src/facade/collection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; diff --git a/modules/@angular/common/src/pipes/i18n_plural_pipe.ts b/modules/@angular/common/src/pipes/i18n_plural_pipe.ts index 4debe7f2cb..69475c6591 100644 --- a/modules/@angular/common/src/pipes/i18n_plural_pipe.ts +++ b/modules/@angular/common/src/pipes/i18n_plural_pipe.ts @@ -1,5 +1,10 @@ -import {isStringMap, StringWrapper, isPresent, RegExpWrapper} from 'angular2/src/facade/lang'; -import {Injectable, PipeTransform, Pipe} from 'angular2/core'; +import {Injectable, PipeTransform, Pipe} from '@angular/core'; +import { + isStringMap, + StringWrapper, + isPresent, + RegExpWrapper +} from '../../src/facade/lang'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; var interpolationExp: RegExp = RegExpWrapper.create('#'); diff --git a/modules/@angular/common/src/pipes/i18n_select_pipe.ts b/modules/@angular/common/src/pipes/i18n_select_pipe.ts index 7afce9b797..5ff6925789 100644 --- a/modules/@angular/common/src/pipes/i18n_select_pipe.ts +++ b/modules/@angular/common/src/pipes/i18n_select_pipe.ts @@ -1,6 +1,6 @@ -import {isStringMap} from 'angular2/src/facade/lang'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {Injectable, PipeTransform, Pipe} from 'angular2/core'; +import {Injectable, PipeTransform, Pipe} from '@angular/core'; +import {isStringMap} from '../../src/facade/lang'; +import {StringMapWrapper} from '../../src/facade/collection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; /** diff --git a/modules/@angular/common/src/pipes/invalid_pipe_argument_exception.ts b/modules/@angular/common/src/pipes/invalid_pipe_argument_exception.ts index 76a16ee1ef..5271a84eaf 100644 --- a/modules/@angular/common/src/pipes/invalid_pipe_argument_exception.ts +++ b/modules/@angular/common/src/pipes/invalid_pipe_argument_exception.ts @@ -1,5 +1,5 @@ -import {Type, stringify} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +import {Type, stringify} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; export class InvalidPipeArgumentException extends BaseException { constructor(type: Type, value: Object) { diff --git a/modules/@angular/common/src/pipes/json_pipe.ts b/modules/@angular/common/src/pipes/json_pipe.ts index 4684355bae..c47dace1f7 100644 --- a/modules/@angular/common/src/pipes/json_pipe.ts +++ b/modules/@angular/common/src/pipes/json_pipe.ts @@ -1,5 +1,6 @@ -import {isBlank, isPresent, Json} from 'angular2/src/facade/lang'; -import {Injectable, PipeTransform, WrappedValue, Pipe} from 'angular2/core'; +import {Injectable, PipeTransform, WrappedValue, Pipe} from '@angular/core'; +import {Json} from '../../src/facade/lang'; + /** * Transforms any input value using `JSON.stringify`. Useful for debugging. diff --git a/modules/@angular/common/src/pipes/lowercase_pipe.ts b/modules/@angular/common/src/pipes/lowercase_pipe.ts index f3a1faffd7..0dfa4fbeb3 100644 --- a/modules/@angular/common/src/pipes/lowercase_pipe.ts +++ b/modules/@angular/common/src/pipes/lowercase_pipe.ts @@ -1,5 +1,5 @@ -import {isString, isBlank} from 'angular2/src/facade/lang'; -import {Injectable, PipeTransform, WrappedValue, Pipe} from 'angular2/core'; +import {Injectable, PipeTransform, WrappedValue, Pipe} from '@angular/core'; +import {isString, isBlank} from '../../src/facade/lang'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; /** @@ -9,6 +9,7 @@ import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; * * {@example core/pipes/ts/lowerupper_pipe/lowerupper_pipe_example.ts region='LowerUpperPipe'} */ +/* @ts2dart_const */ @Pipe({name: 'lowercase'}) @Injectable() export class LowerCasePipe implements PipeTransform { diff --git a/modules/@angular/common/src/pipes/number_pipe.ts b/modules/@angular/common/src/pipes/number_pipe.ts index 424562b596..a4b0aca547 100644 --- a/modules/@angular/common/src/pipes/number_pipe.ts +++ b/modules/@angular/common/src/pipes/number_pipe.ts @@ -1,15 +1,15 @@ +import {Injectable, PipeTransform, WrappedValue, Pipe} from '@angular/core'; + import { isNumber, isPresent, isBlank, - StringWrapper, NumberWrapper, RegExpWrapper, - FunctionWrapper -} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {NumberFormatter, NumberFormatStyle} from 'angular2/src/facade/intl'; -import {Injectable, PipeTransform, WrappedValue, Pipe} from 'angular2/core'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {NumberFormatter, NumberFormatStyle} from '../../src/facade/intl'; +import {ListWrapper} from '../../src/facade/collection'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; diff --git a/modules/@angular/common/src/pipes/replace_pipe.ts b/modules/@angular/common/src/pipes/replace_pipe.ts index bfc643b17f..e5ecd49faa 100644 --- a/modules/@angular/common/src/pipes/replace_pipe.ts +++ b/modules/@angular/common/src/pipes/replace_pipe.ts @@ -1,3 +1,5 @@ +import {Injectable, PipeTransform, Pipe} from '@angular/core'; + import { isBlank, isString, @@ -5,8 +7,8 @@ import { isFunction, RegExpWrapper, StringWrapper -} from 'angular2/src/facade/lang'; -import {Injectable, PipeTransform, Pipe} from 'angular2/core'; +} from '../../src/facade/lang'; + import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; /** diff --git a/modules/@angular/common/src/pipes/slice_pipe.ts b/modules/@angular/common/src/pipes/slice_pipe.ts index 4e87ae21e2..0401d40c00 100644 --- a/modules/@angular/common/src/pipes/slice_pipe.ts +++ b/modules/@angular/common/src/pipes/slice_pipe.ts @@ -1,6 +1,9 @@ -import {isBlank, isString, isArray, StringWrapper} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {Injectable, PipeTransform, WrappedValue, Pipe} from 'angular2/core'; +import {Injectable, PipeTransform, WrappedValue, Pipe} from '@angular/core'; + +import {isBlank, isString, isArray, StringWrapper} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {ListWrapper} from '../../src/facade/collection'; + import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; /** diff --git a/modules/@angular/common/src/pipes/uppercase_pipe.ts b/modules/@angular/common/src/pipes/uppercase_pipe.ts index 80cf4a322e..b937479a35 100644 --- a/modules/@angular/common/src/pipes/uppercase_pipe.ts +++ b/modules/@angular/common/src/pipes/uppercase_pipe.ts @@ -1,5 +1,5 @@ -import {isString, isBlank} from 'angular2/src/facade/lang'; -import {PipeTransform, WrappedValue, Injectable, Pipe} from 'angular2/core'; +import {PipeTransform, WrappedValue, Injectable, Pipe} from '@angular/core'; +import {isString, isBlank} from '../../src/facade/lang'; import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; /** diff --git a/modules/@angular/common/test/directives/ng_class_spec.ts b/modules/@angular/common/test/directives/ng_class_spec.ts index d112bc8199..0dfefbe0b7 100644 --- a/modules/@angular/common/test/directives/ng_class_spec.ts +++ b/modules/@angular/common/test/directives/ng_class_spec.ts @@ -1,23 +1,20 @@ import { - ComponentFixture, - AsyncTestCompleter, - TestComponentBuilder, beforeEach, beforeEachProviders, ddescribe, xdescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; -import {ListWrapper, StringMapWrapper, SetWrapper} from 'angular2/src/facade/collection'; -import {Component, provide} from 'angular2/core'; -import {NgFor} from 'angular2/common'; -import {NgClass} from 'angular2/src/common/directives/ng_class'; +} from '@angular/core/testing/testing_internal'; +import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {ListWrapper, StringMapWrapper, SetWrapper} from '../../src/facade/collection'; +import {Component, provide} from '@angular/core'; +import {NgFor, NgClass} from '@angular/common'; function detectChangesAndCheck(fixture: ComponentFixture, classes: string) { fixture.detectChanges(); diff --git a/modules/@angular/common/test/directives/ng_for_spec.ts b/modules/@angular/common/test/directives/ng_for_spec.ts index 89163d9aa1..fb37c4c522 100644 --- a/modules/@angular/common/test/directives/ng_for_spec.ts +++ b/modules/@angular/common/test/directives/ng_for_spec.ts @@ -1,24 +1,23 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, beforeEachProviders, ddescribe, describe, - el, - expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {expect} from '@angular/platform-browser/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {IS_DART} from 'angular2/src/facade/lang'; -import {Component, TemplateRef, ContentChild} from 'angular2/core'; -import {NgFor} from 'angular2/src/common/directives/ng_for'; -import {NgIf} from 'angular2/src/common/directives/ng_if'; -import {By} from 'angular2/platform/common_dom'; +import {ListWrapper} from '../../src/facade/collection'; +import {IS_DART} from '../../src/facade/lang'; +import {Component, TemplateRef, ContentChild} from '@angular/core'; +import {NgFor} from '@angular/common'; +import {NgIf} from '@angular/common'; +import {By} from '@angular/platform-browser/src/dom/debug/by'; export function main() { describe('ngFor', () => { diff --git a/modules/@angular/common/test/directives/ng_if_spec.ts b/modules/@angular/common/test/directives/ng_if_spec.ts index 921855dc5a..3ceb8b1fba 100644 --- a/modules/@angular/common/test/directives/ng_if_spec.ts +++ b/modules/@angular/common/test/directives/ng_if_spec.ts @@ -1,23 +1,22 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, - el, - expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {expect} from '@angular/platform-browser/testing'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; -import {Component} from 'angular2/core'; -import {NgIf} from 'angular2/common'; +import {Component} from '@angular/core'; +import {NgIf} from '@angular/common'; -import {IS_DART} from 'angular2/src/facade/lang'; +import {IS_DART} from '../../src/facade/lang'; export function main() { describe('ngIf directive', () => { @@ -29,7 +28,7 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); async.done(); @@ -45,7 +44,7 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello2'); async.done(); @@ -61,19 +60,19 @@ export function main() { .then((fixture) => { fixture.debugElement.componentInstance.booleanCondition = false; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); fixture.debugElement.componentInstance.booleanCondition = true; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); fixture.debugElement.componentInstance.booleanCondition = false; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); @@ -91,31 +90,31 @@ export function main() { .then((fixture) => { fixture.debugElement.componentInstance.booleanCondition = false; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); fixture.debugElement.componentInstance.booleanCondition = true; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); fixture.debugElement.componentInstance.nestedBooleanCondition = false; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); fixture.debugElement.componentInstance.nestedBooleanCondition = true; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); fixture.debugElement.componentInstance.booleanCondition = false; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); @@ -136,21 +135,21 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(3); - expect(DOM.getText(fixture.debugElement.nativeElement)) + expect(getDOM().getText(fixture.debugElement.nativeElement)) .toEqual('helloNumberhelloStringhelloFunction'); fixture.debugElement.componentInstance.numberCondition = 0; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('helloString'); fixture.debugElement.componentInstance.numberCondition = 1; fixture.debugElement.componentInstance.stringCondition = "bar"; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('helloNumber'); async.done(); @@ -167,13 +166,13 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); fixture.debugElement.componentInstance.numberCondition = 2; fixture.detectChanges(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(1); expect(fixture.debugElement.nativeElement).toHaveText('hello'); @@ -189,13 +188,13 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - DOM.addClass(DOM.querySelector(fixture.debugElement.nativeElement, 'copy-me'), + getDOM().addClass(getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'), "foo"); fixture.debugElement.componentInstance.numberCondition = 2; fixture.detectChanges(); expect( - DOM.hasClass(DOM.querySelector(fixture.debugElement.nativeElement, 'copy-me'), + getDOM().hasClass(getDOM().querySelector(fixture.debugElement.nativeElement, 'copy-me'), "foo")) .toBe(true); @@ -213,7 +212,7 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { expect(() => fixture.detectChanges()).toThrowError(); - expect(DOM.querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) + expect(getDOM().querySelectorAll(fixture.debugElement.nativeElement, 'copy-me').length) .toEqual(0); expect(fixture.debugElement.nativeElement).toHaveText(''); async.done(); diff --git a/modules/@angular/common/test/directives/ng_plural_spec.ts b/modules/@angular/common/test/directives/ng_plural_spec.ts index e89d085b35..b9b887c3c8 100644 --- a/modules/@angular/common/test/directives/ng_plural_spec.ts +++ b/modules/@angular/common/test/directives/ng_plural_spec.ts @@ -1,20 +1,19 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEachProviders, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; -import {Component, Injectable, provide} from 'angular2/core'; -import {NgPlural, NgPluralCase, NgLocalization} from 'angular2/common'; +import {Component, Injectable, provide} from '@angular/core'; +import {NgPlural, NgPluralCase, NgLocalization} from '@angular/common'; export function main() { describe('switch', () => { diff --git a/modules/@angular/common/test/directives/ng_style_spec.ts b/modules/@angular/common/test/directives/ng_style_spec.ts index 4b816b05fc..b8518b2a41 100644 --- a/modules/@angular/common/test/directives/ng_style_spec.ts +++ b/modules/@angular/common/test/directives/ng_style_spec.ts @@ -1,25 +1,24 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, beforeEachProviders, ddescribe, xdescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; +import {StringMapWrapper} from '../../src/facade/collection'; -import {Component} from 'angular2/core'; +import {Component} from '@angular/core'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {NgStyle} from 'angular2/src/common/directives/ng_style'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {NgStyle} from '@angular/common/src/directives/ng_style'; export function main() { describe('binding to CSS styles', () => { @@ -32,7 +31,7 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('40px'); async.done(); @@ -50,13 +49,13 @@ export function main() { fixture.debugElement.componentInstance.expr = {'max-width': '40px'}; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('40px'); expr = fixture.debugElement.componentInstance.expr; expr['max-width'] = '30%'; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('30%'); async.done(); @@ -72,12 +71,12 @@ export function main() { .then((fixture) => { fixture.debugElement.componentInstance.expr = {'max-width': '40px'}; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('40px'); StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width'); fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual(''); async.done(); @@ -93,16 +92,16 @@ export function main() { .then((fixture) => { fixture.debugElement.componentInstance.expr = {'max-width': '40px'}; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('40px'); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) .toEqual('12px'); StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width'); fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual(''); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) .toEqual('12px'); async.done(); @@ -118,17 +117,17 @@ export function main() { .then((fixture) => { fixture.debugElement.componentInstance.expr = {'max-width': '40px'}; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual('40px'); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) .toEqual('12px'); StringMapWrapper.delete(fixture.debugElement.componentInstance.expr, 'max-width'); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'font-size')) .toEqual('12px'); fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'max-width')) .toEqual(''); async.done(); diff --git a/modules/@angular/common/test/directives/ng_switch_spec.ts b/modules/@angular/common/test/directives/ng_switch_spec.ts index 030c17ca70..a290bf5415 100644 --- a/modules/@angular/common/test/directives/ng_switch_spec.ts +++ b/modules/@angular/common/test/directives/ng_switch_spec.ts @@ -1,20 +1,18 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {Component} from '@angular/core'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; -import {Component} from 'angular2/core'; - -import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from 'angular2/src/common/directives/ng_switch'; +import {NgSwitch, NgSwitchWhen, NgSwitchDefault} from '@angular/common'; export function main() { describe('switch', () => { diff --git a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts index e4480d754d..d57272d91e 100644 --- a/modules/@angular/common/test/directives/ng_template_outlet_spec.ts +++ b/modules/@angular/common/test/directives/ng_template_outlet_spec.ts @@ -1,20 +1,17 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; - -import {Component, Directive, TemplateRef, ContentChildren, QueryList} from 'angular2/core'; - -import {NgTemplateOutlet} from 'angular2/src/common/directives/ng_template_outlet'; +} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {Component, Directive, TemplateRef, ContentChildren, QueryList} from '@angular/core'; +import {NgTemplateOutlet} from '@angular/common'; export function main() { describe('insert', () => { diff --git a/modules/@angular/common/test/directives/non_bindable_spec.ts b/modules/@angular/common/test/directives/non_bindable_spec.ts index 74926f2f2b..59ce4be2d7 100644 --- a/modules/@angular/common/test/directives/non_bindable_spec.ts +++ b/modules/@angular/common/test/directives/non_bindable_spec.ts @@ -1,19 +1,18 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, -} from 'angular2/testing_internal'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {Component, Directive} from 'angular2/core'; -import {ElementRef} from 'angular2/src/core/linker/element_ref'; +} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {Component, Directive} from '@angular/core'; +import {ElementRef} from '@angular/core/src/linker/element_ref'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; export function main() { describe('non-bindable', () => { @@ -37,10 +36,10 @@ export function main() { .then((fixture) => { fixture.detectChanges(); - // We must use DOM.querySelector instead of fixture.query here + // We must use getDOM().querySelector instead of fixture.query here // since the elements inside are not compiled. - var span = DOM.querySelector(fixture.debugElement.nativeElement, '#child'); - expect(DOM.hasClass(span, 'compiled')).toBeFalsy(); + var span = getDOM().querySelector(fixture.debugElement.nativeElement, '#child'); + expect(getDOM().hasClass(span, 'compiled')).toBeFalsy(); async.done(); }); })); @@ -52,8 +51,8 @@ export function main() { .createAsync(TestComponent) .then((fixture) => { fixture.detectChanges(); - var span = DOM.querySelector(fixture.debugElement.nativeElement, '#child'); - expect(DOM.hasClass(span, 'compiled')).toBeTruthy(); + var span = getDOM().querySelector(fixture.debugElement.nativeElement, '#child'); + expect(getDOM().hasClass(span, 'compiled')).toBeTruthy(); async.done(); }); })); @@ -62,7 +61,7 @@ export function main() { @Directive({selector: '[test-dec]'}) class TestDirective { - constructor(el: ElementRef) { DOM.addClass(el.nativeElement, 'compiled'); } + constructor(el: ElementRef) { getDOM().addClass(el.nativeElement, 'compiled'); } } @Component({selector: 'test-cmp', directives: [TestDirective], template: ''}) diff --git a/modules/@angular/common/test/forms/directives_spec.ts b/modules/@angular/common/test/forms/directives_spec.ts index c9a6642b7d..90d673ad42 100644 --- a/modules/@angular/common/test/forms/directives_spec.ts +++ b/modules/@angular/common/test/forms/directives_spec.ts @@ -1,19 +1,21 @@ import { ddescribe, describe, - fakeAsync, - flushMicrotasks, it, iit, xit, expect, beforeEach, afterEach, - el, - AsyncTestCompleter, - inject, - tick -} from 'angular2/testing_internal'; + inject +} from '@angular/core/testing/testing_internal'; + +import { + fakeAsync, + flushMicrotasks, + Log, + tick, +} from '@angular/core/testing'; import {SpyNgControl, SpyValueAccessor} from '../spies'; @@ -33,13 +35,13 @@ import { CheckboxControlValueAccessor, SelectControlValueAccessor, Validator -} from 'angular2/common'; +} from '@angular/common'; -import {selectValueAccessor, composeValidators} from 'angular2/src/common/forms/directives/shared'; -import {TimerWrapper} from 'angular2/src/facade/async'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; -import {SimpleChange} from 'angular2/src/core/change_detection'; +import {selectValueAccessor, composeValidators} from '@angular/common/src/forms/directives/shared'; +import {TimerWrapper} from '../../src/facade/async'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {SimpleChange} from '@angular/core/src/change_detection'; class DummyControlValueAccessor implements ControlValueAccessor { writtenValue; @@ -69,7 +71,7 @@ function asyncValidator(expected, timeout = 0) { export function main() { describe("Form Directives", () => { - var defaultAccessor; + var defaultAccessor: DefaultValueAccessor; beforeEach(() => { defaultAccessor = new DefaultValueAccessor(null, null); }); @@ -106,7 +108,7 @@ export function main() { it("should return custom accessor when provided", () => { var customAccessor = new SpyValueAccessor(); var checkboxAccessor = new CheckboxControlValueAccessor(null, null); - expect(selectValueAccessor(dir, [defaultAccessor, customAccessor, checkboxAccessor])) + expect(selectValueAccessor(dir, [defaultAccessor, customAccessor, checkboxAccessor])) .toEqual(customAccessor); }); diff --git a/modules/@angular/common/test/forms/form_builder_spec.ts b/modules/@angular/common/test/forms/form_builder_spec.ts index 7a863b83b8..1d697597f1 100644 --- a/modules/@angular/common/test/forms/form_builder_spec.ts +++ b/modules/@angular/common/test/forms/form_builder_spec.ts @@ -6,11 +6,10 @@ import { xit, expect, beforeEach, - afterEach, - el -} from 'angular2/testing_internal'; -import {Control, FormBuilder} from 'angular2/common'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; + afterEach +} from '@angular/core/testing/testing_internal'; +import {Control, FormBuilder} from '@angular/common'; +import {PromiseWrapper} from '../../src/facade/promise'; export function main() { function syncValidator(_) { return null; } diff --git a/modules/@angular/common/test/forms/integration_spec.ts b/modules/@angular/common/test/forms/integration_spec.ts index 08f082f1bf..b7f0c3da66 100644 --- a/modules/@angular/common/test/forms/integration_spec.ts +++ b/modules/@angular/common/test/forms/integration_spec.ts @@ -1,33 +1,24 @@ +import {Component, Directive, Output, EventEmitter} from '@angular/core'; import { - Component, - Directive, - Output, - EventEmitter, - Provider, - forwardRef, - Input -} from 'angular2/core'; -import { - ComponentFixture, afterEach, - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, - dispatchEvent, - fakeAsync, - tick, - flushMicrotasks, expect, it, inject, iit, - xit, - browserDetection -} from 'angular2/testing_internal'; - -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; + xit +} from '@angular/core/testing/testing_internal'; +import { + fakeAsync, + tick, + flushMicrotasks +} from '@angular/core/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder} from '@angular/compiler/testing'; +import {ComponentFixture} from '@angular/compiler/testing'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import { Control, ControlGroup, @@ -42,11 +33,14 @@ import { Validators, Validator, RadioButtonState -} from 'angular2/common'; -import {By} from 'angular2/platform/browser'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {ObservableWrapper, TimerWrapper} from 'angular2/src/facade/async'; -import {PromiseWrapper} from "angular2/src/facade/promise"; +} from '@angular/common'; +import {Provider, forwardRef, Input} from '@angular/core'; +import {By} from '@angular/platform-browser/src/dom/debug/by'; +import {ListWrapper} from '../../src/facade/collection'; +import {ObservableWrapper, TimerWrapper} from '../../src/facade/async'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {browserDetection} from '@angular/platform-browser/testing'; +import {dispatchEvent} from '@angular/platform-browser/testing'; export function main() { describe("integration tests", () => { @@ -57,7 +51,7 @@ export function main() {
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"login": new Control("loginValue")}); fixture.detectChanges(); @@ -74,7 +68,7 @@ export function main() {
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { expect(() => fixture.detectChanges()) .toThrowError(new RegExp(`ngFormModel expects a form. Please pass one in.`)); async.done(); @@ -89,7 +83,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); var input = fixture.debugElement.query(By.css("input")); @@ -110,7 +104,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); var input = fixture.debugElement.query(By.css("input")); @@ -132,7 +126,7 @@ export function main() { {{name}} `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.form = new ControlGroup({}); @@ -153,7 +147,7 @@ export function main() { var t = `
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = control; fixture.detectChanges(); @@ -174,7 +168,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"login": new Control("oldValue")}); fixture.detectChanges(); @@ -198,7 +192,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -221,7 +215,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -243,7 +237,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"text": new Control("old")}); fixture.detectChanges(); @@ -265,7 +259,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"text": new Control("old")}); fixture.detectChanges(); @@ -286,7 +280,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"text": new Control('old')}); fixture.detectChanges(); @@ -308,7 +302,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"checkbox": new Control(true)}); fixture.detectChanges(); @@ -330,7 +324,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"num": new Control(10)}); fixture.detectChanges(); @@ -352,7 +346,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"num": new Control(10)}); fixture.detectChanges(); @@ -381,7 +375,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.debugElement.componentInstance.data = null; fixture.detectChanges(); @@ -400,7 +394,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({ "foodChicken": new Control(new RadioButtonState(false, 'chicken')), "foodFish": new Control(new RadioButtonState(true, 'fish')) @@ -429,7 +423,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.detectChanges(); var select = fixture.debugElement.query(By.css("select")); @@ -450,7 +444,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { var testComp = fixture.debugElement.componentInstance; testComp.list = [{"id": "0", "name": "SF"}, {"id": "1", "name": "NYC"}]; fixture.detectChanges(); @@ -475,7 +469,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"city": new Control("SF")}); fixture.detectChanges(); @@ -505,7 +499,7 @@ export function main() { `; var fixture; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((compFixture) => fixture = + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((compFixture) => fixture = compFixture); tick(); @@ -529,7 +523,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { var testComp = fixture.debugElement.componentInstance; testComp.list = [{"name": "SF"}, {"name": "NYC"}, {"name": "Buffalo"}]; @@ -561,9 +555,9 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { - var testComp: MyComp = fixture.debugElement.componentInstance; + var testComp: MyComp8 = fixture.debugElement.componentInstance; testComp.list = [{"name": "SF"}, {"name": "NYC"}]; testComp.selectedCity = testComp.list[1]; fixture.detectChanges(); @@ -588,9 +582,9 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { - var testComp: MyComp = fixture.debugElement.componentInstance; + var testComp: MyComp8 = fixture.debugElement.componentInstance; testComp.list = [{"name": "SF"}, {"name": "NYC"}]; testComp.selectedCity = testComp.list[1]; fixture.detectChanges(); @@ -615,7 +609,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { var testComp = fixture.debugElement.componentInstance; @@ -645,7 +639,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { var testComp = fixture.debugElement.componentInstance; @@ -674,7 +668,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { var testComp = fixture.debugElement.componentInstance; testComp.list = [{"name": "SF"}, {"name": "NYC"}, {"name": "NYC"}]; @@ -700,7 +694,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"name": new Control("aa")}); fixture.detectChanges(); @@ -721,7 +715,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = new ControlGroup({"name": new Control("aa")}); fixture.detectChanges(); @@ -751,7 +745,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -794,7 +788,7 @@ export function main() { `; var rootTC; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => rootTC = root); + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => rootTC = root); tick(); rootTC.debugElement.componentInstance.form = form; @@ -822,7 +816,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); expect(form.valid).toEqual(true); @@ -847,7 +841,7 @@ export function main() { `; var fixture; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((root) => fixture = root); + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((root) => fixture = root); tick(); fixture.debugElement.componentInstance.form = form; @@ -884,7 +878,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -905,7 +899,7 @@ export function main() { `; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); var input = fixture.debugElement.query(By.css("input")); @@ -926,7 +920,7 @@ export function main() { var t = `
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = 'oldValue'; @@ -949,7 +943,7 @@ export function main() { var t = `
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.form = form; fixture.debugElement.componentInstance.name = "oldValue"; @@ -974,7 +968,7 @@ export function main() { `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = null; fixture.detectChanges(); @@ -992,7 +986,7 @@ export function main() { fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { var t = `
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = 'old'; var form = fixture.debugElement.query(By.css("form")); @@ -1008,7 +1002,7 @@ export function main() { var t = `
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.name = null; fixture.detectChanges(); @@ -1025,7 +1019,7 @@ export function main() { `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = 'show'; fixture.detectChanges(); @@ -1051,7 +1045,7 @@ export function main() { `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = 'show'; fixture.detectChanges(); @@ -1073,7 +1067,7 @@ export function main() { `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = "oldValue"; fixture.detectChanges(); @@ -1094,7 +1088,7 @@ export function main() { fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { var t = `
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = "oldValue"; fixture.detectChanges(); @@ -1121,7 +1115,7 @@ export function main() { `; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.data = { @@ -1157,7 +1151,7 @@ export function main() { var t = `
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -1184,7 +1178,7 @@ export function main() { var t = `
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -1209,7 +1203,7 @@ export function main() { inject([TestComponentBuilder, AsyncTestCompleter], (tcb: TestComponentBuilder, async) => { var t = `
`; - tcb.overrideTemplate(MyComp, t).createAsync(MyComp).then((fixture) => { + tcb.overrideTemplate(MyComp8, t).createAsync(MyComp8).then((fixture) => { fixture.debugElement.componentInstance.name = ""; fixture.detectChanges(); @@ -1237,7 +1231,7 @@ export function main() { var form = new Control(""); var t = `
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.form = form; fixture.detectChanges(); @@ -1245,8 +1239,8 @@ export function main() { // In Firefox, effective text selection in the real DOM requires an actual focus // of the field. This is not an issue in a new HTML document. if (browserDetection.isFirefox) { - var fakeDoc = DOM.createHtmlDocument(); - DOM.appendChild(fakeDoc.body, fixture.debugElement.nativeElement); + var fakeDoc = getDOM().createHtmlDocument(); + getDOM().appendChild(fakeDoc.body, fixture.debugElement.nativeElement); } var input = fixture.debugElement.query(By.css("input")).nativeElement; @@ -1264,7 +1258,7 @@ export function main() { it("should update the view when the model is set back to what used to be in the view", fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => { var t = ``; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.debugElement.componentInstance.name = ""; fixture.detectChanges(); @@ -1298,7 +1292,7 @@ export function main() { // fixed. var t = `
{{x.valid}}
`; - let fixture = tcb.overrideTemplate(MyComp, t).createFakeAsync(MyComp); + let fixture = tcb.overrideTemplate(MyComp8, t).createFakeAsync(MyComp8); tick(); fixture.detectChanges(); }))); @@ -1394,7 +1388,7 @@ class UniqLoginValidator implements Validator { UniqLoginValidator ] }) -class MyComp { +class MyComp8 { form: any; name: string; data: any; @@ -1404,7 +1398,7 @@ class MyComp { } function sortedClassList(el) { - var l = DOM.classList(el); + var l = getDOM().classList(el); ListWrapper.sort(l); return l; } diff --git a/modules/@angular/common/test/forms/model_spec.ts b/modules/@angular/common/test/forms/model_spec.ts index 973ad00d83..15840db6fa 100644 --- a/modules/@angular/common/test/forms/model_spec.ts +++ b/modules/@angular/common/test/forms/model_spec.ts @@ -7,16 +7,19 @@ import { expect, beforeEach, afterEach, - el, - AsyncTestCompleter, + inject, +} from '@angular/core/testing/testing_internal'; +import { fakeAsync, - tick, - inject -} from 'angular2/testing_internal'; -import {ControlGroup, Control, ControlArray, Validators} from 'angular2/common'; -import {IS_DART, isPresent} from 'angular2/src/facade/lang'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; -import {TimerWrapper, ObservableWrapper, EventEmitter} from 'angular2/src/facade/async'; + flushMicrotasks, + Log, + tick +} from '@angular/core/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {ControlGroup, Control, ControlArray, Validators} from '@angular/common'; +import {IS_DART, isPresent} from '../../src/facade/lang'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {TimerWrapper, ObservableWrapper, EventEmitter} from '../../src/facade/async'; export function main() { function asyncValidator(expected, timeouts = /*@ts2dart_const*/ {}) { diff --git a/modules/@angular/common/test/forms/validators_spec.ts b/modules/@angular/common/test/forms/validators_spec.ts index 248e8ef31e..ea52390620 100644 --- a/modules/@angular/common/test/forms/validators_spec.ts +++ b/modules/@angular/common/test/forms/validators_spec.ts @@ -6,14 +6,17 @@ import { xit, expect, beforeEach, - afterEach, + afterEach +} from '@angular/core/testing/testing_internal'; +import { fakeAsync, - tick, - el -} from 'angular2/testing_internal'; -import {ControlGroup, Control, Validators, AbstractControl, ControlArray} from 'angular2/common'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; -import {EventEmitter, ObservableWrapper, TimerWrapper} from 'angular2/src/facade/async'; + flushMicrotasks, + Log, + tick +} from '@angular/core/testing'; +import {ControlGroup, Control, Validators, AbstractControl, ControlArray} from '@angular/common'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {EventEmitter, ObservableWrapper, TimerWrapper} from '../../src/facade/async'; export function main() { function validator(key: string, error: any) { diff --git a/modules/@angular/common/test/pipes/async_pipe_spec.ts b/modules/@angular/common/test/pipes/async_pipe_spec.ts index 75afc6dbcf..726895ee99 100644 --- a/modules/@angular/common/test/pipes/async_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/async_pipe_spec.ts @@ -7,23 +7,22 @@ import { expect, beforeEach, afterEach, - AsyncTestCompleter, inject, - browserDetection -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; import {SpyChangeDetectorRef} from '../spies'; - -import {isBlank} from 'angular2/src/facade/lang'; -import {AsyncPipe} from 'angular2/common'; -import {WrappedValue} from 'angular2/core'; +import {isBlank} from '../../src/facade/lang'; +import {AsyncPipe} from '@angular/common'; +import {WrappedValue} from '@angular/core'; import { EventEmitter, ObservableWrapper, PromiseWrapper, TimerWrapper -} from 'angular2/src/facade/async'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {PromiseCompleter} from 'angular2/src/facade/promise'; +} from '../../src/facade/async'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {PromiseCompleter} from '../../src/facade/promise'; +import {browserDetection} from '@angular/platform-browser/testing'; export function main() { describe("AsyncPipe", () => { @@ -121,7 +120,7 @@ export function main() { var completer: PromiseCompleter; var ref: SpyChangeDetectorRef; // adds longer timers for passing tests in IE - var timer = (!isBlank(DOM) && browserDetection.isIE) ? 50 : 10; + var timer = (!isBlank(getDOM()) && browserDetection.isIE) ? 50 : 10; beforeEach(() => { completer = PromiseWrapper.completer(); diff --git a/modules/@angular/common/test/pipes/date_pipe_spec.ts b/modules/@angular/common/test/pipes/date_pipe_spec.ts index 5d6c6598d4..80e5ca9260 100644 --- a/modules/@angular/common/test/pipes/date_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/date_pipe_spec.ts @@ -6,13 +6,13 @@ import { xit, expect, beforeEach, - afterEach, - browserDetection -} from 'angular2/testing_internal'; + afterEach +} from '@angular/core/testing/testing_internal'; +import {browserDetection} from '@angular/platform-browser/testing'; -import {DatePipe} from 'angular2/common'; -import {DateWrapper} from 'angular2/src/facade/lang'; -import {PipeResolver} from 'angular2/src/compiler/pipe_resolver'; +import {DatePipe} from '@angular/common'; +import {DateWrapper} from '../../src/facade/lang'; +import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; export function main() { describe("DatePipe", () => { diff --git a/modules/@angular/common/test/pipes/i18n_plural_pipe_spec.ts b/modules/@angular/common/test/pipes/i18n_plural_pipe_spec.ts index 1737d6a58b..94b2c68315 100644 --- a/modules/@angular/common/test/pipes/i18n_plural_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/i18n_plural_pipe_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {I18nPluralPipe} from 'angular2/common'; -import {PipeResolver} from 'angular2/src/compiler/pipe_resolver'; +import {I18nPluralPipe} from '@angular/common'; +import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; export function main() { describe("I18nPluralPipe", () => { diff --git a/modules/@angular/common/test/pipes/i18n_select_pipe_spec.ts b/modules/@angular/common/test/pipes/i18n_select_pipe_spec.ts index ad32e8b251..f932e0d309 100644 --- a/modules/@angular/common/test/pipes/i18n_select_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/i18n_select_pipe_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {I18nSelectPipe} from 'angular2/common'; -import {PipeResolver} from 'angular2/src/compiler/pipe_resolver'; +import {I18nSelectPipe} from '@angular/common'; +import {PipeResolver} from '@angular/compiler/src/pipe_resolver'; export function main() { describe("I18nSelectPipe", () => { diff --git a/modules/@angular/common/test/pipes/json_pipe_spec.ts b/modules/@angular/common/test/pipes/json_pipe_spec.ts index e4a0ef2bcf..afcc96c88f 100644 --- a/modules/@angular/common/test/pipes/json_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/json_pipe_spec.ts @@ -7,14 +7,14 @@ import { expect, beforeEach, afterEach, - AsyncTestCompleter, inject, - TestComponentBuilder -} from 'angular2/testing_internal'; -import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {Json, RegExp, NumberWrapper, StringWrapper} from '../../src/facade/lang'; -import {Component} from 'angular2/core'; -import {JsonPipe} from 'angular2/common'; +import {Component} from '@angular/core'; +import {JsonPipe} from '@angular/common'; export function main() { describe("JsonPipe", () => { diff --git a/modules/@angular/common/test/pipes/lowercase_pipe_spec.ts b/modules/@angular/common/test/pipes/lowercase_pipe_spec.ts index 3dd6bebe39..c75278c127 100644 --- a/modules/@angular/common/test/pipes/lowercase_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/lowercase_pipe_spec.ts @@ -7,9 +7,9 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {LowerCasePipe} from 'angular2/common'; +import {LowerCasePipe} from '@angular/common'; export function main() { describe("LowerCasePipe", () => { diff --git a/modules/@angular/common/test/pipes/number_pipe_spec.ts b/modules/@angular/common/test/pipes/number_pipe_spec.ts index 33d12fa335..5828dfe302 100644 --- a/modules/@angular/common/test/pipes/number_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/number_pipe_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach, - browserDetection -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {browserDetection} from '@angular/platform-browser/testing'; -import {DecimalPipe, PercentPipe, CurrencyPipe} from 'angular2/common'; +import {DecimalPipe, PercentPipe, CurrencyPipe} from '@angular/common'; export function main() { describe('Number pipes', () => { diff --git a/modules/@angular/common/test/pipes/replace_pipe_spec.ts b/modules/@angular/common/test/pipes/replace_pipe_spec.ts index 652316a1bd..ab9d21a1ca 100644 --- a/modules/@angular/common/test/pipes/replace_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/replace_pipe_spec.ts @@ -7,14 +7,12 @@ import { expect, beforeEach, afterEach, - browserDetection, inject, - TestComponentBuilder, - AsyncTestCompleter -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {ReplacePipe} from 'angular2/common'; -import {RegExpWrapper, StringJoiner} from 'angular2/src/facade/lang'; +import {ReplacePipe} from '@angular/common'; +import {RegExpWrapper, StringJoiner} from '../../src/facade/lang'; export function main() { describe("ReplacePipe", () => { diff --git a/modules/@angular/common/test/pipes/slice_pipe_spec.ts b/modules/@angular/common/test/pipes/slice_pipe_spec.ts index ac04fcf624..1d04f8256c 100644 --- a/modules/@angular/common/test/pipes/slice_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/slice_pipe_spec.ts @@ -7,14 +7,15 @@ import { expect, beforeEach, afterEach, - browserDetection, inject, - TestComponentBuilder, - AsyncTestCompleter -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {} from '@angular/core/testing/testing_internal'; +import {browserDetection} from '@angular/platform-browser/testing'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {Component} from 'angular2/core'; -import {SlicePipe} from 'angular2/common'; +import {Component} from '@angular/core'; +import {SlicePipe} from '@angular/common'; export function main() { describe("SlicePipe", () => { diff --git a/modules/@angular/common/test/pipes/uppercase_pipe_spec.ts b/modules/@angular/common/test/pipes/uppercase_pipe_spec.ts index 7241c468c3..b463d4df77 100644 --- a/modules/@angular/common/test/pipes/uppercase_pipe_spec.ts +++ b/modules/@angular/common/test/pipes/uppercase_pipe_spec.ts @@ -7,9 +7,8 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; - -import {UpperCasePipe} from 'angular2/common'; +} from '@angular/core/testing/testing_internal'; +import {UpperCasePipe} from '@angular/common'; export function main() { describe("UpperCasePipe", () => { diff --git a/modules/@angular/common/test/spies.ts b/modules/@angular/common/test/spies.ts index 28edae54d6..dde165550a 100644 --- a/modules/@angular/common/test/spies.ts +++ b/modules/@angular/common/test/spies.ts @@ -1,5 +1,5 @@ -import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref'; -import {SpyObject, proxy} from 'angular2/testing_internal'; +import {ChangeDetectorRef} from '@angular/core/src/change_detection/change_detector_ref'; +import {SpyObject, proxy} from '@angular/core/testing/testing_internal'; export class SpyChangeDetectorRef extends SpyObject { constructor() { @@ -10,4 +10,6 @@ export class SpyChangeDetectorRef extends SpyObject { export class SpyNgControl extends SpyObject {} -export class SpyValueAccessor extends SpyObject {} +export class SpyValueAccessor extends SpyObject { + writeValue: any; +} diff --git a/modules/@angular/common/testing.ts b/modules/@angular/common/testing.ts new file mode 100644 index 0000000000..762d59b892 --- /dev/null +++ b/modules/@angular/common/testing.ts @@ -0,0 +1,2 @@ +export {MockLocationStrategy} from './testing/mock_location_strategy'; +export {SpyLocation} from './testing/location_mock'; diff --git a/modules/@angular/common/testing/location_mock.ts b/modules/@angular/common/testing/location_mock.ts index 5effadff63..d42ed60111 100644 --- a/modules/@angular/common/testing/location_mock.ts +++ b/modules/@angular/common/testing/location_mock.ts @@ -1,7 +1,6 @@ -import {Injectable} from 'angular2/src/core/di'; -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {Location} from 'angular2/platform/common'; +import {Injectable, EventEmitter} from '@angular/core'; +import {ObservableWrapper} from '../src/facade/async'; +import {Location} from '../index'; /** * A spy for {@link Location} that allows tests to fire simulated location events. diff --git a/modules/@angular/common/testing/mock_location_strategy.ts b/modules/@angular/common/testing/mock_location_strategy.ts index 161f45d571..b1f1507cb5 100644 --- a/modules/@angular/common/testing/mock_location_strategy.ts +++ b/modules/@angular/common/testing/mock_location_strategy.ts @@ -1,6 +1,6 @@ -import {Injectable} from 'angular2/src/core/di'; -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; -import {LocationStrategy} from 'angular2/platform/common'; +import {Injectable} from '@angular/core'; +import {EventEmitter, ObservableWrapper} from '../src/facade/async'; +import {LocationStrategy} from '../index'; /** diff --git a/modules/@angular/common/tsconfig-es2015.json b/modules/@angular/common/tsconfig-es2015.json new file mode 100644 index 0000000000..8608568c02 --- /dev/null +++ b/modules/@angular/common/tsconfig-es2015.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "outDir": "../../../dist/packages-dist/common/esm", + "paths": { + "@angular/core": ["../../../dist/packages-dist/core"] + }, + "rootDir": ".", + "sourceMap": true, + "sourceRoot": ".", + "target": "es2015" + }, + "files": [ + "index.ts", + "testing.ts", + "../../../node_modules/zone.js/dist/zone.js.d.ts" + ] +} diff --git a/modules/@angular/common/tsconfig.json b/modules/@angular/common/tsconfig.json new file mode 100644 index 0000000000..3bb02d7d91 --- /dev/null +++ b/modules/@angular/common/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "commonjs", + "moduleResolution": "node", + "outDir": "../../../dist/packages-dist/common/", + "paths": { + "@angular/core": ["../../../dist/packages-dist/core/"] + }, + "rootDir": ".", + "sourceMap": true, + "sourceRoot": ".", + "target": "es5" + }, + "files": [ + "index.ts", + "testing.ts", + "../typings/es6-collections/es6-collections.d.ts", + "../typings/es6-promise/es6-promise.d.ts", + "../manual_typings/globals.d.ts", + "../../../node_modules/zone.js/dist/zone.js.d.ts" + + ] +} diff --git a/modules/@angular/compiler/compiler.ts b/modules/@angular/compiler/compiler.ts index c77f40fecc..1528294b05 100644 --- a/modules/@angular/compiler/compiler.ts +++ b/modules/@angular/compiler/compiler.ts @@ -3,9 +3,8 @@ * @description * Starting point to import all compiler APIs. */ +export {ElementSchemaRegistry} from './src/schema/element_schema_registry'; export { - PLATFORM_DIRECTIVES, - PLATFORM_PIPES, COMPILER_PROVIDERS, TEMPLATE_TRANSFORMS, CompilerConfig, @@ -32,6 +31,7 @@ export { CompileTemplateMetadata, CompileDirectiveMetadata, CompilePipeMetadata -} from 'angular2/src/compiler/compiler'; +} from './src/compiler'; -export * from 'angular2/src/compiler/template_ast'; +export * from './src/template_ast'; +export * from './private_export'; diff --git a/modules/@angular/compiler/core_private.dart b/modules/@angular/compiler/core_private.dart new file mode 100644 index 0000000000..309077433f --- /dev/null +++ b/modules/@angular/compiler/core_private.dart @@ -0,0 +1 @@ +export '../core/private_export.dart'; diff --git a/modules/@angular/compiler/core_private.ts b/modules/@angular/compiler/core_private.ts new file mode 100644 index 0000000000..6009eb2db7 --- /dev/null +++ b/modules/@angular/compiler/core_private.ts @@ -0,0 +1,52 @@ +import {__core_private__ as r, __core_private_types__ as t} from '@angular/core'; + +export var isDefaultChangeDetectionStrategy: typeof t.isDefaultChangeDetectionStrategy = r.isDefaultChangeDetectionStrategy; +export type ChangeDetectorState = t.ChangeDetectorState; +export var ChangeDetectorState: typeof t.ChangeDetectorState = r.ChangeDetectorState; +export var CHANGE_DETECTION_STRATEGY_VALUES: typeof t.CHANGE_DETECTION_STRATEGY_VALUES = r.CHANGE_DETECTION_STRATEGY_VALUES; +export var constructDependencies: typeof t.constructDependencies = r.constructDependencies; +export type LifecycleHooks = t.LifecycleHooks; +export var LifecycleHooks: typeof t.LifecycleHooks = r.LifecycleHooks; +export var LIFECYCLE_HOOKS_VALUES: typeof t.LIFECYCLE_HOOKS_VALUES = r.LIFECYCLE_HOOKS_VALUES; +export type ReflectorReader = t.ReflectorReader; +export var ReflectorReader: typeof t.ReflectorReader = r.ReflectorReader; +export var ReflectorComponentResolver: typeof t.ReflectorComponentResolver = r.ReflectorComponentResolver; +export type AppElement = t.AppElement; +export var AppElement: typeof t.AppElement = r.AppElement; +export var AppView: typeof t.AppView = r.AppView; +export type DebugAppView = t.DebugAppView; +export var DebugAppView: typeof t.DebugAppView = r.DebugAppView; +export type ViewType = t.ViewType; +export var ViewType: typeof t.ViewType = r.ViewType; +export var MAX_INTERPOLATION_VALUES: typeof t.MAX_INTERPOLATION_VALUES = r.MAX_INTERPOLATION_VALUES; +export var checkBinding: typeof t.checkBinding = r.checkBinding; +export var flattenNestedViewRenderNodes: typeof t.flattenNestedViewRenderNodes = r.flattenNestedViewRenderNodes; +export var interpolate: typeof t.interpolate = r.interpolate; +export var ViewUtils: typeof t.ViewUtils = r.ViewUtils; +export var VIEW_ENCAPSULATION_VALUES: typeof t.VIEW_ENCAPSULATION_VALUES = r.VIEW_ENCAPSULATION_VALUES; +export var DebugContext: typeof t.DebugContext = r.DebugContext; +export var StaticNodeDebugInfo: typeof t.StaticNodeDebugInfo = r.StaticNodeDebugInfo; +export var devModeEqual: typeof t.devModeEqual = r.devModeEqual; +export var uninitialized: typeof t.uninitialized = r.uninitialized; +export var ValueUnwrapper: typeof t.ValueUnwrapper = r.ValueUnwrapper; +export var TemplateRef_: typeof t.TemplateRef_ = r.TemplateRef_; +export type RenderDebugInfo = t.RenderDebugInfo; +export var RenderDebugInfo: typeof t.RenderDebugInfo = r.RenderDebugInfo; +export var createProvider: typeof t.createProvider = r.createProvider; +export var isProviderLiteral: typeof t.isProviderLiteral = r.isProviderLiteral; +export var EMPTY_ARRAY: typeof t.EMPTY_ARRAY = r.EMPTY_ARRAY; +export var EMPTY_MAP: typeof t.EMPTY_MAP = r.EMPTY_MAP; +export var pureProxy1: typeof t.pureProxy1 = r.pureProxy1; +export var pureProxy2: typeof t.pureProxy2 = r.pureProxy2; +export var pureProxy3: typeof t.pureProxy3 = r.pureProxy3; +export var pureProxy4: typeof t.pureProxy4 = r.pureProxy4; +export var pureProxy5: typeof t.pureProxy5 = r.pureProxy5; +export var pureProxy6: typeof t.pureProxy6 = r.pureProxy6; +export var pureProxy7: typeof t.pureProxy7 = r.pureProxy7; +export var pureProxy8: typeof t.pureProxy8 = r.pureProxy8; +export var pureProxy9: typeof t.pureProxy9 = r.pureProxy9; +export var pureProxy10: typeof t.pureProxy10 = r.pureProxy10; +export var castByValue: typeof t.castByValue = r.castByValue; +export type Console = t.Console; +export var Console: typeof t.Console = r.Console; + diff --git a/modules/@angular/compiler/index.ts b/modules/@angular/compiler/index.ts new file mode 100644 index 0000000000..b2a57755ae --- /dev/null +++ b/modules/@angular/compiler/index.ts @@ -0,0 +1 @@ +export * from './compiler'; diff --git a/modules/@angular/compiler/package.json b/modules/@angular/compiler/package.json new file mode 100644 index 0000000000..a6bc4408db --- /dev/null +++ b/modules/@angular/compiler/package.json @@ -0,0 +1,13 @@ +{ + "name": "@angular/compiler", + "version": "$$ANGULAR_VERSION$$", + "description": "", + "main": "index.js", + "jsnext:main": "esm/index.js", + "typings": "index.d.ts", + "author": "angular", + "license": "MIT", + "peerDependencies": { + "@angular/core": "$$ANGULAR_VERSION$$" + } +} diff --git a/modules/@angular/compiler/private_export.dart b/modules/@angular/compiler/private_export.dart new file mode 100644 index 0000000000..34220bb3e4 --- /dev/null +++ b/modules/@angular/compiler/private_export.dart @@ -0,0 +1 @@ +export './src/core/change_detection/constants.dart' show SelectorMatcher, CssSelector; diff --git a/modules/@angular/compiler/private_export.ts b/modules/@angular/compiler/private_export.ts new file mode 100644 index 0000000000..038b85026b --- /dev/null +++ b/modules/@angular/compiler/private_export.ts @@ -0,0 +1,9 @@ +import * as selector from './src/selector'; + +export namespace __compiler_private__ { + export type SelectorMatcher = selector.SelectorMatcher; + export var SelectorMatcher = selector.SelectorMatcher; + + export type CssSelector = selector.CssSelector; + export var CssSelector = selector.CssSelector; +} diff --git a/modules/@angular/compiler/rollup.config.js b/modules/@angular/compiler/rollup.config.js new file mode 100644 index 0000000000..0333a23b6e --- /dev/null +++ b/modules/@angular/compiler/rollup.config.js @@ -0,0 +1,18 @@ + +export default { + entry: '../../../dist/packages-dist/compiler/esm/index.js', + dest: '../../../dist/packages-dist/compiler/esm/compiler.umd.js', + sourceMap: true, + format: 'umd', + moduleName: 'ng.compiler', + globals: { + '@angular/core': 'ng.core', + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + }, + plugins: [ +// nodeResolve({ jsnext: true, main: true }), + ] +} diff --git a/modules/@angular/compiler/src/assertions.ts b/modules/@angular/compiler/src/assertions.ts index b402485d03..e1c408f108 100644 --- a/modules/@angular/compiler/src/assertions.ts +++ b/modules/@angular/compiler/src/assertions.ts @@ -1,5 +1,5 @@ -import {isArray, isString, isBlank, assertionsEnabled} from '../facade/lang'; -import {BaseException} from '../facade/exceptions'; +import {isArray, isString, isBlank, assertionsEnabled} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; export function assertArrayOfStrings(identifier: string, value: any) { if (!assertionsEnabled() || isBlank(value)) { diff --git a/modules/@angular/compiler/src/compile_metadata.ts b/modules/@angular/compiler/src/compile_metadata.ts index ed8f10c1d5..2cf93b3d6b 100644 --- a/modules/@angular/compiler/src/compile_metadata.ts +++ b/modules/@angular/compiler/src/compile_metadata.ts @@ -1,3 +1,11 @@ +import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import { + CHANGE_DETECTION_STRATEGY_VALUES, + VIEW_ENCAPSULATION_VALUES, + LifecycleHooks, + LIFECYCLE_HOOKS_VALUES +} from '../core_private'; + import { isPresent, isBlank, @@ -9,24 +17,14 @@ import { Type, isString, RegExpWrapper, - StringWrapper, isArray -} from 'angular2/src/facade/lang'; -import {unimplemented, BaseException} from 'angular2/src/facade/exceptions'; +} from '../src/facade/lang'; +import {unimplemented, BaseException} from '../src/facade/exceptions'; import { StringMapWrapper, - MapWrapper, - SetWrapper, - ListWrapper -} from 'angular2/src/facade/collection'; -import { - ChangeDetectionStrategy, - CHANGE_DETECTION_STRATEGY_VALUES -} from 'angular2/src/core/change_detection/change_detection'; -import {ViewEncapsulation, VIEW_ENCAPSULATION_VALUES} from 'angular2/src/core/metadata/view'; -import {CssSelector} from 'angular2/src/compiler/selector'; +} from '../src/facade/collection'; +import {CssSelector} from './selector'; import {splitAtColon, sanitizeIdentifier} from './util'; -import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/metadata/lifecycle_hooks'; import {getUrlScheme} from './url_resolver'; // group 1: "property" from "[property]" @@ -318,9 +316,7 @@ export class CompileTokenMetadata implements CompileMetadataWithIdentifier { (isPresent(ak) && ak == token2.assetCacheKey); } - get name(): string { - return isPresent(this.value) ? sanitizeIdentifier(this.value) : this.identifier.name; - } + get name(): string { return isPresent(this.value) ? sanitizeIdentifier(this.value) : this.identifier.name; } } export class CompileTokenMap { diff --git a/modules/@angular/compiler/src/compiler.ts b/modules/@angular/compiler/src/compiler.ts index f889077898..24580037ae 100644 --- a/modules/@angular/compiler/src/compiler.ts +++ b/modules/@angular/compiler/src/compiler.ts @@ -1,30 +1,30 @@ -export {PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/src/core/platform_directives_and_pipes'; -export * from 'angular2/src/compiler/template_ast'; -export {TEMPLATE_TRANSFORMS} from 'angular2/src/compiler/template_parser'; +import {ComponentResolver, Type} from '@angular/core'; +import {assertionsEnabled} from '../src/facade/lang'; + +export * from './template_ast'; +export {TEMPLATE_TRANSFORMS} from './template_parser'; export {CompilerConfig, RenderTypes} from './config'; export * from './compile_metadata'; export * from './offline_compiler'; export {RuntimeCompiler} from './runtime_compiler'; -export * from 'angular2/src/compiler/url_resolver'; -export * from 'angular2/src/compiler/xhr'; +export * from './url_resolver'; +export * from './xhr'; export {ViewResolver} from './view_resolver'; export {DirectiveResolver} from './directive_resolver'; export {PipeResolver} from './pipe_resolver'; -import {assertionsEnabled, Type} from 'angular2/src/facade/lang'; -import {TemplateParser} from 'angular2/src/compiler/template_parser'; -import {HtmlParser} from 'angular2/src/compiler/html_parser'; -import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer'; -import {CompileMetadataResolver} from 'angular2/src/compiler/metadata_resolver'; -import {StyleCompiler} from 'angular2/src/compiler/style_compiler'; -import {ViewCompiler} from 'angular2/src/compiler/view_compiler/view_compiler'; +import {TemplateParser} from './template_parser'; +import {HtmlParser} from './html_parser'; +import {DirectiveNormalizer} from './directive_normalizer'; +import {CompileMetadataResolver} from './metadata_resolver'; +import {StyleCompiler} from './style_compiler'; +import {ViewCompiler} from './view_compiler/view_compiler'; import {CompilerConfig} from './config'; -import {ComponentResolver} from 'angular2/src/core/linker/component_resolver'; -import {RuntimeCompiler} from 'angular2/src/compiler/runtime_compiler'; -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry'; -import {UrlResolver, DEFAULT_PACKAGE_URL_PROVIDER} from 'angular2/src/compiler/url_resolver'; +import {RuntimeCompiler} from './runtime_compiler'; +import {ElementSchemaRegistry} from './schema/element_schema_registry'; +import {DomElementSchemaRegistry} from './schema/dom_element_schema_registry'; +import {UrlResolver, DEFAULT_PACKAGE_URL_PROVIDER} from './url_resolver'; import {Parser} from './expression_parser/parser'; import {Lexer} from './expression_parser/lexer'; import {ViewResolver} from './view_resolver'; diff --git a/modules/@angular/compiler/src/config.ts b/modules/@angular/compiler/src/config.ts index 18c3589408..fe29bfa7f4 100644 --- a/modules/@angular/compiler/src/config.ts +++ b/modules/@angular/compiler/src/config.ts @@ -1,5 +1,5 @@ -import {isBlank} from 'angular2/src/facade/lang'; -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {isBlank} from '../src/facade/lang'; +import {unimplemented} from '../src/facade/exceptions'; import {Identifiers} from './identifiers'; import {CompileIdentifierMetadata} from './compile_metadata'; diff --git a/modules/@angular/compiler/src/css/lexer.ts b/modules/@angular/compiler/src/css/lexer.ts index 1f79ea870e..f362970cd0 100644 --- a/modules/@angular/compiler/src/css/lexer.ts +++ b/modules/@angular/compiler/src/css/lexer.ts @@ -1,5 +1,5 @@ -import {NumberWrapper, StringWrapper, isPresent, resolveEnumToken} from "angular2/src/facade/lang"; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {NumberWrapper, StringWrapper, isPresent, resolveEnumToken} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import { isWhitespace, @@ -44,7 +44,7 @@ import { $CR, $LF, $VTAB -} from "angular2/src/compiler/chars"; +} from '@angular/compiler/src/chars'; export { $EOF, @@ -59,7 +59,7 @@ export { $COLON, $SEMICOLON, isWhitespace -} from "angular2/src/compiler/chars"; +} from '@angular/compiler/src/chars'; export enum CssTokenType { EOF, diff --git a/modules/@angular/compiler/src/css/parser.ts b/modules/@angular/compiler/src/css/parser.ts index 00267ccca6..7e9f620572 100644 --- a/modules/@angular/compiler/src/css/parser.ts +++ b/modules/@angular/compiler/src/css/parser.ts @@ -3,7 +3,7 @@ import { ParseSourceFile, ParseLocation, ParseError -} from "angular2/src/compiler/parse_util"; +} from '@angular/compiler/src/parse_util'; import { bitWiseOr, @@ -11,7 +11,7 @@ import { NumberWrapper, StringWrapper, isPresent -} from "angular2/src/facade/lang"; +} from '../../src/facade/lang'; import { CssLexerMode, @@ -32,9 +32,9 @@ import { $COLON, $SEMICOLON, isNewline -} from "angular2/src/compiler/css/lexer"; +} from '@angular/compiler/src/css/lexer'; -export {CssToken} from "angular2/src/compiler/css/lexer"; +export {CssToken} from '@angular/compiler/src/css/lexer'; export enum BlockType { Import, diff --git a/modules/@angular/compiler/src/directive_lifecycle_reflector.ts b/modules/@angular/compiler/src/directive_lifecycle_reflector.ts index 2d9e20d40d..f117c8754e 100644 --- a/modules/@angular/compiler/src/directive_lifecycle_reflector.ts +++ b/modules/@angular/compiler/src/directive_lifecycle_reflector.ts @@ -1,5 +1,7 @@ -import {Type} from 'angular2/src/facade/lang'; -import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks'; +import {LifecycleHooks} from '../core_private'; + +import {Type} from '../src/facade/lang'; + export function hasLifecycleHook(lcInterface: LifecycleHooks, token): boolean { if (!(token instanceof Type)) return false; diff --git a/modules/@angular/compiler/src/directive_normalizer.ts b/modules/@angular/compiler/src/directive_normalizer.ts index 5c5f749f03..35c622c390 100644 --- a/modules/@angular/compiler/src/directive_normalizer.ts +++ b/modules/@angular/compiler/src/directive_normalizer.ts @@ -1,27 +1,23 @@ +import {Injectable, ViewEncapsulation} from '@angular/core'; + +import {isPresent} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; +import {PromiseWrapper} from '../src/facade/async'; + import { CompileTypeMetadata, CompileDirectiveMetadata, CompileTemplateMetadata, - CompileProviderMetadata, - CompileTokenMetadata } from './compile_metadata'; -import {isPresent, isBlank, isArray} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {PromiseWrapper} from 'angular2/src/facade/async'; - -import {XHR} from 'angular2/src/compiler/xhr'; -import {UrlResolver} from 'angular2/src/compiler/url_resolver'; +import {XHR} from './xhr'; +import {UrlResolver} from './url_resolver'; import {extractStyleUrls, isStyleUrlResolvable} from './style_url_resolver'; -import {Injectable} from 'angular2/src/core/di'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; - import { HtmlAstVisitor, HtmlElementAst, HtmlTextAst, HtmlAttrAst, - HtmlAst, HtmlCommentAst, HtmlExpansionAst, HtmlExpansionCaseAst, @@ -29,7 +25,8 @@ import { } from './html_ast'; import {HtmlParser} from './html_parser'; -import {preparseElement, PreparsedElement, PreparsedElementType} from './template_preparser'; +import {preparseElement, PreparsedElementType} from './template_preparser'; + @Injectable() export class DirectiveNormalizer { diff --git a/modules/@angular/compiler/src/directive_resolver.ts b/modules/@angular/compiler/src/directive_resolver.ts index eba655f209..712ba73942 100644 --- a/modules/@angular/compiler/src/directive_resolver.ts +++ b/modules/@angular/compiler/src/directive_resolver.ts @@ -1,9 +1,6 @@ -import {resolveForwardRef, Injectable} from 'angular2/src/core/di'; -import {Type, isPresent, isBlank, stringify} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; - import { + resolveForwardRef, + Injectable, DirectiveMetadata, ComponentMetadata, InputMetadata, @@ -13,10 +10,15 @@ import { ContentChildrenMetadata, ViewChildrenMetadata, ContentChildMetadata, - ViewChildMetadata -} from 'angular2/src/core/metadata'; -import {reflector} from 'angular2/src/core/reflection/reflection'; -import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader'; + ViewChildMetadata, + reflector + } from '@angular/core'; +import {ReflectorReader} from '../core_private'; + +import {Type, isPresent, stringify} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; +import {ListWrapper, StringMapWrapper} from '../src/facade/collection'; + function _isDirectiveMetadata(type: any): boolean { return type instanceof DirectiveMetadata; diff --git a/modules/@angular/compiler/src/expression_parser/ast.ts b/modules/@angular/compiler/src/expression_parser/ast.ts index f2c138a3eb..ea91530914 100644 --- a/modules/@angular/compiler/src/expression_parser/ast.ts +++ b/modules/@angular/compiler/src/expression_parser/ast.ts @@ -1,4 +1,4 @@ -import {ListWrapper} from "angular2/src/facade/collection"; +import {ListWrapper} from '../../src/facade/collection'; export class AST { visit(visitor: AstVisitor, context: any = null): any { return null; } diff --git a/modules/@angular/compiler/src/expression_parser/lexer.ts b/modules/@angular/compiler/src/expression_parser/lexer.ts index 12e0e86fd2..ca0e1fe018 100644 --- a/modules/@angular/compiler/src/expression_parser/lexer.ts +++ b/modules/@angular/compiler/src/expression_parser/lexer.ts @@ -1,7 +1,7 @@ -import {Injectable} from 'angular2/src/core/di/decorators'; -import {ListWrapper, SetWrapper} from "angular2/src/facade/collection"; -import {NumberWrapper, StringJoiner, StringWrapper, isPresent} from "angular2/src/facade/lang"; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {Injectable} from '@angular/core'; +import {SetWrapper} from '../../src/facade/collection'; +import {NumberWrapper, StringJoiner, StringWrapper, isPresent} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; export enum TokenType { Character, diff --git a/modules/@angular/compiler/src/expression_parser/parser.ts b/modules/@angular/compiler/src/expression_parser/parser.ts index 4ff6ff1f6f..349b0642a7 100644 --- a/modules/@angular/compiler/src/expression_parser/parser.ts +++ b/modules/@angular/compiler/src/expression_parser/parser.ts @@ -1,7 +1,7 @@ -import {Injectable} from 'angular2/src/core/di/decorators'; -import {isBlank, isPresent, StringWrapper} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {Injectable} from '@angular/core'; +import {isBlank, isPresent, StringWrapper} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {ListWrapper} from '../../src/facade/collection'; import { Lexer, EOF, diff --git a/modules/@angular/compiler/src/facade b/modules/@angular/compiler/src/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/compiler/src/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/compiler/src/html_ast.ts b/modules/@angular/compiler/src/html_ast.ts index 6da9687043..ad354a14c2 100644 --- a/modules/@angular/compiler/src/html_ast.ts +++ b/modules/@angular/compiler/src/html_ast.ts @@ -1,4 +1,4 @@ -import {isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../src/facade/lang'; import {ParseSourceSpan} from './parse_util'; diff --git a/modules/@angular/compiler/src/html_lexer.ts b/modules/@angular/compiler/src/html_lexer.ts index 2b479604b6..e870bd6c2e 100644 --- a/modules/@angular/compiler/src/html_lexer.ts +++ b/modules/@angular/compiler/src/html_lexer.ts @@ -4,8 +4,8 @@ import { isPresent, isBlank, serializeEnum -} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +} from '../src/facade/lang'; +import {ListWrapper} from '../src/facade/collection'; import {ParseLocation, ParseError, ParseSourceFile, ParseSourceSpan} from './parse_util'; import {getHtmlTagDefinition, HtmlTagContentType, NAMED_ENTITIES} from './html_tags'; diff --git a/modules/@angular/compiler/src/html_parser.ts b/modules/@angular/compiler/src/html_parser.ts index ff66bd9948..0611c3197d 100644 --- a/modules/@angular/compiler/src/html_parser.ts +++ b/modules/@angular/compiler/src/html_parser.ts @@ -1,14 +1,11 @@ +import {Injectable} from '@angular/core'; + import { isPresent, isBlank, - StringWrapper, - stringify, - assertionsEnabled, - StringJoiner, - serializeEnum, -} from 'angular2/src/facade/lang'; +} from '../src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {ListWrapper} from '../src/facade/collection'; import { HtmlAst, @@ -20,10 +17,9 @@ import { HtmlExpansionCaseAst } from './html_ast'; -import {Injectable} from 'angular2/src/core/di'; import {HtmlToken, HtmlTokenType, tokenizeHtml} from './html_lexer'; -import {ParseError, ParseLocation, ParseSourceSpan} from './parse_util'; -import {HtmlTagDefinition, getHtmlTagDefinition, getNsPrefix, mergeNsAndName} from './html_tags'; +import {ParseError, ParseSourceSpan} from './parse_util'; +import {getHtmlTagDefinition, getNsPrefix, mergeNsAndName} from './html_tags'; export class HtmlTreeError extends ParseError { static create(elementName: string, span: ParseSourceSpan, msg: string): HtmlTreeError { diff --git a/modules/@angular/compiler/src/html_tags.ts b/modules/@angular/compiler/src/html_tags.ts index cda397756f..f91647636a 100644 --- a/modules/@angular/compiler/src/html_tags.ts +++ b/modules/@angular/compiler/src/html_tags.ts @@ -3,7 +3,7 @@ import { isBlank, normalizeBool, RegExpWrapper, -} from 'angular2/src/facade/lang'; +} from '../src/facade/lang'; // see http://www.w3.org/TR/html51/syntax.html#named-character-references // see https://html.spec.whatwg.org/multipage/entities.json diff --git a/modules/@angular/compiler/src/i18n/expander.ts b/modules/@angular/compiler/src/i18n/expander.ts index 6fc8127a9f..a833a810d0 100644 --- a/modules/@angular/compiler/src/i18n/expander.ts +++ b/modules/@angular/compiler/src/i18n/expander.ts @@ -8,9 +8,9 @@ import { HtmlExpansionAst, HtmlExpansionCaseAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; +} from '../html_ast'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {BaseException} from '../../src/facade/exceptions'; /** @@ -113,4 +113,4 @@ function _expandDefaultForm(ast: HtmlExpansionAst): HtmlElementAst { let switchAttr = new HtmlAttrAst("[ngSwitch]", ast.switchValue, ast.switchValueSourceSpan); return new HtmlElementAst("ul", [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/i18n/i18n_html_parser.ts b/modules/@angular/compiler/src/i18n/i18n_html_parser.ts index bcf22061a4..954506990e 100644 --- a/modules/@angular/compiler/src/i18n/i18n_html_parser.ts +++ b/modules/@angular/compiler/src/i18n/i18n_html_parser.ts @@ -1,5 +1,5 @@ -import {HtmlParser, HtmlParseTreeResult} from 'angular2/src/compiler/html_parser'; -import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util'; +import {HtmlParser, HtmlParseTreeResult} from '../html_parser'; +import {ParseSourceSpan, ParseError} from '../parse_util'; import { HtmlAst, HtmlAstVisitor, @@ -10,12 +10,12 @@ import { HtmlExpansionAst, HtmlExpansionCaseAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {RegExpWrapper, NumberWrapper, isPresent} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; -import {Message, id} from './message'; +} from '../html_ast'; +import {ListWrapper, StringMapWrapper} from '../../src/facade/collection'; +import {RegExpWrapper, NumberWrapper, isPresent} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {Parser} from '../expression_parser/parser'; +import {id} from './message'; import {expandNodes} from './expander'; import { messageFromAttribute, diff --git a/modules/@angular/compiler/src/i18n/message.ts b/modules/@angular/compiler/src/i18n/message.ts index 2a1798c58d..d5d6a602ed 100644 --- a/modules/@angular/compiler/src/i18n/message.ts +++ b/modules/@angular/compiler/src/i18n/message.ts @@ -1,4 +1,4 @@ -import {isPresent, escape} from 'angular2/src/facade/lang'; +import {isPresent, escape} from '../../src/facade/lang'; /** * A message extracted from a template. @@ -18,4 +18,4 @@ export function id(m: Message): string { let meaning = isPresent(m.meaning) ? m.meaning : ""; let content = isPresent(m.content) ? m.content : ""; return escape(`$ng|${meaning}|${content}`); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/i18n/message_extractor.ts b/modules/@angular/compiler/src/i18n/message_extractor.ts index 5630d44af7..a1c65cc1db 100644 --- a/modules/@angular/compiler/src/i18n/message_extractor.ts +++ b/modules/@angular/compiler/src/i18n/message_extractor.ts @@ -1,5 +1,5 @@ -import {HtmlParser} from 'angular2/src/compiler/html_parser'; -import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util'; +import {HtmlParser} from '../html_parser'; +import {ParseSourceSpan, ParseError} from '../parse_util'; import { HtmlAst, HtmlAstVisitor, @@ -8,10 +8,10 @@ import { HtmlTextAst, HtmlCommentAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; +} from '../html_ast'; +import {isPresent} from '../../src/facade/lang'; +import {StringMapWrapper} from '../../src/facade/collection'; +import {Parser} from '../expression_parser/parser'; import {Message, id} from './message'; import {expandNodes} from './expander'; import { @@ -175,4 +175,4 @@ export class MessageExtractor { } }); } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/i18n/shared.ts b/modules/@angular/compiler/src/i18n/shared.ts index d46798f75d..6b2414dd67 100644 --- a/modules/@angular/compiler/src/i18n/shared.ts +++ b/modules/@angular/compiler/src/i18n/shared.ts @@ -1,4 +1,4 @@ -import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util'; +import {ParseSourceSpan, ParseError} from '../parse_util'; import { HtmlAst, HtmlAstVisitor, @@ -9,10 +9,10 @@ import { HtmlExpansionAst, HtmlExpansionCaseAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; -import {isPresent, isBlank, StringWrapper} from 'angular2/src/facade/lang'; +} from '../html_ast'; +import {isPresent, isBlank, StringWrapper} from '../../src/facade/lang'; import {Message} from './message'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; +import {Parser} from '../expression_parser/parser'; export const I18N_ATTR = "i18n"; export const I18N_ATTR_PREFIX = "i18n-"; diff --git a/modules/@angular/compiler/src/i18n/xmb_serializer.ts b/modules/@angular/compiler/src/i18n/xmb_serializer.ts index 2dfc09244f..249d65b988 100644 --- a/modules/@angular/compiler/src/i18n/xmb_serializer.ts +++ b/modules/@angular/compiler/src/i18n/xmb_serializer.ts @@ -1,8 +1,8 @@ -import {isPresent, isBlank, RegExpWrapper} from 'angular2/src/facade/lang'; -import {HtmlAst, HtmlElementAst} from 'angular2/src/compiler/html_ast'; +import {isPresent, isBlank, RegExpWrapper} from '../../src/facade/lang'; +import {HtmlAst, HtmlElementAst} from '../html_ast'; import {Message, id} from './message'; -import {HtmlParser} from 'angular2/src/compiler/html_parser'; -import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util'; +import {HtmlParser} from '../html_parser'; +import {ParseSourceSpan, ParseError} from '../parse_util'; let _PLACEHOLDER_REGEXP = RegExpWrapper.create(`\\`); const _ID_ATTR = "id"; diff --git a/modules/@angular/compiler/src/identifiers.ts b/modules/@angular/compiler/src/identifiers.ts index efa5ed16bf..5af4222b3e 100644 --- a/modules/@angular/compiler/src/identifiers.ts +++ b/modules/@angular/compiler/src/identifiers.ts @@ -1,11 +1,33 @@ -import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata'; -import {AppView, DebugAppView} from 'angular2/src/core/linker/view'; -import {StaticNodeDebugInfo, DebugContext} from 'angular2/src/core/linker/debug_context'; import { - ViewUtils, + SimpleChange, + ChangeDetectorRef, + ChangeDetectionStrategy, + ElementRef, + ViewContainerRef, + Renderer, + RenderComponentType, + Injector, + QueryList, + ViewEncapsulation, + TemplateRef +} from '@angular/core'; +import { + AppElement, + AppView, + DebugAppView, + ChangeDetectorState, + checkBinding, + DebugContext, + devModeEqual, flattenNestedViewRenderNodes, interpolate, - checkBinding, + RenderDebugInfo, + StaticNodeDebugInfo, + TemplateRef_, + uninitialized, + ValueUnwrapper, + ViewType, + ViewUtils, castByValue, EMPTY_ARRAY, EMPTY_MAP, @@ -19,30 +41,14 @@ import { pureProxy8, pureProxy9, pureProxy10 -} from 'angular2/src/core/linker/view_utils'; -import { - uninitialized, - devModeEqual, - SimpleChange, - ValueUnwrapper, - ChangeDetectorRef, - ChangeDetectorState, - ChangeDetectionStrategy -} from 'angular2/src/core/change_detection/change_detection'; -import {AppElement} from 'angular2/src/core/linker/element'; -import {ElementRef} from 'angular2/src/core/linker/element_ref'; -import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref'; -import {Renderer, RenderComponentType, RenderDebugInfo} from 'angular2/src/core/render/api'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; -import {ViewType} from 'angular2/src/core/linker/view_type'; -import {QueryList} from 'angular2/src/core/linker'; -import {Injector} from 'angular2/src/core/di/injector'; -import {TemplateRef, TemplateRef_} from 'angular2/src/core/linker/template_ref'; -import {MODULE_SUFFIX} from './util'; +} from '../core_private'; -var APP_VIEW_MODULE_URL = 'asset:angular2/lib/src/core/linker/view' + MODULE_SUFFIX; -var VIEW_UTILS_MODULE_URL = 'asset:angular2/lib/src/core/linker/view_utils' + MODULE_SUFFIX; -var CD_MODULE_URL = 'asset:angular2/lib/src/core/change_detection/change_detection' + MODULE_SUFFIX; +import {CompileIdentifierMetadata, CompileTokenMetadata} from './compile_metadata'; +import {assetUrl} from './util'; + +var APP_VIEW_MODULE_URL = assetUrl('core', 'linker/view'); +var VIEW_UTILS_MODULE_URL = assetUrl('core', 'linker/view_utils'); +var CD_MODULE_URL = assetUrl('core', 'change_detection/change_detection'); // Reassign the imports to different variables so we can // define static variables with the name of the import. @@ -80,7 +86,7 @@ var impEMPTY_MAP = EMPTY_MAP; export class Identifiers { static ViewUtils = new CompileIdentifierMetadata({ name: 'ViewUtils', - moduleUrl: 'asset:angular2/lib/src/core/linker/view_utils' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/view_utils'), runtime: impViewUtils }); static AppView = new CompileIdentifierMetadata( @@ -89,59 +95,59 @@ export class Identifiers { {name: 'DebugAppView', moduleUrl: APP_VIEW_MODULE_URL, runtime: impDebugAppView}); static AppElement = new CompileIdentifierMetadata({ name: 'AppElement', - moduleUrl: 'asset:angular2/lib/src/core/linker/element' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/element'), runtime: impAppElement }); static ElementRef = new CompileIdentifierMetadata({ name: 'ElementRef', - moduleUrl: 'asset:angular2/lib/src/core/linker/element_ref' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/element_ref'), runtime: impElementRef }); static ViewContainerRef = new CompileIdentifierMetadata({ name: 'ViewContainerRef', - moduleUrl: 'asset:angular2/lib/src/core/linker/view_container_ref' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/view_container_ref'), runtime: impViewContainerRef }); static ChangeDetectorRef = new CompileIdentifierMetadata({ name: 'ChangeDetectorRef', - moduleUrl: 'asset:angular2/lib/src/core/change_detection/change_detector_ref' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'change_detection/change_detector_ref'), runtime: impChangeDetectorRef }); static RenderComponentType = new CompileIdentifierMetadata({ name: 'RenderComponentType', - moduleUrl: 'asset:angular2/lib/src/core/render/api' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'render/api'), runtime: impRenderComponentType }); static QueryList = new CompileIdentifierMetadata({ name: 'QueryList', - moduleUrl: 'asset:angular2/lib/src/core/linker/query_list' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/query_list'), runtime: impQueryList }); static TemplateRef = new CompileIdentifierMetadata({ name: 'TemplateRef', - moduleUrl: 'asset:angular2/lib/src/core/linker/template_ref' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/template_ref'), runtime: impTemplateRef }); static TemplateRef_ = new CompileIdentifierMetadata({ name: 'TemplateRef_', - moduleUrl: 'asset:angular2/lib/src/core/linker/template_ref' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'linker/template_ref'), runtime: impTemplateRef_ }); static ValueUnwrapper = new CompileIdentifierMetadata( {name: 'ValueUnwrapper', moduleUrl: CD_MODULE_URL, runtime: impValueUnwrapper}); static Injector = new CompileIdentifierMetadata({ name: 'Injector', - moduleUrl: `asset:angular2/lib/src/core/di/injector${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core', 'di/injector'), runtime: impInjector }); static ViewEncapsulation = new CompileIdentifierMetadata({ name: 'ViewEncapsulation', - moduleUrl: 'asset:angular2/lib/src/core/metadata/view' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'metadata/view'), runtime: impViewEncapsulation }); static ViewType = new CompileIdentifierMetadata({ name: 'ViewType', - moduleUrl: `asset:angular2/lib/src/core/linker/view_type${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core', 'linker/view_type'), runtime: impViewType }); static ChangeDetectionStrategy = new CompileIdentifierMetadata({ @@ -151,17 +157,17 @@ export class Identifiers { }); static StaticNodeDebugInfo = new CompileIdentifierMetadata({ name: 'StaticNodeDebugInfo', - moduleUrl: `asset:angular2/lib/src/core/linker/debug_context${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core', 'linker/debug_context'), runtime: impStaticNodeDebugInfo }); static DebugContext = new CompileIdentifierMetadata({ name: 'DebugContext', - moduleUrl: `asset:angular2/lib/src/core/linker/debug_context${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core', 'linker/debug_context'), runtime: impDebugContext }); static Renderer = new CompileIdentifierMetadata({ name: 'Renderer', - moduleUrl: 'asset:angular2/lib/src/core/render/api' + MODULE_SUFFIX, + moduleUrl: assetUrl('core', 'render/api'), runtime: impRenderer }); static SimpleChange = new CompileIdentifierMetadata( diff --git a/modules/@angular/compiler/src/legacy_template.ts b/modules/@angular/compiler/src/legacy_template.ts index d51041b709..1288616586 100644 --- a/modules/@angular/compiler/src/legacy_template.ts +++ b/modules/@angular/compiler/src/legacy_template.ts @@ -1,6 +1,11 @@ -import {Injectable, Provider, provide} from 'angular2/src/core/di'; +import {Injectable, Provider, provide} from '@angular/core'; -import {StringWrapper, RegExpWrapper, isBlank, isPresent} from 'angular2/src/facade/lang'; +import { + StringWrapper, + RegExpWrapper, + isBlank, + isPresent +} from '../src/facade/lang'; import { HtmlAstVisitor, diff --git a/modules/@angular/compiler/src/metadata_resolver.ts b/modules/@angular/compiler/src/metadata_resolver.ts index 9e086296c5..85083c6766 100644 --- a/modules/@angular/compiler/src/metadata_resolver.ts +++ b/modules/@angular/compiler/src/metadata_resolver.ts @@ -1,4 +1,26 @@ -import {resolveForwardRef} from 'angular2/src/core/di'; +import { + AttributeMetadata, + ReflectiveDependency, + OptionalMetadata, + ComponentMetadata, + SelfMetadata, + HostMetadata, + SkipSelfMetadata, + Provider, + PLATFORM_DIRECTIVES, PLATFORM_PIPES, + reflector, + Injectable, Inject, Optional, + ViewMetadata, + NoAnnotationError, + QueryMetadata, + resolveForwardRef, + InjectMetadata, + ViewQueryMetadata +} from '@angular/core'; +import { + constructDependencies, + LIFECYCLE_HOOKS_VALUES, ReflectorReader +} from '../core_private'; import { Type, isBlank, @@ -6,38 +28,20 @@ import { isArray, stringify, isString, - isStringMap, - RegExpWrapper, - StringWrapper -} from 'angular2/src/facade/lang'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {BaseException} from 'angular2/src/facade/exceptions'; + isStringMap +} from '../src/facade/lang'; +import {StringMapWrapper} from '../src/facade/collection'; +import {BaseException} from '../src/facade/exceptions'; import * as cpl from './compile_metadata'; -import * as md from 'angular2/src/core/metadata/directives'; -import * as dimd from 'angular2/src/core/metadata/di'; import {DirectiveResolver} from './directive_resolver'; import {PipeResolver} from './pipe_resolver'; import {ViewResolver} from './view_resolver'; -import {ViewMetadata} from 'angular2/src/core/metadata/view'; import {hasLifecycleHook} from './directive_lifecycle_reflector'; -import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/metadata/lifecycle_hooks'; -import {reflector} from 'angular2/src/core/reflection/reflection'; -import {Injectable, Inject, Optional} from 'angular2/src/core/di'; -import {PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/src/core/platform_directives_and_pipes'; import {MODULE_SUFFIX, sanitizeIdentifier, ValueTransformer, visitValue} from './util'; import {assertArrayOfStrings} from './assertions'; -import {getUrlScheme} from 'angular2/src/compiler/url_resolver'; -import {Provider} from 'angular2/src/core/di/provider'; -import { - OptionalMetadata, - SelfMetadata, - HostMetadata, - SkipSelfMetadata, - InjectMetadata -} from 'angular2/src/core/di/metadata'; -import {AttributeMetadata, QueryMetadata} from 'angular2/src/core/metadata/di'; -import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader'; -import {isProviderLiteral, createProvider} from '../core/di/provider_util'; +import {getUrlScheme} from './url_resolver'; +import {createProvider, isProviderLiteral} from "../core_private"; + @Injectable() export class CompileMetadataResolver { @@ -81,9 +85,9 @@ export class CompileMetadataResolver { var changeDetectionStrategy = null; var viewProviders = []; - if (dirMeta instanceof md.ComponentMetadata) { + if (dirMeta instanceof ComponentMetadata) { assertArrayOfStrings('styles', dirMeta.styles); - var cmpMeta = dirMeta; + var cmpMeta = dirMeta; var viewMeta = this._viewResolver.resolve(directiveType); assertArrayOfStrings('styles', viewMeta.styles); templateMeta = new cpl.CompileTemplateMetadata({ @@ -219,8 +223,8 @@ export class CompileMetadataResolver { let isSelf = false; let isSkipSelf = false; let isOptional = false; - let query: dimd.QueryMetadata = null; - let viewQuery: dimd.ViewQueryMetadata = null; + let query: QueryMetadata = null; + let viewQuery: ViewQueryMetadata = null; var token = null; if (isArray(param)) { (param) @@ -326,7 +330,7 @@ export class CompileMetadataResolver { }); } - getQueriesMetadata(queries: {[key: string]: dimd.QueryMetadata}, + getQueriesMetadata(queries: {[key: string]: QueryMetadata}, isViewQuery: boolean): cpl.CompileQueryMetadata[] { var compileQueries = []; StringMapWrapper.forEach(queries, (query, propertyName) => { @@ -337,7 +341,7 @@ export class CompileMetadataResolver { return compileQueries; } - getQueryMetadata(q: dimd.QueryMetadata, propertyName: string): cpl.CompileQueryMetadata { + getQueryMetadata(q: QueryMetadata, propertyName: string): cpl.CompileQueryMetadata { var selectors; if (q.isVarBindingQuery) { selectors = q.varBindings.map(varName => this.getTokenMetadata(varName)); @@ -399,9 +403,8 @@ function staticTypeModuleUrl(value: any): string { return isStaticType(value) ? value['moduleId'] : null; } - function calcTemplateBaseUrl(reflector: ReflectorReader, type: any, - cmpMetadata: md.ComponentMetadata): string { + cmpMetadata: ComponentMetadata): string { if (isStaticType(type)) { return type['filePath']; } @@ -410,7 +413,7 @@ function calcTemplateBaseUrl(reflector: ReflectorReader, type: any, var moduleId = cmpMetadata.moduleId; var scheme = getUrlScheme(moduleId); return isPresent(scheme) && scheme.length > 0 ? moduleId : - `package:${moduleId}${MODULE_SUFFIX}`; + `package:${moduleId}${MODULE_SUFFIX}`; } return reflector.importUri(type); diff --git a/modules/@angular/compiler/src/offline_compiler.ts b/modules/@angular/compiler/src/offline_compiler.ts index f5d3962064..0abfbad57c 100644 --- a/modules/@angular/compiler/src/offline_compiler.ts +++ b/modules/@angular/compiler/src/offline_compiler.ts @@ -1,3 +1,5 @@ +import {ComponentFactory} from '@angular/core'; + import { CompileDirectiveMetadata, CompileIdentifierMetadata, @@ -5,24 +7,23 @@ import { createHostComponentMeta } from './compile_metadata'; -import {BaseException, unimplemented} from 'angular2/src/facade/exceptions'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {StyleCompiler, StylesCompileDependency, StylesCompileResult} from './style_compiler'; +import {BaseException} from '../src/facade/exceptions'; +import {ListWrapper} from '../src/facade/collection'; +import {StyleCompiler, StylesCompileResult} from './style_compiler'; import {ViewCompiler, ViewCompileResult} from './view_compiler/view_compiler'; import {TemplateParser} from './template_parser'; import {DirectiveNormalizer} from './directive_normalizer'; import {OutputEmitter} from './output/abstract_emitter'; import * as o from './output/output_ast'; -import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; import { - MODULE_SUFFIX, + MODULE_SUFFIX, assetUrl, } from './util'; var _COMPONENT_FACTORY_IDENTIFIER = new CompileIdentifierMetadata({ name: 'ComponentFactory', runtime: ComponentFactory, - moduleUrl: `asset:angular2/lib/src/core/linker/component_factory${MODULE_SUFFIX}` + moduleUrl: assetUrl('core', 'linker/component_factory') }); export class SourceModule { diff --git a/modules/@angular/compiler/src/output/abstract_emitter.ts b/modules/@angular/compiler/src/output/abstract_emitter.ts index 2688a6a060..3e72ca2b8b 100644 --- a/modules/@angular/compiler/src/output/abstract_emitter.ts +++ b/modules/@angular/compiler/src/output/abstract_emitter.ts @@ -2,12 +2,9 @@ import { isPresent, isBlank, isString, - evalExpression, - RegExpWrapper, StringWrapper -} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {BaseException, unimplemented} from 'angular2/src/facade/exceptions'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import * as o from './output_ast'; var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g; diff --git a/modules/@angular/compiler/src/output/abstract_js_emitter.ts b/modules/@angular/compiler/src/output/abstract_js_emitter.ts index 1708c8ab77..99464c7163 100644 --- a/modules/@angular/compiler/src/output/abstract_js_emitter.ts +++ b/modules/@angular/compiler/src/output/abstract_js_emitter.ts @@ -1,5 +1,5 @@ -import {isPresent} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {isPresent} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import * as o from './output_ast'; import { EmitterVisitorContext, diff --git a/modules/@angular/compiler/src/output/dart_emitter.ts b/modules/@angular/compiler/src/output/dart_emitter.ts index 6af8b729bc..304b511e0a 100644 --- a/modules/@angular/compiler/src/output/dart_emitter.ts +++ b/modules/@angular/compiler/src/output/dart_emitter.ts @@ -1,14 +1,9 @@ import { - StringWrapper, - RegExpWrapper, isPresent, isBlank, - Math, - isString, isArray -} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {CompileIdentifierMetadata} from '../compile_metadata'; import * as o from './output_ast'; import { @@ -17,7 +12,6 @@ import { AbstractEmitterVisitor, CATCH_ERROR_VAR, CATCH_STACK_VAR, - escapeSingleQuoteString } from './abstract_emitter'; import {getImportModulePath, ImportEnv} from './path_util'; @@ -381,4 +375,4 @@ function getSuperConstructorCallExpr(stmt: o.Statement): o.Expression { function isConstType(type: o.Type): boolean { return isPresent(type) && type.hasModifier(o.TypeModifier.Const); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/output/interpretive_view.ts b/modules/@angular/compiler/src/output/interpretive_view.ts index 1bccafa6ae..4108411826 100644 --- a/modules/@angular/compiler/src/output/interpretive_view.ts +++ b/modules/@angular/compiler/src/output/interpretive_view.ts @@ -1,7 +1,7 @@ -import {isPresent} from 'angular2/src/facade/lang'; -import {AppView, DebugAppView} from 'angular2/src/core/linker/view'; -import {AppElement} from 'angular2/src/core/linker/element'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {AppElement, AppView, DebugAppView} from '../../core_private'; + +import {isPresent} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {InstanceFactory, DynamicInstance} from './output_interpreter'; export class InterpretiveAppViewInstanceFactory implements InstanceFactory { diff --git a/modules/@angular/compiler/src/output/js_emitter.ts b/modules/@angular/compiler/src/output/js_emitter.ts index 06a230adf6..b48d72d171 100644 --- a/modules/@angular/compiler/src/output/js_emitter.ts +++ b/modules/@angular/compiler/src/output/js_emitter.ts @@ -6,8 +6,8 @@ import { evalExpression, RegExpWrapper, StringWrapper -} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../facade/lang'; +import {BaseException} from '@angular/core'; import {OutputEmitter, EmitterVisitorContext} from './abstract_emitter'; import {AbstractJsEmitterVisitor} from './abstract_js_emitter'; import {getImportModulePath, ImportEnv} from './path_util'; diff --git a/modules/@angular/compiler/src/output/output_ast.ts b/modules/@angular/compiler/src/output/output_ast.ts index f2d285b6cf..21723fd0c1 100644 --- a/modules/@angular/compiler/src/output/output_ast.ts +++ b/modules/@angular/compiler/src/output/output_ast.ts @@ -1,4 +1,4 @@ -import {isString, isPresent, isBlank} from 'angular2/src/facade/lang'; +import {isString, isPresent, isBlank} from '../../src/facade/lang'; import {CompileIdentifierMetadata} from '../compile_metadata'; //// Types @@ -401,7 +401,6 @@ export class LiteralArrayExpr extends Expression { export class LiteralMapExpr extends Expression { public valueType: Type = null; - ; constructor(public entries: Array>, type: MapType = null) { super(type); if (isPresent(type)) { diff --git a/modules/@angular/compiler/src/output/output_interpreter.ts b/modules/@angular/compiler/src/output/output_interpreter.ts index 2b9ec6bc0b..408ca51235 100644 --- a/modules/@angular/compiler/src/output/output_interpreter.ts +++ b/modules/@angular/compiler/src/output/output_interpreter.ts @@ -1,16 +1,14 @@ +import {reflector} from '@angular/core'; import { isPresent, - isBlank, - isString, - evalExpression, IS_DART, FunctionWrapper -} from 'angular2/src/facade/lang'; -import {ObservableWrapper} from 'angular2/src/facade/async'; +} from '../../src/facade/lang'; +import {ObservableWrapper} from '../../src/facade/async'; +import {BaseException, unimplemented} from '../../src/facade/exceptions'; +import {ListWrapper} from '../../src/facade/collection'; + import * as o from './output_ast'; -import {reflector} from 'angular2/src/core/reflection/reflection'; -import {BaseException, unimplemented} from 'angular2/src/facade/exceptions'; -import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; import {debugOutputAstAsDart} from './dart_emitter'; import {debugOutputAstAsTypeScript} from './ts_emitter'; @@ -419,4 +417,4 @@ function _declareFn(varNames: string[], statements: o.Statement[], ctx: _Executi } var CATCH_ERROR_VAR = 'error'; -var CATCH_STACK_VAR = 'stack'; \ No newline at end of file +var CATCH_STACK_VAR = 'stack'; diff --git a/modules/@angular/compiler/src/output/output_jit.ts b/modules/@angular/compiler/src/output/output_jit.ts index bb2e01edb2..742b42c5d1 100644 --- a/modules/@angular/compiler/src/output/output_jit.ts +++ b/modules/@angular/compiler/src/output/output_jit.ts @@ -1,11 +1,7 @@ import { isPresent, - isBlank, - isString, evalExpression, - RegExpWrapper, - StringWrapper -} from 'angular2/src/facade/lang'; +} from '../../src/facade/lang'; import * as o from './output_ast'; import {EmitterVisitorContext} from './abstract_emitter'; import {AbstractJsEmitterVisitor} from './abstract_js_emitter'; diff --git a/modules/@angular/compiler/src/output/path_util.ts b/modules/@angular/compiler/src/output/path_util.ts index 9d7e156a82..fbd9dc6fe3 100644 --- a/modules/@angular/compiler/src/output/path_util.ts +++ b/modules/@angular/compiler/src/output/path_util.ts @@ -1,5 +1,5 @@ -import {BaseException} from 'angular2/src/facade/exceptions'; -import {isPresent, isBlank, RegExpWrapper, Math} from 'angular2/src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {isPresent, isBlank, RegExpWrapper, Math} from '../../src/facade/lang'; // asset:// var _ASSET_URL_RE = /asset:([^\/]+)\/([^\/]+)\/(.+)/g; diff --git a/modules/@angular/compiler/src/output/ts_emitter.ts b/modules/@angular/compiler/src/output/ts_emitter.ts index 6cf1ad949c..5521f0ed7e 100644 --- a/modules/@angular/compiler/src/output/ts_emitter.ts +++ b/modules/@angular/compiler/src/output/ts_emitter.ts @@ -2,14 +2,10 @@ import * as o from './output_ast'; import { isPresent, isBlank, - isString, - evalExpression, - RegExpWrapper, - StringWrapper, isArray -} from 'angular2/src/facade/lang'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {CompileIdentifierMetadata} from '../compile_metadata'; -import {BaseException} from 'angular2/src/facade/exceptions'; import { OutputEmitter, EmitterVisitorContext, diff --git a/modules/@angular/compiler/src/pipe_resolver.ts b/modules/@angular/compiler/src/pipe_resolver.ts index f947f3e7ba..905be3a058 100644 --- a/modules/@angular/compiler/src/pipe_resolver.ts +++ b/modules/@angular/compiler/src/pipe_resolver.ts @@ -1,9 +1,11 @@ -import {resolveForwardRef, Injectable} from 'angular2/src/core/di'; -import {Type, isPresent, stringify} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {PipeMetadata} from 'angular2/src/core/metadata'; -import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader'; -import {reflector} from 'angular2/src/core/reflection/reflection'; +import {resolveForwardRef, Injectable, PipeMetadata, reflector} from '@angular/core'; + +import { + ReflectorReader +} from '../core_private'; + +import {Type, isPresent, stringify} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; function _isPipeMetadata(type: any): boolean { return type instanceof PipeMetadata; diff --git a/modules/@angular/compiler/src/provider_parser.ts b/modules/@angular/compiler/src/provider_parser.ts index a32e1259f7..cb3844234f 100644 --- a/modules/@angular/compiler/src/provider_parser.ts +++ b/modules/@angular/compiler/src/provider_parser.ts @@ -1,23 +1,11 @@ -import {isPresent, isBlank, isArray, normalizeBlank} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {isPresent, isBlank, isArray, normalizeBlank} from '../src/facade/lang'; +import {ListWrapper} from '../src/facade/collection'; import { - TemplateAst, - TemplateAstVisitor, - NgContentAst, - EmbeddedTemplateAst, - ElementAst, - ReferenceAst, - BoundEventAst, - BoundElementPropertyAst, + VariableAst, AttrAst, - BoundTextAst, - TextAst, DirectiveAst, - BoundDirectivePropertyAst, - templateVisitAll, - PropertyBindingType, ProviderAst, - ProviderAstType + ProviderAstType, ReferenceAst } from './template_ast'; import { CompileTypeMetadata, @@ -29,7 +17,7 @@ import { CompileDiDependencyMetadata } from './compile_metadata'; import {Identifiers, identifierToken} from './identifiers'; -import {ParseSourceSpan, ParseError, ParseLocation} from './parse_util'; +import {ParseSourceSpan, ParseError} from './parse_util'; export class ProviderError extends ParseError { constructor(message: string, span: ParseSourceSpan) { super(span, message); } diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index b4a38a34d0..7c550e464b 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -1,63 +1,35 @@ +import {Injectable, ComponentFactory, ComponentResolver} from '@angular/core'; + import { IS_DART, Type, - Json, isBlank, - isPresent, - stringify, - evalExpression -} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; import { ListWrapper, - SetWrapper, - MapWrapper, - StringMapWrapper -} from 'angular2/src/facade/collection'; -import {PromiseWrapper} from 'angular2/src/facade/async'; +} from '../src/facade/collection'; +import {PromiseWrapper} from '../src/facade/async'; import { createHostComponentMeta, CompileDirectiveMetadata, - CompileTypeMetadata, - CompileTemplateMetadata, CompilePipeMetadata, - CompileMetadataWithType, CompileIdentifierMetadata } from './compile_metadata'; import { TemplateAst, - TemplateAstVisitor, - NgContentAst, - EmbeddedTemplateAst, - ElementAst, - BoundEventAst, - BoundElementPropertyAst, - AttrAst, - BoundTextAst, - TextAst, - DirectiveAst, - BoundDirectivePropertyAst, - templateVisitAll } from './template_ast'; -import {Injectable} from 'angular2/src/core/di'; import {StyleCompiler, StylesCompileDependency, StylesCompileResult} from './style_compiler'; import {ViewCompiler} from './view_compiler/view_compiler'; import {TemplateParser} from './template_parser'; import {DirectiveNormalizer} from './directive_normalizer'; import {CompileMetadataResolver} from './metadata_resolver'; -import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; -import { - ComponentResolver, - ReflectorComponentResolver -} from 'angular2/src/core/linker/component_resolver'; - import {CompilerConfig} from './config'; import * as ir from './output/output_ast'; import {jitStatements} from './output/output_jit'; import {interpretStatements} from './output/output_interpreter'; import {InterpretiveAppViewInstanceFactory} from './output/interpretive_view'; - -import {XHR} from 'angular2/src/compiler/xhr'; +import {XHR} from './xhr'; /** * An internal module of the Angular compiler that begins with component types, diff --git a/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts b/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts index f7e17a877f..870d9b8509 100644 --- a/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts +++ b/modules/@angular/compiler/src/schema/dom_element_schema_registry.ts @@ -1,29 +1,243 @@ -import {Injectable} from 'angular2/src/core/di'; -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {splitNsName} from 'angular2/src/compiler/html_tags'; - +import {Injectable} from '@angular/core'; +import {isPresent} from '../facade/lang'; +import {StringMapWrapper} from '../facade/collection'; import {ElementSchemaRegistry} from './element_schema_registry'; -const NAMESPACE_URIS = - /*@ts2dart_const*/ - {'xlink': 'http://www.w3.org/1999/xlink', 'svg': 'http://www.w3.org/2000/svg'}; +const EVENT = 'event'; +const BOOLEAN = 'boolean'; +const NUMBER = 'number'; +const STRING = 'string'; +const OBJECT = 'object'; + +/** + * This array represents the DOM schema. It encodes inheritance, properties, and events. + * + * ## Overview + * + * Each line represents one kind of element. The `element_inheritance` and properties are joined + * using `element_inheritance|preperties` syntax. + * + * ## Element Inheritance + * + * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`. + * Here the individual elements are separated by `,` (commas). Every element in the list + * has identical properties. + * + * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is + * specified then `""` (blank) element is assumed. + * + * NOTE: The blank element inherits from root `*` element, the super element of all elements. + * + * NOTE an element prefix such as `@svg:` has no special meaning to the schema. + * + * ## Properties + * + * Each element has a set of properties separated by `,` (commas). Each property can be prefixed + * by a special character designating its type: + * + * - (no prefix): property is a string. + * - `*`: property represents an event. + * - `!`: property is a boolean. + * - `#`: property is a number. + * - `%`: property is an object. + * + * ## Query + * + * The class creates an internal squas representaino which allows to easily answer the query of + * if a given property exist on a given element. + * + * NOTE: We don't yet support querying for types or events. + * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder. + */ +const SCHEMA: string[] = + /*@ts2dart_const*/ ([ + '*|%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop', + '^*|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*autocomplete,*autocompleteerror,*beforecopy,*beforecut,*beforepaste,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*copy,*cuechange,*cut,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*message,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*paste,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*search,*seeked,*seeking,*select,*selectstart,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerText,!spellcheck,%style,#tabIndex,title,!translate', + 'media|!autoplay,!controls,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,#playbackRate,preload,src,#volume', + '@svg:^*|*abort,*autocomplete,*autocompleteerror,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex', + '@svg:graphics^@svg:|', + '@svg:animation^@svg:|*begin,*end,*repeat', + '@svg:geometry^@svg:|', + '@svg:componentTransferFunction^@svg:|', + '@svg:gradient^@svg:|', + '@svg:textContent^@svg:graphics|', + '@svg:textPositioning^@svg:textContent|', + 'a|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,rel,rev,search,shape,target,text,type,username', + 'area|alt,coords,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,search,shape,target,username', + 'audio^media|', + 'br|clear', + 'base|href,target', + 'body|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink', + 'button|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value', + 'canvas|#height,#width', + 'content|select', + 'dl|!compact', + 'datalist|', + 'details|!open', + 'dialog|!open,returnValue', + 'dir|!compact', + 'div|align', + 'embed|align,height,name,src,type,width', + 'fieldset|!disabled,name', + 'font|color,face,size', + 'form|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target', + 'frame|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src', + 'frameset|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows', + 'hr|align,color,!noShade,size,width', + 'head|', + 'h1,h2,h3,h4,h5,h6|align', + 'html|version', + 'iframe|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,%sandbox,scrolling,src,srcdoc,width', + 'img|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,sizes,src,srcset,useMap,#vspace,#width', + 'input|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width', + 'keygen|!autofocus,challenge,!disabled,keytype,name', + 'li|type,#value', + 'label|htmlFor', + 'legend|align', + 'link|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,rel,%relList,rev,%sizes,target,type', + 'map|name', + 'marquee|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width', + 'menu|!compact', + 'meta|content,httpEquiv,name,scheme', + 'meter|#high,#low,#max,#min,#optimum,#value', + 'ins,del|cite,dateTime', + 'ol|!compact,!reversed,#start,type', + 'object|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width', + 'optgroup|!disabled,label', + 'option|!defaultSelected,!disabled,label,!selected,text,value', + 'output|defaultValue,%htmlFor,name,value', + 'p|align', + 'param|name,type,value,valueType', + 'picture|', + 'pre|#width', + 'progress|#max,#value', + 'q,blockquote,cite|', + 'script|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type', + 'select|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value', + 'shadow|', + 'source|media,sizes,src,srcset,type', + 'span|', + 'style|!disabled,media,type', + 'caption|align', + 'th,td|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width', + 'col,colgroup|align,ch,chOff,#span,vAlign,width', + 'table|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width', + 'tr|align,bgColor,ch,chOff,vAlign', + 'tfoot,thead,tbody|align,ch,chOff,vAlign', + 'template|', + 'textarea|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap', + 'title|text', + 'track|!default,kind,label,src,srclang', + 'ul|!compact,type', + 'unknown|', + 'video^media|#height,poster,#width', + '@svg:a^@svg:graphics|', + '@svg:animate^@svg:animation|', + '@svg:animateMotion^@svg:animation|', + '@svg:animateTransform^@svg:animation|', + '@svg:circle^@svg:geometry|', + '@svg:clipPath^@svg:graphics|', + '@svg:cursor^@svg:|', + '@svg:defs^@svg:graphics|', + '@svg:desc^@svg:|', + '@svg:discard^@svg:|', + '@svg:ellipse^@svg:geometry|', + '@svg:feBlend^@svg:|', + '@svg:feColorMatrix^@svg:|', + '@svg:feComponentTransfer^@svg:|', + '@svg:feComposite^@svg:|', + '@svg:feConvolveMatrix^@svg:|', + '@svg:feDiffuseLighting^@svg:|', + '@svg:feDisplacementMap^@svg:|', + '@svg:feDistantLight^@svg:|', + '@svg:feDropShadow^@svg:|', + '@svg:feFlood^@svg:|', + '@svg:feFuncA^@svg:componentTransferFunction|', + '@svg:feFuncB^@svg:componentTransferFunction|', + '@svg:feFuncG^@svg:componentTransferFunction|', + '@svg:feFuncR^@svg:componentTransferFunction|', + '@svg:feGaussianBlur^@svg:|', + '@svg:feImage^@svg:|', + '@svg:feMerge^@svg:|', + '@svg:feMergeNode^@svg:|', + '@svg:feMorphology^@svg:|', + '@svg:feOffset^@svg:|', + '@svg:fePointLight^@svg:|', + '@svg:feSpecularLighting^@svg:|', + '@svg:feSpotLight^@svg:|', + '@svg:feTile^@svg:|', + '@svg:feTurbulence^@svg:|', + '@svg:filter^@svg:|', + '@svg:foreignObject^@svg:graphics|', + '@svg:g^@svg:graphics|', + '@svg:image^@svg:graphics|', + '@svg:line^@svg:geometry|', + '@svg:linearGradient^@svg:gradient|', + '@svg:mpath^@svg:|', + '@svg:marker^@svg:|', + '@svg:mask^@svg:|', + '@svg:metadata^@svg:|', + '@svg:path^@svg:geometry|', + '@svg:pattern^@svg:|', + '@svg:polygon^@svg:geometry|', + '@svg:polyline^@svg:geometry|', + '@svg:radialGradient^@svg:gradient|', + '@svg:rect^@svg:geometry|', + '@svg:svg^@svg:graphics|#currentScale,#zoomAndPan', + '@svg:script^@svg:|type', + '@svg:set^@svg:animation|', + '@svg:stop^@svg:|', + '@svg:style^@svg:|!disabled,media,title,type', + '@svg:switch^@svg:graphics|', + '@svg:symbol^@svg:|', + '@svg:tspan^@svg:textPositioning|', + '@svg:text^@svg:textPositioning|', + '@svg:textPath^@svg:textContent|', + '@svg:title^@svg:|', + '@svg:use^@svg:graphics|', + '@svg:view^@svg:|#zoomAndPan' + ]); + +var attrToPropMap: {[name: string]: string} = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' +}; + @Injectable() -export class DomElementSchemaRegistry extends ElementSchemaRegistry { - private _protoElements = new Map(); +export class DomElementSchemaRegistry implements ElementSchemaRegistry { + schema = <{[element: string]: {[property: string]: string}}>{}; - private _getProtoElement(tagName: string): Element { - var element = this._protoElements.get(tagName); - if (isBlank(element)) { - var nsAndName = splitNsName(tagName); - element = isPresent(nsAndName[0]) ? - DOM.createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) : - DOM.createElement(nsAndName[1]); - this._protoElements.set(tagName, element); - } - return element; + constructor() { + SCHEMA.forEach(encodedType => { + var parts = encodedType.split('|'); + var properties = parts[1].split(','); + var typeParts = (parts[0] + '^').split('^'); + var typeName = typeParts[0]; + var type = <{[property: string]: string}>{}; + typeName.split(',').forEach(tag => this.schema[tag] = type); + var superType = this.schema[typeParts[1]]; + if (isPresent(superType)) { + StringMapWrapper.forEach(superType, (v, k) => type[k] = v); + } + properties.forEach((property: string) => { + if (property == '') { + } else if (property.startsWith('*')) { + // We don't yet support events. + // type[property.substring(1)] = EVENT; + } else if (property.startsWith('!')) { + type[property.substring(1)] = BOOLEAN; + } else if (property.startsWith('#')) { + type[property.substring(1)] = NUMBER; + } else if (property.startsWith('%')) { + type[property.substring(1)] = OBJECT; + } else { + type[property] = STRING; + } + }); + }); } hasProperty(tagName: string, propName: string): boolean { @@ -32,13 +246,16 @@ export class DomElementSchemaRegistry extends ElementSchemaRegistry { // once it is instantiated return true; } else { - var elm = this._getProtoElement(tagName); - return DOM.hasProperty(elm, propName); + var elementProperties = this.schema[tagName.toLowerCase()]; + if (!isPresent(elementProperties)) { + elementProperties = this.schema['unknown']; + } + return isPresent(elementProperties[propName]); } } getMappedPropName(propName: string): string { - var mappedPropName = StringMapWrapper.get(DOM.attrToPropMap, propName); + var mappedPropName = StringMapWrapper.get(attrToPropMap, propName); return isPresent(mappedPropName) ? mappedPropName : propName; } } diff --git a/modules/@angular/compiler/src/schema/element_schema_registry.ts b/modules/@angular/compiler/src/schema/element_schema_registry.ts index bfbd5db161..2e0d8c9317 100644 --- a/modules/@angular/compiler/src/schema/element_schema_registry.ts +++ b/modules/@angular/compiler/src/schema/element_schema_registry.ts @@ -2,3 +2,4 @@ export class ElementSchemaRegistry { hasProperty(tagName: string, propName: string): boolean { return true; } getMappedPropName(propName: string): string { return propName; } } + diff --git a/modules/@angular/compiler/src/selector.ts b/modules/@angular/compiler/src/selector.ts index 8cae83c2f4..df2a974339 100644 --- a/modules/@angular/compiler/src/selector.ts +++ b/modules/@angular/compiler/src/selector.ts @@ -1,12 +1,12 @@ -import {Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; +import {Map, ListWrapper} from '../src/facade/collection'; import { isPresent, isBlank, RegExpWrapper, RegExpMatcherWrapper, StringWrapper -} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; const _EMPTY_ATTR_VALUE = /*@ts2dart_const*/ ''; diff --git a/modules/@angular/compiler/src/shadow_css.ts b/modules/@angular/compiler/src/shadow_css.ts index 21775e2362..e8fdcc5ab2 100644 --- a/modules/@angular/compiler/src/shadow_css.ts +++ b/modules/@angular/compiler/src/shadow_css.ts @@ -1,4 +1,4 @@ -import {ListWrapper} from 'angular2/src/facade/collection'; +import {ListWrapper} from '../src/facade/collection'; import { StringWrapper, RegExp, @@ -6,7 +6,7 @@ import { RegExpMatcherWrapper, isPresent, isBlank -} from 'angular2/src/facade/lang'; +} from '../src/facade/lang'; /** * This file is a port of shadowCSS from webcomponents.js to TypeScript. diff --git a/modules/@angular/compiler/src/style_compiler.ts b/modules/@angular/compiler/src/style_compiler.ts index 69b37a0f7e..4c9cae2ae7 100644 --- a/modules/@angular/compiler/src/style_compiler.ts +++ b/modules/@angular/compiler/src/style_compiler.ts @@ -1,15 +1,13 @@ +import {ViewEncapsulation, Injectable} from '@angular/core'; import { - CompileTemplateMetadata, CompileIdentifierMetadata, CompileDirectiveMetadata } from './compile_metadata'; import * as o from './output/output_ast'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; -import {ShadowCss} from 'angular2/src/compiler/shadow_css'; -import {UrlResolver} from 'angular2/src/compiler/url_resolver'; +import {ShadowCss} from './shadow_css'; +import {UrlResolver} from './url_resolver'; import {extractStyleUrls} from './style_url_resolver'; -import {Injectable} from 'angular2/src/core/di'; -import {isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../src/facade/lang'; const COMPONENT_VARIABLE = '%COMP%'; const HOST_ATTR = /*@ts2dart_const*/ `_nghost-${COMPONENT_VARIABLE}`; @@ -74,4 +72,4 @@ function getStylesVarName(component: CompileDirectiveMetadata): string { result += `_${component.type.name}`; } return result; -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/style_url_resolver.ts b/modules/@angular/compiler/src/style_url_resolver.ts index bdd229e254..42fbce57c8 100644 --- a/modules/@angular/compiler/src/style_url_resolver.ts +++ b/modules/@angular/compiler/src/style_url_resolver.ts @@ -1,8 +1,8 @@ // Some of the code comes from WebComponents.JS // https://github.com/webcomponents/webcomponentsjs/blob/master/src/HTMLImports/path.js -import {RegExp, RegExpWrapper, StringWrapper, isPresent, isBlank} from 'angular2/src/facade/lang'; -import {UrlResolver} from 'angular2/src/compiler/url_resolver'; +import {RegExpWrapper, StringWrapper, isPresent, isBlank} from '../src/facade/lang'; +import {UrlResolver} from './url_resolver'; export class StyleWithImports { constructor(public style: string, public styleUrls: string[]) {} diff --git a/modules/@angular/compiler/src/template_ast.ts b/modules/@angular/compiler/src/template_ast.ts index 06d1e959ea..303391b6ee 100644 --- a/modules/@angular/compiler/src/template_ast.ts +++ b/modules/@angular/compiler/src/template_ast.ts @@ -1,11 +1,9 @@ import {AST} from './expression_parser/ast'; -import {isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../src/facade/lang'; import { CompileDirectiveMetadata, CompileTokenMetadata, CompileProviderMetadata, - CompileTokenMap, - CompileQueryMetadata } from './compile_metadata'; import {ParseSourceSpan} from './parse_util'; diff --git a/modules/@angular/compiler/src/template_parser.ts b/modules/@angular/compiler/src/template_parser.ts index a199a7fb52..71ba50a9a7 100644 --- a/modules/@angular/compiler/src/template_parser.ts +++ b/modules/@angular/compiler/src/template_parser.ts @@ -1,13 +1,13 @@ +import {Injectable, Inject, OpaqueToken, Optional} from '@angular/core'; +import {MAX_INTERPOLATION_VALUES, Console} from '../core_private'; + import { ListWrapper, StringMapWrapper, SetWrapper, - MapWrapper -} from 'angular2/src/facade/collection'; -import {RegExpWrapper, isPresent, StringWrapper, isBlank, isArray} from 'angular2/src/facade/lang'; -import {Injectable, Inject, OpaqueToken, Optional} from 'angular2/core'; -import {Console} from 'angular2/src/core/console'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../src/facade/collection'; +import {RegExpWrapper, isPresent, StringWrapper, isBlank, isArray} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; import { AST, Interpolation, @@ -18,18 +18,13 @@ import { } from './expression_parser/ast'; import {Parser} from './expression_parser/parser'; import { - CompileTokenMap, CompileDirectiveMetadata, CompilePipeMetadata, CompileMetadataWithType, - CompileProviderMetadata, - CompileTokenMetadata, - CompileTypeMetadata } from './compile_metadata'; import {HtmlParser} from './html_parser'; import {splitNsName, mergeNsAndName} from './html_tags'; import {ParseSourceSpan, ParseError, ParseLocation, ParseErrorLevel} from './parse_util'; -import {MAX_INTERPOLATION_VALUES} from 'angular2/src/core/linker/view_utils'; import { ElementAst, @@ -51,16 +46,15 @@ import { ProviderAstType, VariableAst } from './template_ast'; -import {CssSelector, SelectorMatcher} from 'angular2/src/compiler/selector'; +import {CssSelector, SelectorMatcher} from './selector'; -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {preparseElement, PreparsedElement, PreparsedElementType} from './template_preparser'; +import {ElementSchemaRegistry} from './schema/element_schema_registry'; +import {preparseElement, PreparsedElementType} from './template_preparser'; import {isStyleUrlResolvable} from './style_url_resolver'; import { HtmlAstVisitor, - HtmlAst, HtmlElementAst, HtmlAttrAst, HtmlTextAst, diff --git a/modules/@angular/compiler/src/template_preparser.ts b/modules/@angular/compiler/src/template_preparser.ts index 020bb47b98..4ecc74d8f2 100644 --- a/modules/@angular/compiler/src/template_preparser.ts +++ b/modules/@angular/compiler/src/template_preparser.ts @@ -1,5 +1,6 @@ +import {isBlank} from '../src/facade/lang'; + import {HtmlElementAst} from './html_ast'; -import {isBlank, isPresent} from 'angular2/src/facade/lang'; import {splitNsName} from './html_tags'; const NG_CONTENT_SELECT_ATTR = 'select'; diff --git a/modules/@angular/compiler/src/url_resolver.ts b/modules/@angular/compiler/src/url_resolver.ts index 094a17c7bf..3d134082b7 100644 --- a/modules/@angular/compiler/src/url_resolver.ts +++ b/modules/@angular/compiler/src/url_resolver.ts @@ -1,14 +1,11 @@ -import {Provider, Injectable, Inject} from 'angular2/src/core/di'; +import {Injectable, Inject, PACKAGE_ROOT_URL} from '@angular/core'; import { StringWrapper, isPresent, isBlank, RegExpWrapper, - normalizeBlank -} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {PACKAGE_ROOT_URL} from 'angular2/src/core/application_tokens'; +} from '../src/facade/lang'; + const _ASSET_SCHEME = 'asset:'; diff --git a/modules/@angular/compiler/src/util.ts b/modules/@angular/compiler/src/util.ts index a7a6b8f584..067498f6cc 100644 --- a/modules/@angular/compiler/src/util.ts +++ b/modules/@angular/compiler/src/util.ts @@ -6,8 +6,8 @@ import { isArray, isStrictStringMap, isPrimitive -} from 'angular2/src/facade/lang'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; +} from './facade/lang'; +import {StringMapWrapper} from './facade/collection'; export var MODULE_SUFFIX = IS_DART ? '.dart' : ''; @@ -69,3 +69,19 @@ export class ValueTransformer implements ValueVisitor { visitPrimitive(value: any, context: any): any { return value; } visitOther(value: any, context: any): any { return value; } } + +export function assetUrl(pkg: string, path: string = null, type:string = 'src'): string { + if (IS_DART) { + if (path == null) { + return `asset:angular2/${pkg}/${pkg}.dart`; + } else { + return `asset:angular2/lib/${pkg}/src/${path}.dart`; + } + } else { + if (path == null) { + return `asset:@angular/lib/${pkg}/index`; + } else { + return `asset:@angular/lib/${pkg}/src/${path}`; + } + } +} diff --git a/modules/@angular/compiler/src/view_compiler/compile_element.ts b/modules/@angular/compiler/src/view_compiler/compile_element.ts index 3b642ed9b9..d84bc2da09 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_element.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_element.ts @@ -1,10 +1,11 @@ -import {BaseException} from 'angular2/src/facade/exceptions'; +import {BaseException} from '@angular/core'; +import {isPresent, isBlank} from '../../src/facade/lang'; +import {ListWrapper, StringMapWrapper} from '../../src/facade/collection'; + import * as o from '../output/output_ast'; import {Identifiers, identifierToken} from '../identifiers'; import {InjectMethodVars} from './constants'; import {CompileView} from './compile_view'; -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; import {TemplateAst, ProviderAst, ProviderAstType, ReferenceAst} from '../template_ast'; import { CompileTokenMap, @@ -14,7 +15,6 @@ import { CompileProviderMetadata, CompileDiDependencyMetadata, CompileIdentifierMetadata, - CompileTypeMetadata, } from '../compile_metadata'; import {getPropertyInView, createDiTokenExpression, injectFromViewParentInjector} from './util'; import {CompileQuery, createQueryList, addQueryToTokenMap} from './compile_query'; @@ -424,4 +424,4 @@ class _ValueOutputAstTransformer extends ValueTransformer { throw new BaseException(`Illegal state: Don't now how to compile value ${value}`); } } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/src/view_compiler/compile_method.ts b/modules/@angular/compiler/src/view_compiler/compile_method.ts index 85bb07a0c3..de1c5642c8 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_method.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_method.ts @@ -1,5 +1,5 @@ -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; +import {isPresent} from '../../src/facade/lang'; +import {ListWrapper} from '../../src/facade/collection'; import * as o from '../output/output_ast'; import {TemplateAst} from '../template_ast'; diff --git a/modules/@angular/compiler/src/view_compiler/compile_pipe.ts b/modules/@angular/compiler/src/view_compiler/compile_pipe.ts index 63b456ed70..9550d7257e 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_pipe.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_pipe.ts @@ -1,5 +1,5 @@ -import {isBlank, isPresent} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {isBlank, isPresent} from '../facade/lang'; +import {BaseException} from '../facade/exceptions'; import * as o from '../output/output_ast'; import {CompileView} from './compile_view'; import {CompilePipeMetadata} from '../compile_metadata'; diff --git a/modules/@angular/compiler/src/view_compiler/compile_query.ts b/modules/@angular/compiler/src/view_compiler/compile_query.ts index 0819fc3141..a2c4a0b6c2 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_query.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_query.ts @@ -1,12 +1,11 @@ -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {isPresent, isBlank} from '../../src/facade/lang'; +import {ListWrapper} from '../../src/facade/collection'; import * as o from '../output/output_ast'; import {Identifiers} from '../identifiers'; import { CompileQueryMetadata, - CompileIdentifierMetadata, CompileTokenMap } from '../compile_metadata'; diff --git a/modules/@angular/compiler/src/view_compiler/compile_view.ts b/modules/@angular/compiler/src/view_compiler/compile_view.ts index 7b28d30c54..617702c5f5 100644 --- a/modules/@angular/compiler/src/view_compiler/compile_view.ts +++ b/modules/@angular/compiler/src/view_compiler/compile_view.ts @@ -1,5 +1,7 @@ -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper, MapWrapper} from 'angular2/src/facade/collection'; +import {ViewType} from '../../core_private'; + +import {isPresent, isBlank} from '../../src/facade/lang'; +import {ListWrapper} from '../../src/facade/collection'; import * as o from '../output/output_ast'; import {EventHandlerVars} from './constants'; @@ -8,7 +10,6 @@ import {NameResolver} from './expression_converter'; import {CompileElement, CompileNode} from './compile_element'; import {CompileMethod} from './compile_method'; import {CompilePipe} from './compile_pipe'; -import {ViewType} from 'angular2/src/core/linker/view_type'; import { CompileDirectiveMetadata, CompilePipeMetadata, @@ -19,8 +20,7 @@ import { getViewFactoryName, injectFromViewParentInjector, createDiTokenExpression, - getPropertyInView, - createPureProxy + getPropertyInView, createPureProxy } from './util'; import {CompilerConfig} from '../config'; import {CompileBinding} from './compile_binding'; diff --git a/modules/@angular/compiler/src/view_compiler/constants.ts b/modules/@angular/compiler/src/view_compiler/constants.ts index 3f752dbfc7..5415ccc1db 100644 --- a/modules/@angular/compiler/src/view_compiler/constants.ts +++ b/modules/@angular/compiler/src/view_compiler/constants.ts @@ -1,11 +1,8 @@ -import {serializeEnum, isBlank, resolveEnumToken} from 'angular2/src/facade/lang'; -import {CompileIdentifierMetadata, CompileTokenMetadata} from '../compile_metadata'; -import { - ChangeDetectorState, - ChangeDetectionStrategy -} from 'angular2/src/core/change_detection/change_detection'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; -import {ViewType} from 'angular2/src/core/linker/view_type'; +import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import {ChangeDetectorState, ViewType} from '../../core_private'; + +import {isBlank, resolveEnumToken} from '../../src/facade/lang'; +import {CompileIdentifierMetadata} from '../compile_metadata'; import * as o from '../output/output_ast'; import {Identifiers} from '../identifiers'; diff --git a/modules/@angular/compiler/src/view_compiler/event_binder.ts b/modules/@angular/compiler/src/view_compiler/event_binder.ts index cf0c70c776..8af6f040e5 100644 --- a/modules/@angular/compiler/src/view_compiler/event_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/event_binder.ts @@ -1,5 +1,6 @@ -import {isBlank, isPresent, StringWrapper} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; +import {isBlank, isPresent, StringWrapper} from '../../src/facade/lang'; +import {ListWrapper, StringMapWrapper} from '../../src/facade/collection'; + import {EventHandlerVars, ViewProperties} from './constants'; import * as o from '../output/output_ast'; diff --git a/modules/@angular/compiler/src/view_compiler/expression_converter.ts b/modules/@angular/compiler/src/view_compiler/expression_converter.ts index dd846f6096..ed34ccb62f 100644 --- a/modules/@angular/compiler/src/view_compiler/expression_converter.ts +++ b/modules/@angular/compiler/src/view_compiler/expression_converter.ts @@ -1,10 +1,10 @@ +import {BaseException} from '../../src/facade/exceptions'; +import {isBlank, isPresent, isArray} from '../../src/facade/lang'; + import * as cdAst from '../expression_parser/ast'; import * as o from '../output/output_ast'; import {Identifiers} from '../identifiers'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {isBlank, isPresent, isArray} from 'angular2/src/facade/lang'; - var IMPLICIT_RECEIVER = o.variable('#implicit'); export interface NameResolver { diff --git a/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts b/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts index 154b468875..639b48e30a 100644 --- a/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/lifecycle_binder.ts @@ -1,12 +1,13 @@ +import {LifecycleHooks} from '../../core_private'; import * as o from '../output/output_ast'; import {DetectChangesVars, ChangeDetectorStateEnum} from './constants'; -import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks'; - import {CompileDirectiveMetadata, CompilePipeMetadata} from '../compile_metadata'; import {DirectiveAst} from '../template_ast'; import {CompileElement} from './compile_element'; import {CompileView} from './compile_view'; + + var STATE_IS_NEVER_CHECKED = o.THIS_EXPR.prop('cdState').identical(ChangeDetectorStateEnum.NeverChecked); var NOT_THROW_ON_CHANGES = o.not(DetectChangesVars.throwOnChange); diff --git a/modules/@angular/compiler/src/view_compiler/property_binder.ts b/modules/@angular/compiler/src/view_compiler/property_binder.ts index 6be64c3381..7d1d05ce77 100644 --- a/modules/@angular/compiler/src/view_compiler/property_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/property_binder.ts @@ -1,3 +1,7 @@ +import {LifecycleHooks, isDefaultChangeDetectionStrategy} from '../../core_private'; + +import {isBlank, isPresent} from '../../src/facade/lang'; + import * as cdAst from '../expression_parser/ast'; import * as o from '../output/output_ast'; import {Identifiers} from '../identifiers'; @@ -8,23 +12,19 @@ import { BoundElementPropertyAst, DirectiveAst, PropertyBindingType, - TemplateAst } from '../template_ast'; -import {isBlank, isPresent, isArray} from 'angular2/src/facade/lang'; - import {CompileView} from './compile_view'; import {CompileElement, CompileNode} from './compile_element'; import {CompileMethod} from './compile_method'; -import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks'; -import {isDefaultChangeDetectionStrategy} from 'angular2/src/core/change_detection/constants'; import {camelCaseToDashCase} from '../util'; import {convertCdExpressionToIr} from './expression_converter'; import {CompileBinding} from './compile_binding'; + function createBindFieldExpr(exprIndex: number): o.ReadPropExpr { return o.THIS_EXPR.prop(`_expr_${exprIndex}`); } diff --git a/modules/@angular/compiler/src/view_compiler/util.ts b/modules/@angular/compiler/src/view_compiler/util.ts index 4bef3ed943..7bd73825a5 100644 --- a/modules/@angular/compiler/src/view_compiler/util.ts +++ b/modules/@angular/compiler/src/view_compiler/util.ts @@ -1,11 +1,10 @@ -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {isPresent, isBlank} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import * as o from '../output/output_ast'; import { CompileTokenMetadata, CompileDirectiveMetadata, - CompileIdentifierMetadata } from '../compile_metadata'; import {CompileView} from './compile_view'; import {Identifiers} from '../identifiers'; diff --git a/modules/@angular/compiler/src/view_compiler/view_binder.ts b/modules/@angular/compiler/src/view_compiler/view_binder.ts index d9faf6f310..1362dc39b9 100644 --- a/modules/@angular/compiler/src/view_compiler/view_binder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_binder.ts @@ -1,6 +1,6 @@ import { ListWrapper, -} from 'angular2/src/facade/collection'; +} from '../../src/facade/collection'; import { TemplateAst, TemplateAstVisitor, @@ -17,8 +17,6 @@ import { DirectiveAst, BoundDirectivePropertyAst, templateVisitAll, - PropertyBindingType, - ProviderAst } from '../template_ast'; import { bindRenderText, diff --git a/modules/@angular/compiler/src/view_compiler/view_builder.ts b/modules/@angular/compiler/src/view_compiler/view_builder.ts index 2fe73159e7..1513aa175c 100644 --- a/modules/@angular/compiler/src/view_compiler/view_builder.ts +++ b/modules/@angular/compiler/src/view_compiler/view_builder.ts @@ -1,5 +1,8 @@ -import {isPresent, isBlank, StringWrapper} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper, SetWrapper} from 'angular2/src/facade/collection'; +import {ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; +import {isDefaultChangeDetectionStrategy, ViewType} from '../../core_private'; + +import {isPresent, StringWrapper} from '../../src/facade/lang'; +import {ListWrapper, StringMapWrapper, SetWrapper} from '../../src/facade/collection'; import * as o from '../output/output_ast'; import {Identifiers, identifierToken} from '../identifiers'; @@ -12,10 +15,6 @@ import { ChangeDetectionStrategyEnum, ViewProperties } from './constants'; -import { - ChangeDetectionStrategy, - isDefaultChangeDetectionStrategy -} from 'angular2/src/core/change_detection/change_detection'; import {CompileView} from './compile_view'; import {CompileElement, CompileNode} from './compile_element'; @@ -36,15 +35,10 @@ import { DirectiveAst, BoundDirectivePropertyAst, templateVisitAll, - PropertyBindingType, - ProviderAst } from '../template_ast'; import {getViewFactoryName, createFlatArray, createDiTokenExpression} from './util'; -import {ViewType} from 'angular2/src/core/linker/view_type'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; - import { CompileIdentifierMetadata, CompileDirectiveMetadata, diff --git a/modules/@angular/compiler/src/view_compiler/view_compiler.ts b/modules/@angular/compiler/src/view_compiler/view_compiler.ts index ae64c4a953..49fb03a58e 100644 --- a/modules/@angular/compiler/src/view_compiler/view_compiler.ts +++ b/modules/@angular/compiler/src/view_compiler/view_compiler.ts @@ -1,13 +1,10 @@ -import {Injectable} from 'angular2/src/core/di'; - +import {Injectable} from '@angular/core'; import * as o from '../output/output_ast'; import {CompileElement} from './compile_element'; import {CompileView} from './compile_view'; import {buildView, finishView, ViewCompileDependency} from './view_builder'; import {bindView} from './view_binder'; - import {CompileDirectiveMetadata, CompilePipeMetadata} from '../compile_metadata'; - import {TemplateAst} from '../template_ast'; import {CompilerConfig} from '../config'; diff --git a/modules/@angular/compiler/src/view_resolver.ts b/modules/@angular/compiler/src/view_resolver.ts index 81615facb1..9df4184b7e 100644 --- a/modules/@angular/compiler/src/view_resolver.ts +++ b/modules/@angular/compiler/src/view_resolver.ts @@ -1,13 +1,17 @@ -import {Injectable} from 'angular2/src/core/di'; -import {ViewMetadata} from 'angular2/src/core/metadata/view'; -import {ComponentMetadata} from 'angular2/src/core/metadata/directives'; +import { + Injectable, + ViewMetadata, + ComponentMetadata, + reflector, +} from '@angular/core'; -import {Type, stringify, isBlank, isPresent} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {Map} from 'angular2/src/facade/collection'; +import { + ReflectorReader +} from '../core_private'; -import {ReflectorReader} from 'angular2/src/core/reflection/reflector_reader'; -import {reflector} from 'angular2/src/core/reflection/reflection'; +import {Type, stringify, isBlank, isPresent} from '../src/facade/lang'; +import {BaseException} from '../src/facade/exceptions'; +import {Map} from '../src/facade/collection'; /** * Resolves types to {@link ViewMetadata}. diff --git a/modules/@angular/compiler/test/compile_metadata_spec.ts b/modules/@angular/compiler/test/compile_metadata_spec.ts index 9bf835532d..68dce07d1f 100644 --- a/modules/@angular/compiler/test/compile_metadata_spec.ts +++ b/modules/@angular/compiler/test/compile_metadata_spec.ts @@ -1,16 +1,13 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import { CompileDirectiveMetadata, @@ -22,10 +19,10 @@ import { CompileIdentifierMetadata, CompileFactoryMetadata, CompileTokenMetadata -} from 'angular2/src/compiler/compile_metadata'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; -import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; -import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks'; +} from '@angular/compiler/src/compile_metadata'; +import {ViewEncapsulation} from '@angular/core/src/metadata/view'; +import {ChangeDetectionStrategy} from '@angular/core/src/change_detection'; +import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks'; export function main() { describe('CompileMetadata', () => { diff --git a/modules/@angular/compiler/test/css/lexer_spec.ts b/modules/@angular/compiler/test/css/lexer_spec.ts index ff3c01f326..86b5df0ea5 100644 --- a/modules/@angular/compiler/test/css/lexer_spec.ts +++ b/modules/@angular/compiler/test/css/lexer_spec.ts @@ -7,9 +7,9 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {isPresent} from "angular2/src/facade/lang"; +import {isPresent} from '../../src/facade/lang'; import { CssToken, @@ -17,7 +17,7 @@ import { CssLexer, CssLexerMode, CssTokenType -} from 'angular2/src/compiler/css/lexer'; +} from '@angular/compiler/src/css/lexer'; export function main() { function tokenize(code, trackComments: boolean = false, diff --git a/modules/@angular/compiler/test/css/parser_spec.ts b/modules/@angular/compiler/test/css/parser_spec.ts index 33bc82824e..de9fa602f5 100644 --- a/modules/@angular/compiler/test/css/parser_spec.ts +++ b/modules/@angular/compiler/test/css/parser_spec.ts @@ -7,9 +7,9 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {BaseException} from '../../src/facade/exceptions'; import { ParsedCssResult, @@ -29,9 +29,9 @@ import { CssRuleAST, CssBlockAST, CssParseError -} from 'angular2/src/compiler/css/parser'; +} from '@angular/compiler/src/css/parser'; -import {CssLexer} from 'angular2/src/compiler/css/lexer'; +import {CssLexer} from '@angular/compiler/src/css/lexer'; export function assertTokens(tokens, valuesArr) { for (var i = 0; i < tokens.length; i++) { diff --git a/modules/@angular/compiler/test/css/visitor_spec.ts b/modules/@angular/compiler/test/css/visitor_spec.ts index d6c9b7696b..1719980578 100644 --- a/modules/@angular/compiler/test/css/visitor_spec.ts +++ b/modules/@angular/compiler/test/css/visitor_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {NumberWrapper, StringWrapper, isPresent} from "angular2/src/facade/lang"; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {NumberWrapper, StringWrapper, isPresent} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import { CssToken, @@ -33,9 +33,9 @@ import { CssBlockAST, CssASTVisitor, CssUnknownTokenListAST -} from 'angular2/src/compiler/css/parser'; +} from '@angular/compiler/src/css/parser'; -import {CssLexer} from 'angular2/src/compiler/css/lexer'; +import {CssLexer} from '@angular/compiler/src/css/lexer'; function _assertTokens(tokens, valuesArr) { for (var i = 0; i < tokens.length; i++) { diff --git a/modules/@angular/compiler/test/directive_lifecycle_spec.ts b/modules/@angular/compiler/test/directive_lifecycle_spec.ts index 9c41ccc0a8..257e01de8b 100644 --- a/modules/@angular/compiler/test/directive_lifecycle_spec.ts +++ b/modules/@angular/compiler/test/directive_lifecycle_spec.ts @@ -1,20 +1,16 @@ import { - AsyncTestCompleter, beforeEach, xdescribe, ddescribe, describe, - el, expect, iit, inject, it, - SpyObject, - proxy -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {hasLifecycleHook} from 'angular2/src/compiler/directive_lifecycle_reflector'; -import {LifecycleHooks} from 'angular2/src/core/metadata/lifecycle_hooks'; +import {hasLifecycleHook} from '@angular/compiler/src/directive_lifecycle_reflector'; +import {LifecycleHooks} from '@angular/core/src/metadata/lifecycle_hooks'; export function main() { describe('Create DirectiveMetadata', () => { diff --git a/modules/@angular/compiler/test/directive_normalizer_spec.ts b/modules/@angular/compiler/test/directive_normalizer_spec.ts index f6b51d2ec9..09404f3af0 100644 --- a/modules/@angular/compiler/test/directive_normalizer_spec.ts +++ b/modules/@angular/compiler/test/directive_normalizer_spec.ts @@ -1,24 +1,21 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder, beforeEachProviders -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {CompileTypeMetadata, CompileTemplateMetadata} from '@angular/compiler/src/compile_metadata'; +import {ViewEncapsulation} from '@angular/core/src/metadata/view'; -import {CompileTypeMetadata, CompileTemplateMetadata} from 'angular2/src/compiler/compile_metadata'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; - -import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer'; -import {XHR} from 'angular2/src/compiler/xhr'; -import {MockXHR} from 'angular2/src/compiler/xhr_mock'; +import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer'; +import {XHR} from '@angular/compiler/src/xhr'; +import {MockXHR} from '@angular/compiler/testing'; import {TEST_PROVIDERS} from './test_bindings'; export function main() { diff --git a/modules/@angular/compiler/test/directive_resolver_spec.ts b/modules/@angular/compiler/test/directive_resolver_spec.ts index e1901a8c7c..2e2d4f3306 100644 --- a/modules/@angular/compiler/test/directive_resolver_spec.ts +++ b/modules/@angular/compiler/test/directive_resolver_spec.ts @@ -1,5 +1,5 @@ -import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/testing_internal'; -import {DirectiveResolver} from 'angular2/src/compiler/directive_resolver'; +import {ddescribe, describe, it, iit, expect, beforeEach} from '@angular/core/testing'; +import {DirectiveResolver} from '@angular/compiler/src/directive_resolver'; import { DirectiveMetadata, Directive, @@ -15,7 +15,7 @@ import { ContentChildMetadata, ViewChild, ViewChildMetadata -} from 'angular2/src/core/metadata'; +} from '@angular/core/src/metadata'; @Directive({selector: 'someDirective'}) class SomeDirective { diff --git a/modules/@angular/compiler/test/expression_parser/lexer_spec.ts b/modules/@angular/compiler/test/expression_parser/lexer_spec.ts index eadbb83f8a..f402d193bb 100644 --- a/modules/@angular/compiler/test/expression_parser/lexer_spec.ts +++ b/modules/@angular/compiler/test/expression_parser/lexer_spec.ts @@ -1,8 +1,8 @@ -import {ddescribe, describe, it, expect} from 'angular2/testing_internal'; +import {ddescribe, describe, it, expect} from '@angular/core/testing'; -import {Lexer, Token} from 'angular2/src/compiler/expression_parser/lexer'; +import {Lexer, Token} from '@angular/compiler/src/expression_parser/lexer'; -import {StringWrapper} from "angular2/src/facade/lang"; +import {StringWrapper} from '../../src/facade/lang'; function lex(text: string): any[] { return new Lexer().tokenize(text); diff --git a/modules/@angular/compiler/test/expression_parser/parser_spec.ts b/modules/@angular/compiler/test/expression_parser/parser_spec.ts index 2cfcab4025..de3c298905 100644 --- a/modules/@angular/compiler/test/expression_parser/parser_spec.ts +++ b/modules/@angular/compiler/test/expression_parser/parser_spec.ts @@ -1,9 +1,9 @@ -import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/testing_internal'; -import {isBlank, isPresent} from 'angular2/src/facade/lang'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; +import {ddescribe, describe, it, xit, iit, expect, beforeEach} from '@angular/core/testing'; +import {isBlank, isPresent} from '../../src/facade/lang'; +import {Parser} from '@angular/compiler/src/expression_parser/parser'; import {Unparser} from './unparser'; -import {Lexer} from 'angular2/src/compiler/expression_parser/lexer'; -import {BindingPipe, LiteralPrimitive, AST} from 'angular2/src/compiler/expression_parser/ast'; +import {Lexer} from '@angular/compiler/src/expression_parser/lexer'; +import {BindingPipe, LiteralPrimitive, AST} from '@angular/compiler/src/expression_parser/ast'; export function main() { function createParser() { return new Parser(new Lexer()); } diff --git a/modules/@angular/compiler/test/expression_parser/unparser.ts b/modules/@angular/compiler/test/expression_parser/unparser.ts index 5f9d1a2515..bc1b21ce34 100644 --- a/modules/@angular/compiler/test/expression_parser/unparser.ts +++ b/modules/@angular/compiler/test/expression_parser/unparser.ts @@ -21,10 +21,10 @@ import { Quote, SafePropertyRead, SafeMethodCall -} from 'angular2/src/compiler/expression_parser/ast'; +} from '../../src/expression_parser/ast'; -import {StringWrapper, isPresent, isString} from 'angular2/src/facade/lang'; +import {StringWrapper, isPresent, isString} from '../../src/facade/lang'; export class Unparser implements AstVisitor { private static _quoteRegExp = /"/g; diff --git a/modules/@angular/compiler/test/html_ast_spec_utils.ts b/modules/@angular/compiler/test/html_ast_spec_utils.ts index af58c224f6..f894133c43 100644 --- a/modules/@angular/compiler/test/html_ast_spec_utils.ts +++ b/modules/@angular/compiler/test/html_ast_spec_utils.ts @@ -1,4 +1,4 @@ -import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from 'angular2/src/compiler/html_parser'; +import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from '@angular/compiler/src/html_parser'; import { HtmlAst, HtmlAstVisitor, @@ -9,9 +9,9 @@ import { HtmlExpansionAst, HtmlExpansionCaseAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; -import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '@angular/compiler/src/html_ast'; +import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util'; +import {BaseException} from '../src/facade/exceptions'; export function humanizeDom(parseResult: HtmlParseTreeResult): any[] { if (parseResult.errors.length > 0) { diff --git a/modules/@angular/compiler/test/html_lexer_spec.ts b/modules/@angular/compiler/test/html_lexer_spec.ts index 63f57d231d..e0c08b045b 100644 --- a/modules/@angular/compiler/test/html_lexer_spec.ts +++ b/modules/@angular/compiler/test/html_lexer_spec.ts @@ -7,16 +7,16 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '@angular/core/testing/testing_internal'; +import {BaseException} from '../src/facade/exceptions'; import { tokenizeHtml, HtmlToken, HtmlTokenType, HtmlTokenError -} from 'angular2/src/compiler/html_lexer'; -import {ParseSourceSpan, ParseLocation, ParseSourceFile} from 'angular2/src/compiler/parse_util'; +} from '@angular/compiler/src/html_lexer'; +import {ParseSourceSpan, ParseLocation, ParseSourceFile} from '@angular/compiler/src/parse_util'; export function main() { describe('HtmlLexer', () => { diff --git a/modules/@angular/compiler/test/html_parser_spec.ts b/modules/@angular/compiler/test/html_parser_spec.ts index 945ab983ae..dbeb8c6c1b 100644 --- a/modules/@angular/compiler/test/html_parser_spec.ts +++ b/modules/@angular/compiler/test/html_parser_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {HtmlTokenType} from 'angular2/src/compiler/html_lexer'; -import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from 'angular2/src/compiler/html_parser'; +import {HtmlTokenType} from '@angular/compiler/src/html_lexer'; +import {HtmlParser, HtmlParseTreeResult, HtmlTreeError} from '@angular/compiler/src/html_parser'; import { HtmlAst, HtmlAstVisitor, @@ -21,8 +21,8 @@ import { htmlVisitAll, HtmlExpansionAst, HtmlExpansionCaseAst -} from 'angular2/src/compiler/html_ast'; -import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util'; +} from '@angular/compiler/src/html_ast'; +import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util'; import {humanizeDom, humanizeDomSourceSpans, humanizeLineColumn} from './html_ast_spec_utils'; export function main() { @@ -389,4 +389,4 @@ export function humanizeErrors(errors: ParseError[]): any[] { // Tokenizer errors return [(error).tokenType, error.msg, humanizeLineColumn(error.span.start)]; }); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/i18n/i18n_html_parser_spec.ts b/modules/@angular/compiler/test/i18n/i18n_html_parser_spec.ts index 0b4f2e93c7..2985501805 100644 --- a/modules/@angular/compiler/test/i18n/i18n_html_parser_spec.ts +++ b/modules/@angular/compiler/test/i18n/i18n_html_parser_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -9,15 +8,15 @@ import { it, xdescribe, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {I18nHtmlParser} from 'angular2/src/i18n/i18n_html_parser'; -import {Message, id} from 'angular2/src/i18n/message'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; -import {Lexer} from 'angular2/src/compiler/expression_parser/lexer'; +import {I18nHtmlParser} from '@angular/compiler/src/i18n/i18n_html_parser'; +import {Message, id} from '@angular/compiler/src/i18n/message'; +import {Parser} from '@angular/compiler/src/expression_parser/parser'; +import {Lexer} from '@angular/compiler/src/expression_parser/lexer'; -import {StringMapWrapper} from 'angular2/src/facade/collection'; -import {HtmlParser, HtmlParseTreeResult} from 'angular2/src/compiler/html_parser'; +import {StringMapWrapper} from '../../src/facade/collection'; +import {HtmlParser, HtmlParseTreeResult} from '@angular/compiler/src/html_parser'; import { HtmlAst, HtmlAstVisitor, @@ -26,10 +25,10 @@ import { HtmlTextAst, HtmlCommentAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; -import {serializeXmb, deserializeXmb} from 'angular2/src/i18n/xmb_serializer'; -import {ParseError, ParseLocation} from 'angular2/src/compiler/parse_util'; -import {humanizeDom} from '../../test/compiler/html_ast_spec_utils'; +} from '@angular/compiler/src/html_ast'; +import {serializeXmb, deserializeXmb} from '@angular/compiler/src/i18n/xmb_serializer'; +import {ParseError, ParseLocation} from '@angular/compiler/src/parse_util'; +import {humanizeDom} from '@angular/compiler/test/html_ast_spec_utils'; export function main() { describe('I18nHtmlParser', () => { diff --git a/modules/@angular/compiler/test/i18n/message_extractor_spec.ts b/modules/@angular/compiler/test/i18n/message_extractor_spec.ts index 430b624161..eb4b9ce5ce 100644 --- a/modules/@angular/compiler/test/i18n/message_extractor_spec.ts +++ b/modules/@angular/compiler/test/i18n/message_extractor_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, describe, ddescribe, @@ -9,13 +8,13 @@ import { it, xdescribe, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {HtmlParser} from 'angular2/src/compiler/html_parser'; -import {MessageExtractor, removeDuplicates} from 'angular2/src/i18n/message_extractor'; -import {Message} from 'angular2/src/i18n/message'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; -import {Lexer} from 'angular2/src/compiler/expression_parser/lexer'; +import {HtmlParser} from '@angular/compiler/src/html_parser'; +import {MessageExtractor, removeDuplicates} from '@angular/compiler/src/i18n/message_extractor'; +import {Message} from '@angular/compiler/src/i18n/message'; +import {Parser} from '@angular/compiler/src/expression_parser/parser'; +import {Lexer} from '@angular/compiler/src/expression_parser/lexer'; export function main() { describe('MessageExtractor', () => { diff --git a/modules/@angular/compiler/test/i18n/message_spec.ts b/modules/@angular/compiler/test/i18n/message_spec.ts index cab79c1fac..db91ffd667 100644 --- a/modules/@angular/compiler/test/i18n/message_spec.ts +++ b/modules/@angular/compiler/test/i18n/message_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -9,9 +8,9 @@ import { it, xdescribe, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {Message, id} from 'angular2/src/i18n/message'; +import {Message, id} from '@angular/compiler/src/i18n/message'; export function main() { describe('Message', () => { diff --git a/modules/@angular/compiler/test/i18n/xmb_serializer_spec.ts b/modules/@angular/compiler/test/i18n/xmb_serializer_spec.ts index 839e87a828..fbe280004f 100644 --- a/modules/@angular/compiler/test/i18n/xmb_serializer_spec.ts +++ b/modules/@angular/compiler/test/i18n/xmb_serializer_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -9,12 +8,12 @@ import { it, xdescribe, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {HtmlAst} from 'angular2/src/compiler/html_ast'; -import {Message, id} from 'angular2/src/i18n/message'; -import {serializeXmb, deserializeXmb} from 'angular2/src/i18n/xmb_serializer'; -import {ParseSourceSpan, ParseError} from 'angular2/src/compiler/parse_util'; +import {HtmlAst} from '@angular/compiler/src/html_ast'; +import {Message, id} from '@angular/compiler/src/i18n/message'; +import {serializeXmb, deserializeXmb} from '@angular/compiler/src/i18n/xmb_serializer'; +import {ParseSourceSpan, ParseError} from '@angular/compiler/src/parse_util'; export function main() { describe("Xmb", () => { @@ -114,4 +113,4 @@ function _serialize(nodes: HtmlAst[]): string { function _serializeErrors(errors: ParseError[]): string[] { return errors.map(e => e.msg); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/legacy_template_spec.ts b/modules/@angular/compiler/test/legacy_template_spec.ts index 37ef47c32f..371ecb60a9 100644 --- a/modules/@angular/compiler/test/legacy_template_spec.ts +++ b/modules/@angular/compiler/test/legacy_template_spec.ts @@ -1,6 +1,4 @@ import { - TestComponentBuilder, - AsyncTestCompleter, ddescribe, describe, it, @@ -11,7 +9,7 @@ import { afterEach, beforeEachProviders, inject -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import { HtmlAst, @@ -20,9 +18,9 @@ import { HtmlAttrAst, HtmlTextAst, htmlVisitAll -} from 'angular2/src/compiler/html_ast'; +} from '@angular/compiler/src/html_ast'; -import {LegacyHtmlAstTransformer} from 'angular2/src/compiler/legacy_template'; +import {LegacyHtmlAstTransformer} from '@angular/compiler/src/legacy_template'; export function main() { describe('Support for legacy template', () => { diff --git a/modules/@angular/compiler/test/metadata_resolver_fixture.ts b/modules/@angular/compiler/test/metadata_resolver_fixture.ts index 74a0a650f3..0f54663462 100644 --- a/modules/@angular/compiler/test/metadata_resolver_fixture.ts +++ b/modules/@angular/compiler/test/metadata_resolver_fixture.ts @@ -1,4 +1,4 @@ -import {Component} from 'angular2/core'; +import {Component} from '@angular/core'; @Component({styles:('foo'), template: ''}) export class MalformedStylesComponent { diff --git a/modules/@angular/compiler/test/metadata_resolver_spec.ts b/modules/@angular/compiler/test/metadata_resolver_spec.ts index 381afd7073..076b6f1b1a 100644 --- a/modules/@angular/compiler/test/metadata_resolver_spec.ts +++ b/modules/@angular/compiler/test/metadata_resolver_spec.ts @@ -8,14 +8,13 @@ import { expect, beforeEach, afterEach, - AsyncTestCompleter, inject, beforeEachProviders -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {IS_DART, stringify} from 'angular2/src/facade/lang'; -import {CompileMetadataResolver} from 'angular2/src/compiler/metadata_resolver'; -import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from 'angular2/src/core/metadata/lifecycle_hooks'; +import {IS_DART, stringify} from '../src/facade/lang'; +import {CompileMetadataResolver} from '../src/metadata_resolver'; +import {LifecycleHooks, LIFECYCLE_HOOKS_VALUES} from '@angular/core/src/metadata/lifecycle_hooks'; import { Component, Directive, @@ -31,11 +30,11 @@ import { AfterViewChecked, SimpleChange, provide -} from 'angular2/core'; +} from '@angular/core'; import {TEST_PROVIDERS} from './test_bindings'; -import {MODULE_SUFFIX} from 'angular2/src/compiler/util'; -import {PLATFORM_DIRECTIVES} from 'angular2/src/core/platform_directives_and_pipes'; +import {MODULE_SUFFIX} from '@angular/compiler/src/util'; +import {PLATFORM_DIRECTIVES} from '@angular/core/src/platform_directives_and_pipes'; import {MalformedStylesComponent} from './metadata_resolver_fixture'; export function main() { diff --git a/modules/@angular/compiler/test/offline_compiler_codegen_typed.ts b/modules/@angular/compiler/test/offline_compiler_codegen_typed.ts index b263461f35..6157d45b94 100644 --- a/modules/@angular/compiler/test/offline_compiler_codegen_typed.ts +++ b/modules/@angular/compiler/test/offline_compiler_codegen_typed.ts @@ -1,18 +1,22 @@ // ATTENTION: This file will be overwritten with generated code by main() -import {print, IS_DART} from 'angular2/src/facade/lang'; -import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter'; -import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter'; +import {print, IS_DART} from '../src/facade/lang'; +import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter'; +import {DartEmitter} from '@angular/compiler/src/output/dart_emitter'; +import * as o from '@angular/compiler/src/output/output_ast'; import {compileComp, compAMetadata} from './offline_compiler_util'; -import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; +import {ComponentFactory} from '@angular/core/src/linker/component_factory'; import {CompA} from './offline_compiler_util'; export const CompANgFactory: ComponentFactory = null; +export function emit(): Promise { + var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter(); + return compileComp(emitter, compAMetadata); +} + // Generator export function main(args: string[]) { - var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter(); - compileComp(emitter, compAMetadata) - .then((source) => { + emit().then((source) => { // debug: console.error(source); print(source); }); diff --git a/modules/@angular/compiler/test/offline_compiler_codegen_untyped.ts b/modules/@angular/compiler/test/offline_compiler_codegen_untyped.ts index 636a88bd95..da6e757db1 100644 --- a/modules/@angular/compiler/test/offline_compiler_codegen_untyped.ts +++ b/modules/@angular/compiler/test/offline_compiler_codegen_untyped.ts @@ -1,17 +1,20 @@ // ATTENTION: This file will be overwritten with generated code by main() -import {print} from 'angular2/src/facade/lang'; -import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter'; +import {print} from '../src/facade/lang'; +import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter'; import {compileComp, compAMetadata} from './offline_compiler_util'; -import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; +import {ComponentFactory} from '@angular/core/src/linker/component_factory'; import {CompA} from './offline_compiler_util'; export const CompANgFactory: ComponentFactory = null; +export function emit() { + var emitter = new JavaScriptEmitter(); + return compileComp(emitter, compAMetadata); +} + // Generator export function main(args: string[]) { - var emitter = new JavaScriptEmitter(); - compileComp(emitter, compAMetadata) - .then((source) => { + emit().then((source) => { // debug: console.error(source); print(source); }); diff --git a/modules/@angular/compiler/test/offline_compiler_spec.ts b/modules/@angular/compiler/test/offline_compiler_spec.ts index adfc966863..0784a62db1 100644 --- a/modules/@angular/compiler/test/offline_compiler_spec.ts +++ b/modules/@angular/compiler/test/offline_compiler_spec.ts @@ -8,21 +8,19 @@ import { expect, beforeEach, afterEach, - AsyncTestCompleter, inject, beforeEachProviders, - el -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {IS_DART} from 'angular2/src/facade/lang'; -import {Injector} from 'angular2/core'; +import {IS_DART} from '../src/facade/lang'; +import {Injector} from '@angular/core'; -import {ComponentFactory} from 'angular2/src/core/linker/component_factory'; +import {ComponentFactory} from '@angular/core/src/linker/component_factory'; import * as typed from './offline_compiler_codegen_typed'; import * as untyped from './offline_compiler_codegen_untyped'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {SharedStylesHost} from "angular2/src/platform/dom/shared_styles_host"; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {SharedStylesHost} from '@angular/platform-browser/src/dom/shared_styles_host'; import {CompA} from './offline_compiler_util'; @@ -31,13 +29,13 @@ export function main() { var untypedComponentFactory = untyped.CompANgFactory; var fixtures: TestFixture[] = []; - if (IS_DART || !DOM.supportsDOMEvents()) { + if (IS_DART || !getDOM().supportsDOMEvents()) { // Our generator only works on node.js and Dart... fixtures.push(new TestFixture(typedComponentFactory, 'typed')); } if (!IS_DART) { // Our generator only works on node.js and Dart... - if (!DOM.supportsDOMEvents()) { + if (!getDOM().supportsDOMEvents()) { fixtures.push(new TestFixture(untypedComponentFactory, 'untyped')); } } @@ -66,4 +64,4 @@ export function main() { class TestFixture { constructor(public compFactory: ComponentFactory, public name: string) {} -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/offline_compiler_util.ts b/modules/@angular/compiler/test/offline_compiler_util.ts index cbf2e05f34..deb4d182c0 100644 --- a/modules/@angular/compiler/test/offline_compiler_util.ts +++ b/modules/@angular/compiler/test/offline_compiler_util.ts @@ -1,30 +1,31 @@ -import {print, IS_DART} from 'angular2/src/facade/lang'; -import {OutputEmitter} from 'angular2/src/compiler/output/abstract_emitter'; -import {Console} from 'angular2/src/core/console'; +import {print, IS_DART} from '../src/facade/lang'; +import {OutputEmitter} from '@angular/compiler/src/output/abstract_emitter'; +import {Console} from '../core_private'; import { OfflineCompiler, NormalizedComponentWithViewDirectives, SourceModule -} from 'angular2/src/compiler/offline_compiler'; -import {TemplateParser} from 'angular2/src/compiler/template_parser'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; -import {Lexer} from 'angular2/src/compiler/expression_parser/lexer'; -import {HtmlParser} from 'angular2/src/compiler/html_parser'; -import {StyleCompiler} from 'angular2/src/compiler/style_compiler'; -import {ViewCompiler} from 'angular2/src/compiler/view_compiler/view_compiler'; -import {DirectiveNormalizer} from 'angular2/src/compiler/directive_normalizer'; -import {CompilerConfig} from 'angular2/src/compiler/config'; -import {createOfflineCompileUrlResolver} from 'angular2/src/compiler/url_resolver'; -import {MockSchemaRegistry} from './schema_registry_mock'; -import {MODULE_SUFFIX} from 'angular2/src/compiler/util'; -import {MockXHR} from 'angular2/src/compiler/xhr_mock'; +} from '@angular/compiler/src/offline_compiler'; +import {TemplateParser} from '@angular/compiler/src/template_parser'; +import {Parser} from '@angular/compiler/src/expression_parser/parser'; +import {Lexer} from '@angular/compiler/src/expression_parser/lexer'; +import {HtmlParser} from '@angular/compiler/src/html_parser'; +import {StyleCompiler} from '@angular/compiler/src/style_compiler'; +import {ViewCompiler} from '@angular/compiler/src/view_compiler/view_compiler'; +import {DirectiveNormalizer} from '@angular/compiler/src/directive_normalizer'; +import {CompilerConfig} from '@angular/compiler/src/config'; +import {createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver'; +import {MockSchemaRegistry} from '../testing/schema_registry_mock'; +import {MODULE_SUFFIX} from '@angular/compiler/src/util'; +import {MockXHR} from '../testing/xhr_mock'; import { CompileDirectiveMetadata, CompileTypeMetadata, CompileTemplateMetadata -} from 'angular2/src/compiler/compile_metadata'; +} from '@angular/compiler/src/compile_metadata'; + export class CompA { user: string; } diff --git a/modules/@angular/compiler/test/output/abstract_emitter_spec.ts b/modules/@angular/compiler/test/output/abstract_emitter_spec.ts index 9341e3e62f..bd089bd4b0 100644 --- a/modules/@angular/compiler/test/output/abstract_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/abstract_emitter_spec.ts @@ -1,18 +1,15 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {escapeSingleQuoteString} from 'angular2/src/compiler/output/abstract_emitter'; +import {escapeSingleQuoteString} from '@angular/compiler/src/output/abstract_emitter'; export function main() { describe('AbstractEmitter', () => { diff --git a/modules/@angular/compiler/test/output/dart_emitter_spec.ts b/modules/@angular/compiler/test/output/dart_emitter_spec.ts index 40857cd88f..7e5547e2e0 100644 --- a/modules/@angular/compiler/test/output/dart_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/dart_emitter_spec.ts @@ -1,21 +1,18 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {isBlank} from 'angular2/src/facade/lang'; -import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter'; -import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata'; -import * as o from 'angular2/src/compiler/output/output_ast'; +import {isBlank} from '../../src/facade/lang'; +import {DartEmitter} from '@angular/compiler/src/output/dart_emitter'; +import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata'; +import * as o from '@angular/compiler/src/output/output_ast'; var someModuleUrl = 'asset:somePackage/lib/somePath'; var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath'; diff --git a/modules/@angular/compiler/test/output/js_emitter_spec.ts b/modules/@angular/compiler/test/output/js_emitter_spec.ts index 2862d47c8a..3743ff67cc 100644 --- a/modules/@angular/compiler/test/output/js_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/js_emitter_spec.ts @@ -1,21 +1,18 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {isBlank} from 'angular2/src/facade/lang'; -import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter'; -import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata'; -import * as o from 'angular2/src/compiler/output/output_ast'; +import {isBlank} from '../../src/facade/lang'; +import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter'; +import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata'; +import * as o from '@angular/compiler/src/output/output_ast'; var someModuleUrl = 'asset:somePackage/lib/somePath'; var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath'; diff --git a/modules/@angular/compiler/test/output/output_emitter_codegen_typed.ts b/modules/@angular/compiler/test/output/output_emitter_codegen_typed.ts index c1729e6998..0e3b126a32 100644 --- a/modules/@angular/compiler/test/output/output_emitter_codegen_typed.ts +++ b/modules/@angular/compiler/test/output/output_emitter_codegen_typed.ts @@ -1,21 +1,27 @@ // ATTENTION: This file will be overwritten with generated code by main() -import {print, IS_DART} from 'angular2/src/facade/lang'; -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {print, IS_DART} from '../../src/facade/lang'; +import {unimplemented} from '../../src/facade/exceptions'; import {codegenExportsVars, codegenStmts} from './output_emitter_util'; -import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter'; -import {DartEmitter} from 'angular2/src/compiler/output/dart_emitter'; -import * as o from 'angular2/src/compiler/output/output_ast'; +import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter'; +import {DartEmitter} from '@angular/compiler/src/output/dart_emitter'; +import * as o from '@angular/compiler/src/output/output_ast'; +import {assetUrl} from '../../src/util'; export function getExpressions(): any { return unimplemented(); } // Generator -export function main(args: string[]) { +export function emit() { var emitter = IS_DART ? new DartEmitter() : new TypeScriptEmitter(); var emittedCode = - emitter.emitStatements('asset:angular2/test/compiler/output/output_emitter_codegen_typed', - codegenStmts, codegenExportsVars); + emitter.emitStatements(assetUrl('compiler', 'output/output_emitter_codegen_typed', 'test'), + codegenStmts, codegenExportsVars); + return emittedCode; +} + +export function main(args: string[]) { + var emittedCode = emit(); // debug: console.error(emittedCode); print(emittedCode); } diff --git a/modules/@angular/compiler/test/output/output_emitter_codegen_untyped.ts b/modules/@angular/compiler/test/output/output_emitter_codegen_untyped.ts index 477446be3c..ffd39684b5 100644 --- a/modules/@angular/compiler/test/output/output_emitter_codegen_untyped.ts +++ b/modules/@angular/compiler/test/output/output_emitter_codegen_untyped.ts @@ -1,19 +1,26 @@ // ATTENTION: This file will be overwritten with generated code by main() -import {print} from 'angular2/src/facade/lang'; -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {print} from '../../src/facade/lang'; +import {unimplemented} from '../../src/facade/exceptions'; import {codegenExportsVars, codegenStmts} from './output_emitter_util'; -import {JavaScriptEmitter} from 'angular2/src/compiler/output/js_emitter'; +import {JavaScriptEmitter} from '@angular/compiler/src/output/js_emitter'; +import {assetUrl} from '../../src/util'; export function getExpressions(): any { return unimplemented(); } // Generator -export function main(args: string[]) { +export function emit () { var emitter = new JavaScriptEmitter(); var emittedCode = - emitter.emitStatements('asset:angular2/test/compiler/output/output_emitter_codegen_untyped', - codegenStmts, codegenExportsVars); + emitter.emitStatements( + assetUrl('compiler', 'output/output_emitter_codegen_untyped', 'test'), + codegenStmts, codegenExportsVars); + return emittedCode; +} + +export function main(args: string[]) { + var emittedCode = emit(); // debug: console.error(emittedCode); print(emittedCode); } diff --git a/modules/@angular/compiler/test/output/output_emitter_spec.ts b/modules/@angular/compiler/test/output/output_emitter_spec.ts index faae79fe3d..13e2132687 100644 --- a/modules/@angular/compiler/test/output/output_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/output_emitter_spec.ts @@ -1,29 +1,26 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder, - browserDetection -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {IS_DART} from 'angular2/src/facade/lang'; +import {IS_DART} from '../../src/facade/lang'; import * as typed from './output_emitter_codegen_typed'; import * as untyped from './output_emitter_codegen_untyped'; -import {jitStatements} from 'angular2/src/compiler/output/output_jit'; -import {interpretStatements} from 'angular2/src/compiler/output/output_interpreter'; +import {jitStatements} from '@angular/compiler/src/output/output_jit'; +import {interpretStatements} from '@angular/compiler/src/output/output_interpreter'; import {codegenStmts, ExternalClass, DynamicClassInstanceFactory} from './output_emitter_util'; -import {EventEmitter} from 'angular2/src/facade/async'; -import {ViewType} from 'angular2/src/core/linker/view_type'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; +import {EventEmitter} from '@angular/core'; +import {ViewType} from '@angular/core/src/linker/view_type'; +import {BaseException} from '@angular/core'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {browserDetection} from '@angular/platform-browser/testing' export function main() { var outputDefs = []; @@ -32,13 +29,13 @@ export function main() { new DynamicClassInstanceFactory()), 'name': 'interpreted' }); - if (IS_DART || !DOM.supportsDOMEvents()) { + if (IS_DART || !getDOM().supportsDOMEvents()) { // Our generator only works on node.js and Dart... outputDefs.push({'getExpressions': () => typed.getExpressions, 'name': 'typed'}); } if (!IS_DART) { // Our generator only works on node.js and Dart... - if (!DOM.supportsDOMEvents()) { + if (!getDOM().supportsDOMEvents()) { outputDefs.push({'getExpressions': () => untyped.getExpressions, 'name': 'untyped'}); } outputDefs.push({ diff --git a/modules/@angular/compiler/test/output/output_emitter_util.ts b/modules/@angular/compiler/test/output/output_emitter_util.ts index d48484df66..2dd564d7b7 100644 --- a/modules/@angular/compiler/test/output/output_emitter_util.ts +++ b/modules/@angular/compiler/test/output/output_emitter_util.ts @@ -1,11 +1,11 @@ -import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata'; -import {EventEmitter} from 'angular2/src/facade/async'; -import {ViewType} from 'angular2/src/core/linker/view_type'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {InstanceFactory, DynamicInstance} from 'angular2/src/compiler/output/output_interpreter'; -import {MODULE_SUFFIX} from 'angular2/src/compiler/util'; +import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata'; +import {EventEmitter} from '@angular/core'; +import {ViewType} from '@angular/core/src/linker/view_type'; +import {BaseException} from '../../src/facade/exceptions'; +import {InstanceFactory, DynamicInstance} from '@angular/compiler/src/output/output_interpreter'; +import {assetUrl} from '@angular/compiler/src/util'; -import * as o from 'angular2/src/compiler/output/output_ast'; +import * as o from '@angular/compiler/src/output/output_ast'; export class ExternalClass { changeable: any; @@ -15,25 +15,25 @@ export class ExternalClass { var testDataIdentifier = new CompileIdentifierMetadata({ name: 'ExternalClass', - moduleUrl: `asset:angular2/test/compiler/output/output_emitter_util${MODULE_SUFFIX}`, + moduleUrl: assetUrl('compiler', 'output/output_emitter_util'), runtime: ExternalClass }); var eventEmitterIdentifier = new CompileIdentifierMetadata({ name: 'EventEmitter', - moduleUrl: `asset:angular2/lib/src/facade/async${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core'), runtime: EventEmitter }); var enumIdentifier = new CompileIdentifierMetadata({ name: 'ViewType.HOST', - moduleUrl: `asset:angular2/lib/src/core/linker/view_type${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core', 'linker/view_type'), runtime: ViewType.HOST }); var baseExceptionIdentifier = new CompileIdentifierMetadata({ name: 'BaseException', - moduleUrl: `asset:angular2/lib/src/facade/exceptions${MODULE_SUFFIX}`, + moduleUrl: assetUrl('core'), runtime: BaseException }); diff --git a/modules/@angular/compiler/test/output/path_util_spec.ts b/modules/@angular/compiler/test/output/path_util_spec.ts index fb815bb2a4..cd226b0e97 100644 --- a/modules/@angular/compiler/test/output/path_util_spec.ts +++ b/modules/@angular/compiler/test/output/path_util_spec.ts @@ -1,18 +1,15 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {getImportModulePath, ImportEnv} from 'angular2/src/compiler/output/path_util'; +import {getImportModulePath, ImportEnv} from '@angular/compiler/src/output/path_util'; export function main() { describe('PathUtils', () => { @@ -69,4 +66,4 @@ export function main() { }); }); }); -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/output/ts_emitter_spec.ts b/modules/@angular/compiler/test/output/ts_emitter_spec.ts index 9bae38a06f..a7cf3dab28 100644 --- a/modules/@angular/compiler/test/output/ts_emitter_spec.ts +++ b/modules/@angular/compiler/test/output/ts_emitter_spec.ts @@ -1,21 +1,18 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {isBlank} from 'angular2/src/facade/lang'; -import {TypeScriptEmitter} from 'angular2/src/compiler/output/ts_emitter'; -import {CompileIdentifierMetadata} from 'angular2/src/compiler/compile_metadata'; -import * as o from 'angular2/src/compiler/output/output_ast'; +import {isBlank} from '../../src/facade/lang'; +import {TypeScriptEmitter} from '@angular/compiler/src/output/ts_emitter'; +import {CompileIdentifierMetadata} from '@angular/compiler/src/compile_metadata'; +import * as o from '@angular/compiler/src/output/output_ast'; var someModuleUrl = 'asset:somePackage/lib/somePath'; var anotherModuleUrl = 'asset:somePackage/lib/someOtherPath'; diff --git a/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts b/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts index 57c32b8a76..95412032b0 100644 --- a/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts +++ b/modules/@angular/compiler/test/schema/dom_element_schema_registry_spec.ts @@ -8,30 +8,46 @@ import { inject, it, xit -} from 'angular2/testing_internal'; -import {IS_DART} from 'angular2/src/facade/lang'; +} from '@angular/core/testing/testing_internal'; -import {DomElementSchemaRegistry} from 'angular2/src/compiler/schema/dom_element_schema_registry'; +import {DomElementSchemaRegistry} from '@angular/compiler/src/schema/dom_element_schema_registry'; +import {extractSchema} from './schema_extractor'; export function main() { - // DOMElementSchema can only be used on the JS side where we can safely - // use reflection for DOM elements - if (IS_DART) return; - - var registry: DomElementSchemaRegistry; - - beforeEach(() => { registry = new DomElementSchemaRegistry(); }); - describe('DOMElementSchema', () => { + var registry: DomElementSchemaRegistry; + beforeEach(() => { registry = new DomElementSchemaRegistry(); }); it('should detect properties on regular elements', () => { expect(registry.hasProperty('div', 'id')).toBeTruthy(); expect(registry.hasProperty('div', 'title')).toBeTruthy(); + expect(registry.hasProperty('h1', 'align')).toBeTruthy(); + expect(registry.hasProperty('h2', 'align')).toBeTruthy(); + expect(registry.hasProperty('h3', 'align')).toBeTruthy(); + expect(registry.hasProperty('h4', 'align')).toBeTruthy(); + expect(registry.hasProperty('h5', 'align')).toBeTruthy(); + expect(registry.hasProperty('h6', 'align')).toBeTruthy(); + expect(registry.hasProperty('h7', 'align')).toBeFalsy(); + expect(registry.hasProperty('textarea', 'disabled')).toBeTruthy(); + expect(registry.hasProperty('input', 'disabled')).toBeTruthy(); expect(registry.hasProperty('div', 'unknown')).toBeFalsy(); }); - it('should return true for custom-like elements', - () => { expect(registry.hasProperty('custom-like', 'unknown')).toBeTruthy(); }); + it('should detect different kinds of types', + () => { + // inheritance: video => media => * + expect(registry.hasProperty('video', 'className')).toBeTruthy(); // from * + expect(registry.hasProperty('video', 'id')).toBeTruthy(); // string + expect(registry.hasProperty('video', 'scrollLeft')).toBeTruthy(); // number + expect(registry.hasProperty('video', 'height')).toBeTruthy(); // number + expect(registry.hasProperty('video', 'autoplay')).toBeTruthy(); // boolean + expect(registry.hasProperty('video', 'classList')).toBeTruthy(); // object + // from *; but events are not properties + expect(registry.hasProperty('video', 'click')).toBeFalsy(); + }) + + it('should return true for custom-like elements', + () => { expect(registry.hasProperty('custom-like', 'unknown')).toBeTruthy(); }); it('should re-map property names that are specified in DOM facade', () => { expect(registry.getMappedPropName('readonly')).toEqual('readOnly'); }); @@ -43,5 +59,15 @@ export function main() { it('should detect properties on namespaced elements', () => { expect(registry.hasProperty('@svg:g', 'id')).toBeTruthy(); }); + + it('generate a new schema', () => { + // console.log(JSON.stringify(registry.properties)); + extractSchema( + (descriptors) => { + // Uncomment this line to see: + // the generated schema which can then be pasted to the DomElementSchemaRegistry + // console.log(descriptors); + }); + }); }); } diff --git a/modules/@angular/compiler/test/schema/schema_extractor.dart b/modules/@angular/compiler/test/schema/schema_extractor.dart new file mode 100644 index 0000000000..07a47a3b89 --- /dev/null +++ b/modules/@angular/compiler/test/schema/schema_extractor.dart @@ -0,0 +1,5 @@ +/** + * We don't know how to extract schema in dart, so do nothing. + */ +extractSchema(fn(List descriptors)) { +} diff --git a/modules/@angular/compiler/test/schema/schema_extractor.ts b/modules/@angular/compiler/test/schema/schema_extractor.ts new file mode 100644 index 0000000000..1f20be9b28 --- /dev/null +++ b/modules/@angular/compiler/test/schema/schema_extractor.ts @@ -0,0 +1,140 @@ +import {isString, isPresent} from '../../src/facade/lang'; + +const SVG_PREFIX = '@svg:'; + +var document = typeof global['document'] == 'object' ? global['document'] : null; + +export function extractSchema(fn: (descriptors: string[]) => void): string[] { + var SVGGraphicsElement = global['SVGGraphicsElement']; + var SVGAnimationElement = global['SVGAnimationElement']; + var SVGGeometryElement = global['SVGGeometryElement']; + var SVGComponentTransferFunctionElement = global['SVGComponentTransferFunctionElement']; + var SVGGradientElement = global['SVGGradientElement']; + var SVGTextContentElement = global['SVGTextContentElement']; + var SVGTextPositioningElement = global['SVGTextPositioningElement']; + if (!document || !SVGGraphicsElement) return null; + var descriptors: string[] = []; + var visited: {[name: string]: boolean} = {}; + var element = document.createElement('video'); + var svgAnimation = document.createElementNS('http://www.w3.org/2000/svg', 'set'); + var svgPath = document.createElementNS('http://www.w3.org/2000/svg', 'path'); + var svgFeFuncA = document.createElementNS('http://www.w3.org/2000/svg', 'feFuncA'); + var svgGradient = document.createElementNS('http://www.w3.org/2000/svg', 'linearGradient'); + var svgText = document.createElementNS('http://www.w3.org/2000/svg', 'text'); + + extractProperties(Element, element, visited, descriptors, '*', ''); + extractProperties(HTMLElement, element, visited, descriptors, '', '*'); + extractProperties(HTMLMediaElement, element, visited, descriptors, 'media', ''); + extractProperties(SVGElement, svgText, visited, descriptors, SVG_PREFIX, '*'); + extractProperties(SVGGraphicsElement, svgText, visited, descriptors, SVG_PREFIX + 'graphics', + SVG_PREFIX); + extractProperties(SVGAnimationElement, svgAnimation, visited, descriptors, + SVG_PREFIX + 'animation', SVG_PREFIX); + extractProperties(SVGGeometryElement, svgPath, visited, descriptors, SVG_PREFIX + 'geometry', + SVG_PREFIX); + extractProperties(SVGComponentTransferFunctionElement, svgFeFuncA, visited, descriptors, + SVG_PREFIX + 'componentTransferFunction', SVG_PREFIX); + extractProperties(SVGGradientElement, svgGradient, visited, descriptors, SVG_PREFIX + 'gradient', + SVG_PREFIX); + extractProperties(SVGTextContentElement, svgText, visited, descriptors, + SVG_PREFIX + 'textContent', SVG_PREFIX + 'graphics'); + extractProperties(SVGTextPositioningElement, svgText, visited, descriptors, + SVG_PREFIX + 'textPositioning', SVG_PREFIX + 'textContent'); + var keys = Object.getOwnPropertyNames(window).filter( + k => k.endsWith('Element') && (k.startsWith('HTML') || k.startsWith('SVG'))); + keys.sort(); + keys.forEach(name => extractRecursiveProperties(visited, descriptors, window[name])); + fn(descriptors); +} + +function extractRecursiveProperties(visited: {[name: string]: boolean}, descriptors: string[], + type: Function): string { + var name = extractName(type); + if (visited[name]) return name; // already been here + var superName = ''; + if (name != '*') { + superName = + extractRecursiveProperties(visited, descriptors, type.prototype.__proto__.constructor); + } + + var instance: HTMLElement = null; + name.split(',').forEach(tagName => { + instance = isSVG(type) ? + document.createElementNS('http://www.w3.org/2000/svg', + tagName.replace(SVG_PREFIX, '')) : + document.createElement(tagName); + var htmlType = type; + if (tagName == 'cite') htmlType = HTMLElement; + if (!(instance instanceof htmlType)) { + throw new Error(`Tag <${tagName}> is not an instance of ${htmlType['name']}`); + } + }); + extractProperties(type, instance, visited, descriptors, name, superName); + return name; +} + +function extractProperties(type: Function, instance: any, visited: {[name: string]: boolean}, + descriptors: string[], name: string, superName: string) { + if (!type) return; + visited[name] = true; + var props = []; + var prototype = type.prototype; + var keys = Object.getOwnPropertyNames(prototype); + keys.sort(); + keys.forEach((n) => { + if (n.startsWith('on')) { + props.push('*' + n.substr(2)); + } else { + var typeCh = typeMap[typeof instance[n]]; + var descriptor = Object.getOwnPropertyDescriptor(prototype, n); + var isSetter = descriptor && isPresent(descriptor.set); + if (isString(typeCh) && !n.startsWith('webkit') && isSetter) { + props.push(typeCh + n); + } + } + }); + descriptors.push(name + (superName ? '^' + superName : '') + '|' + props.join(',')); +} + +function extractName(type: Function): string { + var name = type['name']; + if (name == 'Element') return '*'; + if (name == 'HTMLImageElement') return 'img'; + if (name == 'HTMLAnchorElement') return 'a'; + if (name == 'HTMLDListElement') return 'dl'; + if (name == 'HTMLDirectoryElement') return 'dir'; + if (name == 'HTMLHeadingElement') return 'h1,h2,h3,h4,h5,h6'; + if (name == 'HTMLModElement') return 'ins,del'; + if (name == 'HTMLOListElement') return 'ol'; + if (name == 'HTMLParagraphElement') return 'p'; + if (name == 'HTMLQuoteElement') return 'q,blockquote,cite'; + if (name == 'HTMLTableCaptionElement') return 'caption'; + if (name == 'HTMLTableCellElement') return 'th,td'; + if (name == 'HTMLTableColElement') return 'col,colgroup'; + if (name == 'HTMLTableRowElement') return 'tr'; + if (name == 'HTMLTableSectionElement') return 'tfoot,thead,tbody'; + if (name == 'HTMLUListElement') return 'ul'; + if (name == 'SVGGraphicsElement') return SVG_PREFIX + 'graphics'; + if (name == 'SVGMPathElement') return SVG_PREFIX + 'mpath'; + if (name == 'SVGSVGElement') return SVG_PREFIX + 'svg'; + if (name == 'SVGTSpanElement') return SVG_PREFIX + 'tspan'; + var isSVG = name.startsWith('SVG'); + if (name.startsWith('HTML') || isSVG) { + name = name.replace('HTML', '').replace('SVG', '').replace('Element', ''); + if (isSVG && name.startsWith('FE')) { + name = 'fe' + name.substring(2); + } else if (name) { + name = name.charAt(0).toLowerCase() + name.substring(1); + } + return isSVG ? SVG_PREFIX + name : name.toLowerCase(); + } else { + return null; + } +} + +function isSVG(type: Function): boolean { + return type['name'].startsWith('SVG'); +} + +const typeMap = + <{[type: string]: string}>{'string': '', 'number': '#', 'boolean': '!', 'object': '%'}; diff --git a/modules/@angular/compiler/test/selector_spec.ts b/modules/@angular/compiler/test/selector_spec.ts index b35ffc7e76..f198ce094a 100644 --- a/modules/@angular/compiler/test/selector_spec.ts +++ b/modules/@angular/compiler/test/selector_spec.ts @@ -1,7 +1,8 @@ -import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/testing_internal'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {SelectorMatcher, CssSelector} from 'angular2/src/compiler/selector'; -import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; +import {describe, it, expect, beforeEach, ddescribe, iit, xit} from '@angular/core/testing'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {SelectorMatcher} from '@angular/compiler/src/selector'; +import {CssSelector} from '@angular/compiler/src/selector'; +import {el} from '@angular/platform-browser/testing'; export function main() { describe('SelectorMatcher', () => { @@ -94,7 +95,7 @@ export function main() { var elementSelector = new CssSelector(); var element = el('
'); - var empty = DOM.getAttribute(element, 'attr'); + var empty = getDOM().getAttribute(element, 'attr'); elementSelector.addAttribute('some-decor', empty); matcher.match(elementSelector, selectableCollector); expect(matched).toEqual([s1[0], 1]); diff --git a/modules/@angular/compiler/test/shadow_css_spec.ts b/modules/@angular/compiler/test/shadow_css_spec.ts index 19790e4d75..d8dd3f95fc 100644 --- a/modules/@angular/compiler/test/shadow_css_spec.ts +++ b/modules/@angular/compiler/test/shadow_css_spec.ts @@ -5,13 +5,11 @@ import { expect, ddescribe, iit, - SpyObject, - el, - normalizeCSS -} from 'angular2/testing_internal'; -import {ShadowCss, processRules, CssRule} from 'angular2/src/compiler/shadow_css'; +} from '@angular/core/testing/testing_internal'; +import {ShadowCss, processRules, CssRule} from '@angular/compiler/src/shadow_css'; -import {RegExpWrapper, StringWrapper, isPresent} from 'angular2/src/facade/lang'; +import {RegExpWrapper, StringWrapper, isPresent} from '../src/facade/lang'; +import {normalizeCSS} from '@angular/platform-browser/testing'; export function main() { describe('ShadowCss', function() { diff --git a/modules/@angular/compiler/test/spies.ts b/modules/@angular/compiler/test/spies.ts index 8be19d700d..a43ff38d18 100644 --- a/modules/@angular/compiler/test/spies.ts +++ b/modules/@angular/compiler/test/spies.ts @@ -1,6 +1,6 @@ -import {XHR} from 'angular2/src/compiler/xhr'; +import {XHR} from '@angular/compiler/src/xhr'; -import {SpyObject, proxy} from 'angular2/testing_internal'; +import {SpyObject, proxy} from '@angular/core/testing/testing_internal'; export class SpyXHR extends SpyObject { constructor() { super(XHR); } diff --git a/modules/@angular/compiler/test/style_url_resolver_spec.ts b/modules/@angular/compiler/test/style_url_resolver_spec.ts index 413d51a8b9..3c5dac6efb 100644 --- a/modules/@angular/compiler/test/style_url_resolver_spec.ts +++ b/modules/@angular/compiler/test/style_url_resolver_spec.ts @@ -1,7 +1,7 @@ -import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/testing_internal'; -import {extractStyleUrls, isStyleUrlResolvable} from 'angular2/src/compiler/style_url_resolver'; +import {describe, it, expect, beforeEach, ddescribe, iit, xit} from '@angular/core/testing'; +import {extractStyleUrls, isStyleUrlResolvable} from '@angular/compiler/src/style_url_resolver'; -import {UrlResolver} from 'angular2/src/compiler/url_resolver'; +import {UrlResolver} from '@angular/compiler/src/url_resolver'; export function main() { describe('extractStyleUrls', () => { diff --git a/modules/@angular/compiler/test/template_parser_spec.ts b/modules/@angular/compiler/test/template_parser_spec.ts index f4a017ec6b..9daab63f28 100644 --- a/modules/@angular/compiler/test/template_parser_spec.ts +++ b/modules/@angular/compiler/test/template_parser_spec.ts @@ -9,17 +9,16 @@ import { afterEach, inject, beforeEachProviders -} from 'angular2/testing_internal'; -import {provide} from 'angular2/src/core/di'; -import {Console} from 'angular2/src/core/console'; +} from '@angular/core/testing/testing_internal'; +import {provide} from '@angular/core'; + +import {Console} from '@angular/core/src/console'; -import {TEST_PROVIDERS} from './test_bindings'; -import {isPresent} from 'angular2/src/facade/lang'; import { TemplateParser, splitClasses, TEMPLATE_TRANSFORMS -} from 'angular2/src/compiler/template_parser'; +} from '@angular/compiler/src/template_parser'; import { CompileDirectiveMetadata, CompilePipeMetadata, @@ -29,7 +28,7 @@ import { CompileTokenMetadata, CompileDiDependencyMetadata, CompileQueryMetadata -} from 'angular2/src/compiler/compile_metadata'; +} from '@angular/compiler/src/compile_metadata'; import { templateVisitAll, TemplateAstVisitor, @@ -48,13 +47,14 @@ import { PropertyBindingType, DirectiveAst, ProviderAstType -} from 'angular2/src/compiler/template_ast'; -import {identifierToken, Identifiers} from 'angular2/src/compiler/identifiers'; +} from '@angular/compiler/src/template_ast'; +import {identifierToken, Identifiers} from '../src/identifiers'; -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {MockSchemaRegistry} from './schema_registry_mock'; +import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry'; +import {MockSchemaRegistry} from '@angular/compiler/testing'; import {Unparser} from './expression_parser/unparser'; +import {TEST_PROVIDERS} from './test_bindings'; var expressionUnparser = new Unparser(); @@ -1649,4 +1649,4 @@ class ArrayConsole implements Console { warnings: string[] = []; log(msg: string) { this.logs.push(msg); } warn(msg: string) { this.warnings.push(msg); } -} \ No newline at end of file +} diff --git a/modules/@angular/compiler/test/template_preparser_spec.ts b/modules/@angular/compiler/test/template_preparser_spec.ts index 80b550de37..a230eb481e 100644 --- a/modules/@angular/compiler/test/template_preparser_spec.ts +++ b/modules/@angular/compiler/test/template_preparser_spec.ts @@ -8,17 +8,16 @@ import { expect, beforeEach, afterEach, - AsyncTestCompleter, inject, beforeEachProviders -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {HtmlParser} from 'angular2/src/compiler/html_parser'; +import {HtmlParser} from '@angular/compiler/src/html_parser'; import { preparseElement, PreparsedElementType, PreparsedElement -} from 'angular2/src/compiler/template_preparser'; +} from '@angular/compiler/src/template_preparser'; export function main() { describe('preparseElement', () => { diff --git a/modules/@angular/compiler/test/test_bindings.ts b/modules/@angular/compiler/test/test_bindings.ts index c00a68a57e..e6debba652 100644 --- a/modules/@angular/compiler/test/test_bindings.ts +++ b/modules/@angular/compiler/test/test_bindings.ts @@ -1,14 +1,9 @@ -import {provide, Provider} from 'angular2/src/core/di'; -import {MockSchemaRegistry} from './schema_registry_mock'; -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {MockXHR} from 'angular2/src/compiler/xhr_mock'; -import {XHR} from 'angular2/src/compiler/xhr'; -import { - UrlResolver, - createUrlResolverWithoutPackagePrefix -} from 'angular2/src/compiler/url_resolver'; +import {provide} from '@angular/core'; +import {MockSchemaRegistry, MockXHR} from '@angular/compiler/testing'; +import {ElementSchemaRegistry, XHR, UrlResolver} from '@angular/compiler'; +import {createUrlResolverWithoutPackagePrefix} from '@angular/compiler/src/url_resolver'; -export var TEST_PROVIDERS = [ +export var TEST_PROVIDERS: any[] = [ provide(ElementSchemaRegistry, {useValue: new MockSchemaRegistry({}, {})}), provide(XHR, {useClass: MockXHR}), provide(UrlResolver, {useFactory: createUrlResolverWithoutPackagePrefix}) diff --git a/modules/@angular/compiler/test/test_component_builder_spec.ts b/modules/@angular/compiler/test/test_component_builder_spec.ts index d91d4a18cc..dac8f4c31b 100644 --- a/modules/@angular/compiler/test/test_component_builder_spec.ts +++ b/modules/@angular/compiler/test/test_component_builder_spec.ts @@ -1,27 +1,27 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, xdescribe, describe, - dispatchEvent, expect, iit, inject, beforeEachProviders, - withProviders, it, xit, +} from '@angular/core/testing/testing_internal'; +import { TestComponentBuilder, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone -} from 'angular2/testing_internal'; - -import {Injectable, provide, ComponentResolver} from 'angular2/core'; -import {NgIf} from 'angular2/common'; -import {Directive, Component, ViewMetadata, Input} from 'angular2/src/core/metadata'; -import {IS_DART} from 'angular2/src/facade/lang'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; +} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {Injectable, provide, Component, Input, ViewMetadata, ComponentResolver} from '@angular/core'; +import {NgIf} from '@angular/common'; +import {IS_DART} from '../src/facade/lang'; +import {PromiseWrapper} from '../src/facade/promise'; +import {dispatchEvent} from "@angular/platform-browser/testing"; +import {withProviders} from "@angular/core/testing/test_injector" @Component( {selector: 'child-comp', template: `Original {{childBinding}}`, directives: []}) diff --git a/modules/@angular/compiler/test/url_resolver_spec.ts b/modules/@angular/compiler/test/url_resolver_spec.ts index b8707e9560..e662ab5059 100644 --- a/modules/@angular/compiler/test/url_resolver_spec.ts +++ b/modules/@angular/compiler/test/url_resolver_spec.ts @@ -6,11 +6,10 @@ import { ddescribe, iit, xit, - el, inject -} from 'angular2/testing_internal'; -import {IS_DART} from 'angular2/src/facade/lang'; -import {UrlResolver, createOfflineCompileUrlResolver} from 'angular2/src/compiler/url_resolver'; +} from '@angular/core/testing/testing_internal'; +import {IS_DART} from '../src/facade/lang'; +import {UrlResolver, createOfflineCompileUrlResolver} from '@angular/compiler/src/url_resolver'; export function main() { describe('UrlResolver', () => { diff --git a/modules/@angular/compiler/test/view_resolver_mock_spec.ts b/modules/@angular/compiler/test/view_resolver_mock_spec.ts index 29d46852cf..0318caaa63 100644 --- a/modules/@angular/compiler/test/view_resolver_mock_spec.ts +++ b/modules/@angular/compiler/test/view_resolver_mock_spec.ts @@ -2,17 +2,15 @@ import { beforeEach, ddescribe, describe, - el, expect, iit, it, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {stringify, isBlank} from 'angular2/src/facade/lang'; - -import {MockViewResolver} from 'angular2/src/mock/view_resolver_mock'; - -import {Component, ViewMetadata} from 'angular2/src/core/metadata'; +import {stringify} from '../src/facade/lang'; +import {MockViewResolver} from '../testing'; +import {Component, ViewMetadata} from '@angular/core'; +import {isBlank} from '../src/facade/lang'; export function main() { describe('MockViewResolver', () => { diff --git a/modules/@angular/compiler/test/view_resolver_spec.ts b/modules/@angular/compiler/test/view_resolver_spec.ts index cd5f0b46d3..84097e3342 100644 --- a/modules/@angular/compiler/test/view_resolver_spec.ts +++ b/modules/@angular/compiler/test/view_resolver_spec.ts @@ -1,6 +1,6 @@ -import {ddescribe, describe, it, iit, expect, beforeEach} from 'angular2/testing_internal'; -import {ViewResolver} from 'angular2/src/compiler/view_resolver'; -import {Component, ViewMetadata} from 'angular2/src/core/metadata'; +import {ddescribe, describe, it, iit, expect, beforeEach} from '@angular/core/testing'; +import {ViewResolver} from '@angular/compiler/src/view_resolver'; +import {Component, ViewMetadata} from '@angular/core/src/metadata'; class SomeDir {} class SomePipe {} diff --git a/modules/@angular/compiler/test/xhr_mock_spec.ts b/modules/@angular/compiler/test/xhr_mock_spec.ts index 64f45a3b4a..57756eac19 100644 --- a/modules/@angular/compiler/test/xhr_mock_spec.ts +++ b/modules/@angular/compiler/test/xhr_mock_spec.ts @@ -1,17 +1,16 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, -} from 'angular2/testing_internal'; -import {MockXHR} from 'angular2/src/compiler/xhr_mock'; -import {PromiseWrapper} from 'angular2/src/facade/async'; -import {isPresent} from 'angular2/src/facade/lang'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {MockXHR} from '@angular/compiler/testing'; +import {PromiseWrapper} from '../src/facade/async'; +import {isPresent} from '../src/facade/lang'; export function main() { describe('MockXHR', () => { diff --git a/modules/@angular/compiler/testing.ts b/modules/@angular/compiler/testing.ts new file mode 100644 index 0000000000..a003099ab7 --- /dev/null +++ b/modules/@angular/compiler/testing.ts @@ -0,0 +1,5 @@ +export * from './testing/schema_registry_mock'; +export * from './testing/view_resolver_mock'; +export * from './testing/xhr_mock'; +export * from './testing/test_component_builder'; +export * from './testing/directive_resolver_mock'; diff --git a/modules/@angular/compiler/testing/directive_resolver_mock.ts b/modules/@angular/compiler/testing/directive_resolver_mock.ts index a414d5e427..4cb0e8fcb1 100644 --- a/modules/@angular/compiler/testing/directive_resolver_mock.ts +++ b/modules/@angular/compiler/testing/directive_resolver_mock.ts @@ -1,8 +1,7 @@ -import {Injectable} from 'angular2/src/core/di'; -import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {Type, isPresent, stringify, isBlank, print} from 'angular2/src/facade/lang'; -import {DirectiveMetadata, ComponentMetadata} from '../core/metadata'; -import {DirectiveResolver} from 'angular2/src/compiler/directive_resolver'; +import {Map} from '../src/facade/collection'; +import {Type, isPresent} from '../src/facade/lang'; +import {DirectiveMetadata, ComponentMetadata, Injectable} from '@angular/core'; +import {DirectiveResolver} from '../src/directive_resolver'; /** * An implementation of {@link DirectiveResolver} that allows overriding @@ -21,14 +20,14 @@ export class MockDirectiveResolver extends DirectiveResolver { var providers = dm.providers; if (isPresent(providerOverrides)) { - var originalViewProviders = isPresent(dm.providers) ? dm.providers : []; + var originalViewProviders: any[] = isPresent(dm.providers) ? dm.providers : []; providers = originalViewProviders.concat(providerOverrides); } if (dm instanceof ComponentMetadata) { var viewProviders = dm.viewProviders; if (isPresent(viewProviderOverrides)) { - var originalViewProviders = isPresent(dm.viewProviders) ? dm.viewProviders : []; + var originalViewProviders: any[] = isPresent(dm.viewProviders) ? dm.viewProviders : []; viewProviders = originalViewProviders.concat(viewProviderOverrides); } diff --git a/modules/@angular/compiler/testing/schema_registry_mock.ts b/modules/@angular/compiler/testing/schema_registry_mock.ts index 57618e856c..7ec461c812 100644 --- a/modules/@angular/compiler/testing/schema_registry_mock.ts +++ b/modules/@angular/compiler/testing/schema_registry_mock.ts @@ -1,9 +1,10 @@ -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../src/facade/lang'; +import {ElementSchemaRegistry} from '../index'; export class MockSchemaRegistry implements ElementSchemaRegistry { constructor(public existingProperties: {[key: string]: boolean}, public attrPropMapping: {[key: string]: string}) {} + hasProperty(tagName: string, property: string): boolean { var result = this.existingProperties[property]; return isPresent(result) ? result : true; diff --git a/modules/@angular/compiler/testing/test_component_builder.ts b/modules/@angular/compiler/testing/test_component_builder.ts index ba0665b8e2..dc26cee561 100644 --- a/modules/@angular/compiler/testing/test_component_builder.ts +++ b/modules/@angular/compiler/testing/test_component_builder.ts @@ -7,27 +7,26 @@ import { Injectable, ViewMetadata, ElementRef, - EmbeddedViewRef, ChangeDetectorRef, - provide, NgZone, - NgZoneError -} from 'angular2/core'; -import {DirectiveResolver, ViewResolver} from 'angular2/compiler'; + NgZoneError, + DebugElement, + getDebugNode +} from '@angular/core'; +import {DirectiveResolver, ViewResolver} from '../index'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {Type, isPresent, isBlank, IS_DART} from 'angular2/src/facade/lang'; -import {PromiseWrapper, ObservableWrapper, PromiseCompleter} from 'angular2/src/facade/async'; -import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; +import {BaseException} from '../src/facade/exceptions'; +import {Type, isPresent, isBlank, IS_DART} from '../src/facade/lang'; +import {PromiseWrapper, ObservableWrapper, PromiseCompleter} from '../src/facade/async'; +import {ListWrapper, MapWrapper} from '../src/facade/collection'; -import {el} from './utils'; - -import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; - -import {DebugNode, DebugElement, getDebugNode} from 'angular2/src/core/debug/debug_node'; - -import {tick} from './fake_async'; +import {tick} from '@angular/core/testing'; +/** + * An abstract class for inserting the root test component element in a platform independent way. + */ +export class TestComponentRenderer { + insertRootElement(rootElementId: string) {} +} export var ComponentFixtureAutoDetect = new OpaqueToken("ComponentFixtureAutoDetect"); export var ComponentFixtureNoNgZone = new OpaqueToken("ComponentFixtureNoNgZone"); @@ -337,15 +336,9 @@ export class TestComponentBuilder { private _create(ngZone: NgZone, componentFactory: ComponentFactory): ComponentFixture { let rootElId = `root${_nextRootElementId++}`; - let rootEl = el(`
`); - let doc = this._injector.get(DOCUMENT); + var testComponentRenderer: TestComponentRenderer = this._injector.get(TestComponentRenderer); + testComponentRenderer.insertRootElement(rootElId); - // TODO(juliemr): can/should this be optional? - let oldRoots = DOM.querySelectorAll(doc, '[id^=root]'); - for (let i = 0; i < oldRoots.length; i++) { - DOM.remove(oldRoots[i]); - } - DOM.appendChild(doc.body, rootEl); var componentRef = componentFactory.create(this._injector, [], `#${rootElId}`); let autoDetect: boolean = this._injector.get(ComponentFixtureAutoDetect, false); return new ComponentFixture(componentRef, ngZone, autoDetect); diff --git a/modules/@angular/compiler/testing/view_resolver_mock.ts b/modules/@angular/compiler/testing/view_resolver_mock.ts index d23affa5db..8352e3365a 100644 --- a/modules/@angular/compiler/testing/view_resolver_mock.ts +++ b/modules/@angular/compiler/testing/view_resolver_mock.ts @@ -1,11 +1,8 @@ -import {resolveForwardRef} from 'angular2/src/core/di'; -import {Injectable} from 'angular2/src/core/di'; -import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {Type, isPresent, isArray, stringify, isBlank} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; - -import {ViewMetadata} from '../core/metadata'; -import {ViewResolver} from 'angular2/src/compiler/view_resolver'; +import {Injectable, ViewMetadata, Type, BaseException} from '@angular/core'; +import {ViewResolver} from '../index'; +import {Map} from '../src/facade/collection'; +import {isPresent, stringify, isBlank, isArray} from '../src/facade/lang'; +import {resolveForwardRef} from '@angular/core'; @Injectable() export class MockViewResolver extends ViewResolver { diff --git a/modules/@angular/compiler/testing/xhr_mock.ts b/modules/@angular/compiler/testing/xhr_mock.ts index e3ba3b454e..559af14356 100644 --- a/modules/@angular/compiler/testing/xhr_mock.ts +++ b/modules/@angular/compiler/testing/xhr_mock.ts @@ -1,8 +1,8 @@ -import {XHR} from 'angular2/src/compiler/xhr'; -import {ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection'; -import {isBlank, isPresent, normalizeBlank} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {PromiseCompleter, PromiseWrapper} from 'angular2/src/facade/async'; +import {XHR} from '../index'; +import {ListWrapper, Map} from '../src/facade/collection'; +import {isBlank, normalizeBlank} from '../src/facade/lang'; +import {BaseException} from '@angular/core'; +import {PromiseCompleter, PromiseWrapper} from '../src/facade/async'; /** * A mock implementation of {@link XHR} that allows outgoing requests to be mocked diff --git a/modules/@angular/compiler/tsconfig-es2015.json b/modules/@angular/compiler/tsconfig-es2015.json new file mode 100644 index 0000000000..e3eff4974c --- /dev/null +++ b/modules/@angular/compiler/tsconfig-es2015.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "es2015", + "moduleResolution": "node", + "outDir": "../../../dist/packages-dist/compiler/esm", + "paths": { + "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/core/testing": ["../../../dist/packages-dist/core/testing"] + }, + "rootDir": ".", + "sourceMap": true, + "sourceRoot": ".", + "target": "es2015" + }, + "files": [ + "index.ts", + "testing.ts", + "../../../node_modules/zone.js/dist/zone.js.d.ts" + + ] +} diff --git a/modules/@angular/compiler/tsconfig.json b/modules/@angular/compiler/tsconfig.json new file mode 100644 index 0000000000..b184b16d68 --- /dev/null +++ b/modules/@angular/compiler/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "module": "commonjs", + "moduleResolution": "node", + "outDir": "../../../dist/packages-dist/compiler/", + "paths": { + "@angular/core": ["../../../dist/packages-dist/core"], + "@angular/core/testing": ["../../../dist/packages-dist/core/testing"] + }, + "rootDir": ".", + "sourceMap": true, + "sourceRoot": ".", + "target": "es5" + }, + "files": [ + "index.ts", + "testing.ts", + "../typings/es6-collections/es6-collections.d.ts", + "../typings/es6-promise/es6-promise.d.ts", + "../manual_typings/globals.d.ts", + "../../../node_modules/zone.js/dist/zone.js.d.ts" + + ] +} diff --git a/modules/@angular/core/core.ts b/modules/@angular/core/core.ts deleted file mode 100644 index 943b6af301..0000000000 --- a/modules/@angular/core/core.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @module - * @description - * Starting point to import all public core APIs. - */ -export * from './src/core/metadata'; -export * from './src/core/util'; -export * from './src/core/prod_mode'; -export * from './src/core/di'; -export * from './src/facade/facade'; -export {enableProdMode} from 'angular2/src/facade/lang'; -export { - createPlatform, - assertPlatform, - disposePlatform, - getPlatform, - coreBootstrap, - coreLoadAndBootstrap, - createNgZone, - PlatformRef, - ApplicationRef -} from './src/core/application_ref'; -export { - APP_ID, - APP_INITIALIZER, - PACKAGE_ROOT_URL, - PLATFORM_INITIALIZER -} from './src/core/application_tokens'; -export * from './src/core/zone'; -export * from './src/core/render'; -export * from './src/core/linker'; -export {DebugElement, DebugNode, asNativeElements} from './src/core/debug/debug_node'; -export * from './src/core/testability/testability'; -export * from './src/core/change_detection'; -export * from './src/core/platform_directives_and_pipes'; -export * from './src/core/platform_common_providers'; -export * from './src/core/application_common_providers'; -export * from './src/core/reflection/reflection'; diff --git a/modules/@angular/core/index.ts b/modules/@angular/core/index.ts new file mode 100644 index 0000000000..9b2e99f1ae --- /dev/null +++ b/modules/@angular/core/index.ts @@ -0,0 +1,46 @@ +/** + * @module + * @description + * Starting point to import all public core APIs. + */ +export * from './src/metadata'; +export * from './src/util'; +export * from './src/di'; +export { + createPlatform, + assertPlatform, + disposePlatform, + getPlatform, + coreBootstrap, + coreLoadAndBootstrap, + createNgZone, + PlatformRef, + ApplicationRef +} from './src/application_ref'; +export { + APP_ID, + APP_INITIALIZER, + PACKAGE_ROOT_URL, + PLATFORM_INITIALIZER +} from './src/application_tokens'; +export * from './src/zone'; +export * from './src/render'; +export * from './src/linker'; +export {DebugElement, DebugNode, asNativeElements, getDebugNode} from './src/debug/debug_node'; +export * from './src/testability/testability'; +export * from './src/change_detection'; +export * from './src/platform_directives_and_pipes'; +export * from './src/platform_common_providers'; +export * from './src/application_common_providers'; +export * from './src/reflection/reflection'; +export { + wtfCreateScope, + wtfLeave, + wtfStartTimeRange, + wtfEndTimeRange, + WtfScopeFn +} from './src/profile/profile'; +export {Type, enableProdMode} from "./src/facade/lang"; +export {EventEmitter} from "./src/facade/async"; +export {ExceptionHandler, WrappedException, BaseException} from "./src/facade/exceptions"; +export * from './private_export'; diff --git a/modules/@angular/core/package.json b/modules/@angular/core/package.json new file mode 100644 index 0000000000..21ae9b40c8 --- /dev/null +++ b/modules/@angular/core/package.json @@ -0,0 +1,14 @@ +{ + "name": "@angular/core", + "version": "$$ANGULAR_VERSION$$", + "description": "", + "main": "index.js", + "jsnext:main": "esm/index.js", + "typings": "index.d.ts", + "author": "angular", + "license": "MIT", + "peerDependencies": { + "rxjs": "5.0.0-beta.6", + "zone.js": "^0.6.6" + } +} diff --git a/modules/@angular/core/private_export.dart b/modules/@angular/core/private_export.dart new file mode 100644 index 0000000000..0b784e2ddc --- /dev/null +++ b/modules/@angular/core/private_export.dart @@ -0,0 +1,17 @@ +export './src/core/change_detection/constants.dart' show isDefaultChangeDetectionStrategy, ChangeDetectorState, CHANGE_DETECTION_STRATEGY_VALUES; +export './src/core/di/reflective_provider.dart' show constructDependencies; +export './src/core/metadata/lifecycle_hooks.dart' show LifecycleHooks, LIFECYCLE_HOOKS_VALUES; +export './src/core/reflection/reflector_reader.dart' show ReflectorReader; +export './src/core/linker/component_resolver.dart' show ReflectorComponentResolver; +export './src/core/linker/element.dart' show AppElement; +export './src/core/linker/view.dart' show AppView; +export './src/core/linker/view_type.dart' show ViewType; +export './src/core/linker/view_utils.dart' show MAX_INTERPOLATION_VALUES, checkBinding, flattenNestedViewRenderNodes, interpolate, ViewUtils; +export './src/core/metadata/view.dart' show VIEW_ENCAPSULATION_VALUES; +export './src/core/linker/debug_context.dart' show DebugContext, StaticNodeDebugInfo; +export './src/core/change_detection/change_detection_util.dart' show devModeEqual, uninitialized, ValueUnwrapper; +export './src/core/render/api.dart' show RenderDebugInfo; +export './src/core/linker/template_ref.dart' show TemplateRef_; +export './src/core/profile/wtf_init.dart' show wtfInit; +export './src/core/reflection/reflection_capabilities.dart' show ReflectionCapabilities; +export './src/util/decorators' show makeDecorator; diff --git a/modules/@angular/core/private_export.ts b/modules/@angular/core/private_export.ts new file mode 100644 index 0000000000..9f3a608136 --- /dev/null +++ b/modules/@angular/core/private_export.ts @@ -0,0 +1,128 @@ +import * as constants from './src/change_detection/constants'; +import * as reflective_provider from './src/di/reflective_provider'; +import * as lifecycle_hooks from './src/metadata/lifecycle_hooks'; +import * as reflector_reader from './src/reflection/reflector_reader'; +import * as component_resolver from './src/linker/component_resolver'; +import * as element from './src/linker/element'; +import * as view from './src/linker/view'; +import * as view_type from './src/linker/view_type'; +import * as view_utils from './src/linker/view_utils'; +import * as metadata_view from './src/metadata/view'; +import * as debug_context from './src/linker/debug_context'; +import * as change_detection_util from './src/change_detection/change_detection_util'; +import * as api from './src/render/api'; +import * as template_ref from './src/linker/template_ref'; +import * as wtf_init from './src/profile/wtf_init'; +import * as reflection_capabilities from './src/reflection/reflection_capabilities'; +import * as decorators from './src/util/decorators'; +import * as debug from './src/debug/debug_renderer'; +import * as provider_util from './src/di/provider_util'; +import * as console from './src/console'; +import {Provider} from './index'; + +export declare namespace __core_private_types__ { + export var isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy; + export type ChangeDetectorState = constants.ChangeDetectorState; + export var ChangeDetectorState: typeof constants.ChangeDetectorState; + export var CHANGE_DETECTION_STRATEGY_VALUES: typeof constants.CHANGE_DETECTION_STRATEGY_VALUES; + export var constructDependencies: typeof reflective_provider.constructDependencies; + export type LifecycleHooks = lifecycle_hooks.LifecycleHooks; + export var LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks; + export var LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES; + export type ReflectorReader = reflector_reader.ReflectorReader; + export var ReflectorReader: typeof reflector_reader.ReflectorReader; + export var ReflectorComponentResolver: typeof component_resolver.ReflectorComponentResolver; + export type AppElement = element.AppElement; + export var AppElement: typeof element.AppElement; + export var AppView: typeof view.AppView; + export type DebugAppView = view.DebugAppView; + export var DebugAppView: typeof view.DebugAppView; + export type ViewType = view_type.ViewType; + export var ViewType: typeof view_type.ViewType; + export var MAX_INTERPOLATION_VALUES: typeof view_utils.MAX_INTERPOLATION_VALUES; + export var checkBinding: typeof view_utils.checkBinding; + export var flattenNestedViewRenderNodes: typeof view_utils.flattenNestedViewRenderNodes; + export var interpolate: typeof view_utils.interpolate; + export var ViewUtils: typeof view_utils.ViewUtils; + export var VIEW_ENCAPSULATION_VALUES: typeof metadata_view.VIEW_ENCAPSULATION_VALUES; + export var DebugContext: typeof debug_context.DebugContext; + export var StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo; + export var devModeEqual: typeof change_detection_util.devModeEqual; + export var uninitialized: typeof change_detection_util.uninitialized; + export var ValueUnwrapper: typeof change_detection_util.ValueUnwrapper; + export type RenderDebugInfo = api.RenderDebugInfo; + export var RenderDebugInfo: typeof api.RenderDebugInfo; + export type TemplateRef_ = template_ref.TemplateRef_; + export var TemplateRef_: typeof template_ref.TemplateRef_; + export var wtfInit: typeof wtf_init.wtfInit; + export type ReflectionCapabilities = reflection_capabilities.ReflectionCapabilities; + export var ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities; + export var makeDecorator: typeof decorators.makeDecorator; + export type DebugDomRootRenderer = debug.DebugDomRootRenderer; + export var DebugDomRootRenderer: typeof debug.DebugDomRootRenderer; + export var createProvider: typeof provider_util.createProvider; + export var isProviderLiteral: typeof provider_util.isProviderLiteral; + export var EMPTY_ARRAY: typeof view_utils.EMPTY_ARRAY; + export var EMPTY_MAP: typeof view_utils.EMPTY_MAP; + export var pureProxy1: typeof view_utils.pureProxy1; + export var pureProxy2: typeof view_utils.pureProxy2; + export var pureProxy3: typeof view_utils.pureProxy3; + export var pureProxy4: typeof view_utils.pureProxy4; + export var pureProxy5: typeof view_utils.pureProxy5; + export var pureProxy6: typeof view_utils.pureProxy6; + export var pureProxy7: typeof view_utils.pureProxy7; + export var pureProxy8: typeof view_utils.pureProxy8; + export var pureProxy9: typeof view_utils.pureProxy9; + export var pureProxy10: typeof view_utils.pureProxy10; + export var castByValue: typeof view_utils.castByValue; + export type Console = console.Console; + export var Console: typeof console.Console; +} + +export var __core_private__ = { + isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy, + ChangeDetectorState: constants.ChangeDetectorState, + CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES, + constructDependencies: reflective_provider.constructDependencies, + LifecycleHooks: lifecycle_hooks.LifecycleHooks, + LIFECYCLE_HOOKS_VALUES: lifecycle_hooks.LIFECYCLE_HOOKS_VALUES, + ReflectorReader: reflector_reader.ReflectorReader, + ReflectorComponentResolver: component_resolver.ReflectorComponentResolver, + AppElement: element.AppElement, + AppView: view.AppView, + DebugAppView: view.DebugAppView, + ViewType: view_type.ViewType, + MAX_INTERPOLATION_VALUES: view_utils.MAX_INTERPOLATION_VALUES, + checkBinding: view_utils.checkBinding, + flattenNestedViewRenderNodes: view_utils.flattenNestedViewRenderNodes, + interpolate: view_utils.interpolate, + ViewUtils: view_utils.ViewUtils, + VIEW_ENCAPSULATION_VALUES: metadata_view.VIEW_ENCAPSULATION_VALUES, + DebugContext: debug_context.DebugContext, + StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo, + devModeEqual: change_detection_util.devModeEqual, + uninitialized: change_detection_util.uninitialized, + ValueUnwrapper: change_detection_util.ValueUnwrapper, + RenderDebugInfo: api.RenderDebugInfo, + TemplateRef_: template_ref.TemplateRef_, + wtfInit: wtf_init.wtfInit, + ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities, + makeDecorator: decorators.makeDecorator, + DebugDomRootRenderer: debug.DebugDomRootRenderer, + createProvider: provider_util.createProvider, + isProviderLiteral: provider_util.isProviderLiteral, + EMPTY_ARRAY: view_utils.EMPTY_ARRAY, + EMPTY_MAP: view_utils.EMPTY_MAP, + pureProxy1: view_utils.pureProxy1, + pureProxy2: view_utils.pureProxy2, + pureProxy3: view_utils.pureProxy3, + pureProxy4: view_utils.pureProxy4, + pureProxy5: view_utils.pureProxy5, + pureProxy6: view_utils.pureProxy6, + pureProxy7: view_utils.pureProxy7, + pureProxy8: view_utils.pureProxy8, + pureProxy9: view_utils.pureProxy9, + pureProxy10: view_utils.pureProxy10, + castByValue: view_utils.castByValue, + Console: console.Console, +}; diff --git a/modules/@angular/core/rollup.config.js b/modules/@angular/core/rollup.config.js new file mode 100644 index 0000000000..e4d2397189 --- /dev/null +++ b/modules/@angular/core/rollup.config.js @@ -0,0 +1,18 @@ + +export default { + entry: '../../../dist/packages-dist/core/esm/index.js', + dest: '../../../dist/packages-dist/core/esm/core.umd.js', + sourceMap: true, + format: 'umd', + moduleName: 'ng.core', + globals: { + 'rxjs/Subject': 'Rx', + 'rxjs/observable/PromiseObservable': 'Rx', // this is wrong, but this stuff has changed in rxjs b.6 so we need to fix it when we update. + 'rxjs/operator/toPromise': 'Rx.Observable.prototype', + 'rxjs/Observable': 'Rx' + }, + plugins: [ +// nodeResolve({ jsnext: true, main: true }), + ] +} + diff --git a/modules/@angular/core/src/application_common_providers.ts b/modules/@angular/core/src/application_common_providers.ts index b06e516300..62c5b55c4c 100644 --- a/modules/@angular/core/src/application_common_providers.ts +++ b/modules/@angular/core/src/application_common_providers.ts @@ -1,4 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '../src/facade/lang'; import {APP_ID_RANDOM_PROVIDER} from './application_tokens'; import {APPLICATION_CORE_PROVIDERS} from './application_ref'; import { @@ -7,7 +7,7 @@ import { KeyValueDiffers, defaultKeyValueDiffers } from './change_detection/change_detection'; -import {ViewUtils} from "./linker/view_utils"; +import {ViewUtils} from './linker/view_utils'; import {ComponentResolver, ReflectorComponentResolver} from './linker/component_resolver'; import {DynamicComponentLoader, DynamicComponentLoader_} from './linker/dynamic_component_loader'; diff --git a/modules/@angular/core/src/application_ref.ts b/modules/@angular/core/src/application_ref.ts index f5467a403d..ba7626540c 100644 --- a/modules/@angular/core/src/application_ref.ts +++ b/modules/@angular/core/src/application_ref.ts @@ -1,30 +1,27 @@ -import {NgZone, NgZoneError} from 'angular2/src/core/zone/ng_zone'; +import {NgZone, NgZoneError} from './zone/ng_zone'; import { Type, isBlank, isPresent, assertionsEnabled, - print, - IS_DART, lockMode, isPromise -} from 'angular2/src/facade/lang'; -import {provide, Provider, Injector, Injectable} from 'angular2/src/core/di'; -import {APP_ID_RANDOM_PROVIDER, PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens'; -import {PromiseWrapper, PromiseCompleter, ObservableWrapper} from 'angular2/src/facade/async'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {TestabilityRegistry, Testability} from 'angular2/src/core/testability/testability'; -import {ComponentResolver} from 'angular2/src/core/linker/component_resolver'; -import {ComponentRef, ComponentFactory} from 'angular2/src/core/linker/component_factory'; +} from '../src/facade/lang'; +import {Injector, Injectable} from './di'; +import {PLATFORM_INITIALIZER, APP_INITIALIZER} from './application_tokens'; +import {PromiseWrapper, ObservableWrapper} from '../src/facade/async'; +import {ListWrapper} from '../src/facade/collection'; +import {TestabilityRegistry, Testability} from './testability/testability'; +import {ComponentResolver} from './linker/component_resolver'; +import {ComponentRef, ComponentFactory} from './linker/component_factory'; import { BaseException, - WrappedException, ExceptionHandler, unimplemented -} from 'angular2/src/facade/exceptions'; -import {Console} from 'angular2/src/core/console'; +} from '../src/facade/exceptions'; +import {Console} from './console'; import {wtfLeave, wtfCreateScope, WtfScopeFn} from './profile/profile'; -import {ChangeDetectorRef} from 'angular2/src/core/change_detection/change_detector_ref'; +import {ChangeDetectorRef} from './change_detection/change_detector_ref'; /** * Create an Angular zone. diff --git a/modules/@angular/core/src/application_tokens.ts b/modules/@angular/core/src/application_tokens.ts index 852dce53e9..d9dd03717f 100644 --- a/modules/@angular/core/src/application_tokens.ts +++ b/modules/@angular/core/src/application_tokens.ts @@ -1,5 +1,5 @@ -import {OpaqueToken, Provider} from 'angular2/src/core/di'; -import {Math, StringWrapper} from 'angular2/src/facade/lang'; +import {OpaqueToken} from './di'; +import {Math, StringWrapper} from '../src/facade/lang'; /** * A DI Token representing a unique string id assigned to the application by Angular and used diff --git a/modules/@angular/core/src/change_detection.ts b/modules/@angular/core/src/change_detection.ts index 63b0f48d28..f67ef4e4d5 100644 --- a/modules/@angular/core/src/change_detection.ts +++ b/modules/@angular/core/src/change_detection.ts @@ -12,6 +12,7 @@ export { WrappedValue, SimpleChange, PipeTransform, + DefaultIterableDiffer, IterableDiffers, IterableDiffer, IterableDifferFactory, diff --git a/modules/@angular/core/src/change_detection/change_detection.ts b/modules/@angular/core/src/change_detection/change_detection.ts index 9a6ea5f25a..cdd341b6e2 100644 --- a/modules/@angular/core/src/change_detection/change_detection.ts +++ b/modules/@angular/core/src/change_detection/change_detection.ts @@ -30,6 +30,7 @@ export { TrackByFn } from './differs/iterable_differs'; export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs'; +export {DefaultIterableDiffer} from './differs/default_iterable_differ'; export {PipeTransform} from './pipe_transform'; export { diff --git a/modules/@angular/core/src/change_detection/change_detection_util.ts b/modules/@angular/core/src/change_detection/change_detection_util.ts index 0f97c30c85..7a0dca8a98 100644 --- a/modules/@angular/core/src/change_detection/change_detection_util.ts +++ b/modules/@angular/core/src/change_detection/change_detection_util.ts @@ -1,11 +1,10 @@ -import {isBlank, looseIdentical, isPrimitive} from 'angular2/src/facade/lang'; +import {looseIdentical, isPrimitive} from '../../src/facade/lang'; import { - StringMapWrapper, isListLikeIterable, areIterablesEqual -} from 'angular2/src/facade/collection'; +} from '../../src/facade/collection'; -export {looseIdentical} from 'angular2/src/facade/lang'; +export {looseIdentical} from '../../src/facade/lang'; export var uninitialized: Object = /*@ts2dart_const*/ new Object(); export function devModeEqual(a: any, b: any): boolean { diff --git a/modules/@angular/core/src/change_detection/constants.ts b/modules/@angular/core/src/change_detection/constants.ts index a4a13037e1..ee7d3fc037 100644 --- a/modules/@angular/core/src/change_detection/constants.ts +++ b/modules/@angular/core/src/change_detection/constants.ts @@ -1,4 +1,4 @@ -import {StringWrapper, normalizeBool, isBlank} from 'angular2/src/facade/lang'; +import {isBlank} from '../../src/facade/lang'; /** * Describes the current state of the change detector. diff --git a/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts b/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts index 07f3b12f7d..93cda5bc70 100644 --- a/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts +++ b/modules/@angular/core/src/change_detection/differs/default_iterable_differ.ts @@ -1,5 +1,5 @@ -import {BaseException} from 'angular2/src/facade/exceptions'; -import {isListLikeIterable, iterateListLike, ListWrapper} from 'angular2/src/facade/collection'; +import {BaseException} from '../../../src/facade/exceptions'; +import {isListLikeIterable, iterateListLike} from '../../../src/facade/collection'; import { isBlank, @@ -8,10 +8,10 @@ import { getMapKey, looseIdentical, isArray -} from 'angular2/src/facade/lang'; +} from '../../../src/facade/lang'; import {ChangeDetectorRef} from '../change_detector_ref'; -import {IterableDiffer, IterableDifferFactory, TrackByFn} from '../differs/iterable_differs'; +import {IterableDiffer, IterableDifferFactory, TrackByFn} from './iterable_differs'; /* @ts2dart_const */ export class DefaultIterableDifferFactory implements IterableDifferFactory { diff --git a/modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.ts b/modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.ts index ded64207c5..1b3a9ab545 100644 --- a/modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.ts +++ b/modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.ts @@ -1,8 +1,8 @@ -import {MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {stringify, looseIdentical, isJsObject, isBlank} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {MapWrapper, StringMapWrapper} from '../../../src/facade/collection'; +import {stringify, looseIdentical, isJsObject, isBlank} from '../../../src/facade/lang'; +import {BaseException} from '../../../src/facade/exceptions'; import {ChangeDetectorRef} from '../change_detector_ref'; -import {KeyValueDiffer, KeyValueDifferFactory} from '../differs/keyvalue_differs'; +import {KeyValueDiffer, KeyValueDifferFactory} from './keyvalue_differs'; /* @ts2dart_const */ export class DefaultKeyValueDifferFactory implements KeyValueDifferFactory { diff --git a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts index 132642e552..d88d5e205f 100644 --- a/modules/@angular/core/src/change_detection/differs/iterable_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/iterable_differs.ts @@ -1,8 +1,8 @@ -import {isBlank, isPresent, getTypeNameForDebugging} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {isBlank, isPresent, getTypeNameForDebugging} from '../../../src/facade/lang'; +import {BaseException} from '../../../src/facade/exceptions'; +import {ListWrapper} from '../../../src/facade/collection'; import {ChangeDetectorRef} from '../change_detector_ref'; -import {Provider, SkipSelfMetadata, OptionalMetadata, Injectable} from 'angular2/src/core/di'; +import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di'; /** * A strategy for tracking changes over time to an iterable. Used for {@link NgFor} to diff --git a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts index b12cefe999..3d132e875e 100644 --- a/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts +++ b/modules/@angular/core/src/change_detection/differs/keyvalue_differs.ts @@ -1,8 +1,8 @@ -import {isBlank, isPresent} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {isBlank, isPresent} from '../../../src/facade/lang'; +import {BaseException} from '../../../src/facade/exceptions'; +import {ListWrapper} from '../../../src/facade/collection'; import {ChangeDetectorRef} from '../change_detector_ref'; -import {Provider, SkipSelfMetadata, OptionalMetadata, Injectable} from 'angular2/src/core/di'; +import {Provider, SkipSelfMetadata, OptionalMetadata} from '../../di'; /** * A differ that tracks changes made to an object over time. diff --git a/modules/@angular/core/src/change_detection/pipe_transform.ts b/modules/@angular/core/src/change_detection/pipe_transform.ts index 298fadedee..a3178e3bca 100644 --- a/modules/@angular/core/src/change_detection/pipe_transform.ts +++ b/modules/@angular/core/src/change_detection/pipe_transform.ts @@ -13,7 +13,7 @@ * The `RepeatPipe` below repeats the value as many times as indicated by the first argument: * * ``` - * import {Pipe, PipeTransform} from 'angular2/core'; + * import {Pipe, PipeTransform} from '@angular/core'; * * @Pipe({name: 'repeat'}) * export class RepeatPipe implements PipeTransform { diff --git a/modules/@angular/core/src/console.ts b/modules/@angular/core/src/console.ts index 3d92c988f6..9fb98b9f89 100644 --- a/modules/@angular/core/src/console.ts +++ b/modules/@angular/core/src/console.ts @@ -1,5 +1,5 @@ -import {Injectable} from 'angular2/src/core/di'; -import {print, warn} from 'angular2/src/facade/lang'; +import {print, warn} from './facade/lang'; +import {Injectable} from './di/decorators'; // Note: Need to rename warn as in Dart // class members and imports can't use the same name. diff --git a/modules/@angular/core/src/debug/debug_node.ts b/modules/@angular/core/src/debug/debug_node.ts index f998b651c8..08e644e4be 100644 --- a/modules/@angular/core/src/debug/debug_node.ts +++ b/modules/@angular/core/src/debug/debug_node.ts @@ -1,7 +1,7 @@ -import {isPresent, Type} from 'angular2/src/facade/lang'; -import {Predicate, ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; -import {Injector} from 'angular2/src/core/di'; -import {RenderDebugInfo} from 'angular2/src/core/render/api'; +import {isPresent} from '../../src/facade/lang'; +import {Predicate, ListWrapper, MapWrapper} from '../../src/facade/collection'; +import {Injector} from '../di'; +import {RenderDebugInfo} from '../render/api'; export class EventListener { constructor(public name: string, public callback: Function){}; } diff --git a/modules/@angular/core/src/debug/debug_renderer.ts b/modules/@angular/core/src/debug/debug_renderer.ts index 5af73dd7ba..5c35d8bd09 100644 --- a/modules/@angular/core/src/debug/debug_renderer.ts +++ b/modules/@angular/core/src/debug/debug_renderer.ts @@ -1,10 +1,10 @@ -import {isPresent} from 'angular2/src/facade/lang'; +import {isPresent} from '../../src/facade/lang'; import { Renderer, RootRenderer, RenderComponentType, RenderDebugInfo -} from 'angular2/src/core/render/api'; +} from '../render/api'; import { DebugNode, DebugElement, @@ -12,7 +12,7 @@ import { getDebugNode, indexDebugNode, removeDebugNodeFromIndex -} from 'angular2/src/core/debug/debug_node'; +} from './debug_node'; export class DebugDomRootRenderer implements RootRenderer { constructor(private _delegate: RootRenderer) {} diff --git a/modules/@angular/core/src/di/decorators.ts b/modules/@angular/core/src/di/decorators.ts index 483c10ef6e..07bfd17031 100644 --- a/modules/@angular/core/src/di/decorators.ts +++ b/modules/@angular/core/src/di/decorators.ts @@ -85,4 +85,4 @@ export var Host: HostMetadataFactory = makeParamDecorator(HostMetadata); /** * Factory for creating {@link SkipSelfMetadata}. */ -export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata); \ No newline at end of file +export var SkipSelf: SkipSelfMetadataFactory = makeParamDecorator(SkipSelfMetadata); diff --git a/modules/@angular/core/src/di/forward_ref.ts b/modules/@angular/core/src/di/forward_ref.ts index 3d28989af2..462807b3f7 100644 --- a/modules/@angular/core/src/di/forward_ref.ts +++ b/modules/@angular/core/src/di/forward_ref.ts @@ -1,4 +1,4 @@ -import {Type, stringify, isFunction} from 'angular2/src/facade/lang'; +import {Type, stringify, isFunction} from '../../src/facade/lang'; /** * An interface that a function passed into {@link forwardRef} has to implement. diff --git a/modules/@angular/core/src/di/injector.ts b/modules/@angular/core/src/di/injector.ts index 3f06dd4557..4339ecf41d 100644 --- a/modules/@angular/core/src/di/injector.ts +++ b/modules/@angular/core/src/di/injector.ts @@ -1,4 +1,4 @@ -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {unimplemented} from '../../src/facade/exceptions'; const _THROW_IF_NOT_FOUND = /*@ts2dart_const*/ new Object(); export const THROW_IF_NOT_FOUND = /*@ts2dart_const*/ _THROW_IF_NOT_FOUND; diff --git a/modules/@angular/core/src/di/metadata.ts b/modules/@angular/core/src/di/metadata.ts index 2b57c6212b..6f834817a3 100644 --- a/modules/@angular/core/src/di/metadata.ts +++ b/modules/@angular/core/src/di/metadata.ts @@ -1,4 +1,4 @@ -import {stringify, isBlank, isPresent} from "angular2/src/facade/lang"; +import {stringify} from '../../src/facade/lang'; /** * A parameter metadata that specifies a dependency. diff --git a/modules/@angular/core/src/di/opaque_token.ts b/modules/@angular/core/src/di/opaque_token.ts index e0165793a8..fddc0fa317 100644 --- a/modules/@angular/core/src/di/opaque_token.ts +++ b/modules/@angular/core/src/di/opaque_token.ts @@ -1,4 +1,3 @@ - /** * Creates a token that can be used in a DI Provider. * diff --git a/modules/@angular/core/src/di/provider.ts b/modules/@angular/core/src/di/provider.ts index ee057e92e1..4db663bf16 100644 --- a/modules/@angular/core/src/di/provider.ts +++ b/modules/@angular/core/src/di/provider.ts @@ -5,8 +5,8 @@ import { isBlank, isFunction, stringify -} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; /** * Describes how the {@link Injector} should instantiate a given token. diff --git a/modules/@angular/core/src/di/provider_util.dart b/modules/@angular/core/src/di/provider_util.dart new file mode 100644 index 0000000000..9b83032815 --- /dev/null +++ b/modules/@angular/core/src/di/provider_util.dart @@ -0,0 +1,20 @@ +import './provider.dart' show Provider; + +bool isProviderLiteral(dynamic obj) { + if (obj is Map) { + Map map = obj as Map; + return map.containsKey('provide'); + } else { + return false; + } +} + +Provider createProvider(dynamic obj) { + Map map = obj as Map; + return new Provider(map['provide'], useClass: map['useClass'], + useValue: map['useValue'], + useExisting: map['useExisting'], + useFactory: map['useFactory'], + deps: map['deps'], + multi: map['multi']); +} diff --git a/modules/@angular/core/src/di/provider_util.ts b/modules/@angular/core/src/di/provider_util.ts new file mode 100644 index 0000000000..0b22cdb6fb --- /dev/null +++ b/modules/@angular/core/src/di/provider_util.ts @@ -0,0 +1,9 @@ +import {Provider} from './provider'; + +export function isProviderLiteral(obj: any): boolean { + return obj && typeof obj == 'object' && obj.provide; +} + +export function createProvider(obj: any): Provider { + return new Provider(obj.provide, obj); +} diff --git a/modules/@angular/core/src/di/reflective_exceptions.ts b/modules/@angular/core/src/di/reflective_exceptions.ts index e58713c135..1e4af7d049 100644 --- a/modules/@angular/core/src/di/reflective_exceptions.ts +++ b/modules/@angular/core/src/di/reflective_exceptions.ts @@ -1,6 +1,6 @@ -import {ListWrapper} from 'angular2/src/facade/collection'; -import {stringify, isBlank} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException, unimplemented} from 'angular2/src/facade/exceptions'; +import {ListWrapper} from '../../src/facade/collection'; +import {stringify, isBlank} from '../../src/facade/lang'; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; import {ReflectiveKey} from './reflective_key'; import {ReflectiveInjector} from './reflective_injector'; diff --git a/modules/@angular/core/src/di/reflective_injector.ts b/modules/@angular/core/src/di/reflective_injector.ts index 066de1e148..67e279867a 100644 --- a/modules/@angular/core/src/di/reflective_injector.ts +++ b/modules/@angular/core/src/di/reflective_injector.ts @@ -1,5 +1,5 @@ -import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {Provider, ProviderBuilder, provide} from './provider'; +import {ListWrapper} from '../../src/facade/collection'; +import {Provider} from './provider'; import { ResolvedReflectiveProvider, ReflectiveDependency, @@ -11,13 +11,12 @@ import { NoProviderError, CyclicDependencyError, InstantiationError, - InvalidProviderError, OutOfBoundsError } from './reflective_exceptions'; -import {Type, isPresent} from 'angular2/src/facade/lang'; -import {BaseException, unimplemented} from 'angular2/src/facade/exceptions'; +import {Type} from '../../src/facade/lang'; +import {BaseException, unimplemented} from '../../src/facade/exceptions'; import {ReflectiveKey} from './reflective_key'; -import {SelfMetadata, HostMetadata, SkipSelfMetadata} from './metadata'; +import {SelfMetadata, SkipSelfMetadata} from './metadata'; import {Injector, THROW_IF_NOT_FOUND} from './injector'; var __unused: Type; // avoid unused import when Type union types are erased diff --git a/modules/@angular/core/src/di/reflective_key.ts b/modules/@angular/core/src/di/reflective_key.ts index 6e45293622..2855e84dd7 100644 --- a/modules/@angular/core/src/di/reflective_key.ts +++ b/modules/@angular/core/src/di/reflective_key.ts @@ -1,5 +1,5 @@ -import {stringify, Type, isBlank} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +import {stringify, isBlank} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {resolveForwardRef} from './forward_ref'; /** diff --git a/modules/@angular/core/src/di/reflective_provider.ts b/modules/@angular/core/src/di/reflective_provider.ts index 6154914e48..f08bfff10d 100644 --- a/modules/@angular/core/src/di/reflective_provider.ts +++ b/modules/@angular/core/src/di/reflective_provider.ts @@ -1,10 +1,14 @@ -import {Type, isBlank, isPresent, isArray, isType} from 'angular2/src/facade/lang'; -import {MapWrapper, ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {reflector} from 'angular2/src/core/reflection/reflection'; +import { + Type, + isBlank, + isPresent, + isArray, +} from '../../src/facade/lang'; +import {MapWrapper, ListWrapper} from '../../src/facade/collection'; +import {reflector} from '../reflection/reflection'; import {ReflectiveKey} from './reflective_key'; import { InjectMetadata, - InjectableMetadata, OptionalMetadata, SelfMetadata, HostMetadata, diff --git a/modules/@angular/core/src/facade b/modules/@angular/core/src/facade new file mode 120000 index 0000000000..e084c803c6 --- /dev/null +++ b/modules/@angular/core/src/facade @@ -0,0 +1 @@ +../../facade/src \ No newline at end of file diff --git a/modules/@angular/core/src/linker.ts b/modules/@angular/core/src/linker.ts index 15b2fd4a96..3fc0d36fc9 100644 --- a/modules/@angular/core/src/linker.ts +++ b/modules/@angular/core/src/linker.ts @@ -7,4 +7,4 @@ export {TemplateRef} from './linker/template_ref'; export {EmbeddedViewRef, ViewRef} from './linker/view_ref'; export {ViewContainerRef} from './linker/view_container_ref'; export {ComponentRef, ComponentFactory} from './linker/component_factory'; -export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions'; \ No newline at end of file +export {ExpressionChangedAfterItHasBeenCheckedException} from './linker/exceptions'; diff --git a/modules/@angular/core/src/linker/component_factory.ts b/modules/@angular/core/src/linker/component_factory.ts index 7ca5e5f3a8..4743ce85f0 100644 --- a/modules/@angular/core/src/linker/component_factory.ts +++ b/modules/@angular/core/src/linker/component_factory.ts @@ -1,11 +1,11 @@ -import {Injector} from 'angular2/src/core/di'; -import {Type, isPresent, isBlank} from 'angular2/src/facade/lang'; -import {unimplemented} from 'angular2/src/facade/exceptions'; +import {Type, isPresent, isBlank} from '../../src/facade/lang'; +import {unimplemented} from '../../src/facade/exceptions'; import {ElementRef} from './element_ref'; import {ViewRef, ViewRef_} from './view_ref'; import {AppElement} from './element'; import {ViewUtils} from './view_utils'; import {ChangeDetectorRef} from '../change_detection/change_detection'; +import {Injector} from '../di/injector'; /** * Represents an instance of a Component created via a {@link ComponentFactory}. diff --git a/modules/@angular/core/src/linker/component_resolver.ts b/modules/@angular/core/src/linker/component_resolver.ts index 676ab093c0..c13ae4570f 100644 --- a/modules/@angular/core/src/linker/component_resolver.ts +++ b/modules/@angular/core/src/linker/component_resolver.ts @@ -1,9 +1,9 @@ -import {Injectable} from 'angular2/src/core/di'; -import {Type, isBlank, stringify} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {PromiseWrapper} from 'angular2/src/facade/async'; -import {reflector} from 'angular2/src/core/reflection/reflection'; +import {Type, isBlank, stringify} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; +import {PromiseWrapper} from '../../src/facade/async'; +import {reflector} from '../reflection/reflection'; import {ComponentFactory} from './component_factory'; +import {Injectable} from '../di/decorators'; /** * Low-level service for loading {@link ComponentFactory}s, which diff --git a/modules/@angular/core/src/linker/debug_context.ts b/modules/@angular/core/src/linker/debug_context.ts index e6ab2208a5..820670b178 100644 --- a/modules/@angular/core/src/linker/debug_context.ts +++ b/modules/@angular/core/src/linker/debug_context.ts @@ -1,9 +1,9 @@ -import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {Injector} from 'angular2/src/core/di'; -import {RenderDebugInfo} from 'angular2/src/core/render/api'; -import {DebugAppView} from './view'; +import {isPresent, isBlank} from '../../src/facade/lang'; +import {ListWrapper, StringMapWrapper} from '../../src/facade/collection'; +import {Injector} from '../di'; import {ViewType} from './view_type'; +import {RenderDebugInfo} from '../render/api'; +import {DebugAppView} from './view'; /* @ts2dart_const */ export class StaticNodeDebugInfo { diff --git a/modules/@angular/core/src/linker/dynamic_component_loader.ts b/modules/@angular/core/src/linker/dynamic_component_loader.ts index d8bacca173..289d8ddb7e 100644 --- a/modules/@angular/core/src/linker/dynamic_component_loader.ts +++ b/modules/@angular/core/src/linker/dynamic_component_loader.ts @@ -1,13 +1,11 @@ -import { - Injector, - ResolvedReflectiveProvider, - Injectable, - ReflectiveInjector -} from 'angular2/src/core/di'; import {ComponentResolver} from './component_resolver'; -import {isType, Type, stringify, isPresent} from 'angular2/src/facade/lang'; +import {Type, isPresent} from '../../src/facade/lang'; import {ComponentRef} from './component_factory'; import {ViewContainerRef} from './view_container_ref'; +import {ResolvedReflectiveProvider} from '../di/reflective_provider'; +import {ReflectiveInjector} from '../di/reflective_injector'; +import {Injectable} from '../di/decorators'; +import {Injector} from '../di/injector'; /** * Use ComponentResolver and ViewContainerRef directly. diff --git a/modules/@angular/core/src/linker/element.ts b/modules/@angular/core/src/linker/element.ts index d940ac97a6..07ec6ec16f 100644 --- a/modules/@angular/core/src/linker/element.ts +++ b/modules/@angular/core/src/linker/element.ts @@ -1,16 +1,15 @@ -import {isPresent, isBlank, Type} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; -import {BaseException} from 'angular2/src/facade/exceptions'; - -import {Injector} from 'angular2/src/core/di'; +import {isPresent} from '../../src/facade/lang'; +import {ListWrapper} from '../../src/facade/collection'; +import {BaseException} from '../../src/facade/exceptions'; import {AppView} from './view'; import {ViewType} from './view_type'; import {ElementRef} from './element_ref'; -import {ViewContainerRef, ViewContainerRef_} from './view_container_ref'; +import {ViewContainerRef_} from './view_container_ref'; import {QueryList} from './query_list'; +import {Injector} from '../di/injector'; /** * An AppElement is created for elements that have a ViewContainerRef, diff --git a/modules/@angular/core/src/linker/element_injector.ts b/modules/@angular/core/src/linker/element_injector.ts index cda70d5099..32f87c6589 100644 --- a/modules/@angular/core/src/linker/element_injector.ts +++ b/modules/@angular/core/src/linker/element_injector.ts @@ -1,4 +1,4 @@ -import {Injector, THROW_IF_NOT_FOUND} from 'angular2/src/core/di/injector'; +import {Injector, THROW_IF_NOT_FOUND} from '../di/injector'; import {AppView} from './view'; const _UNDEFINED = /*@ts2dart_const*/ new Object(); diff --git a/modules/@angular/core/src/linker/exceptions.ts b/modules/@angular/core/src/linker/exceptions.ts index 979bc32aa0..683ce4968d 100644 --- a/modules/@angular/core/src/linker/exceptions.ts +++ b/modules/@angular/core/src/linker/exceptions.ts @@ -1,4 +1,4 @@ -import {BaseException, WrappedException} from "angular2/src/facade/exceptions"; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; /** * An error thrown if application changes model breaking the top-down data flow. diff --git a/modules/@angular/core/src/linker/query_list.ts b/modules/@angular/core/src/linker/query_list.ts index 3165121a62..ff2e286014 100644 --- a/modules/@angular/core/src/linker/query_list.ts +++ b/modules/@angular/core/src/linker/query_list.ts @@ -1,6 +1,6 @@ -import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; -import {getSymbolIterator} from 'angular2/src/facade/lang'; -import {Observable, EventEmitter} from 'angular2/src/facade/async'; +import {ListWrapper} from '../../src/facade/collection'; +import {getSymbolIterator} from '../../src/facade/lang'; +import {Observable, EventEmitter} from '../../src/facade/async'; /** diff --git a/modules/@angular/core/src/linker/template_ref.ts b/modules/@angular/core/src/linker/template_ref.ts index c80fb66682..25e3e6ea06 100644 --- a/modules/@angular/core/src/linker/template_ref.ts +++ b/modules/@angular/core/src/linker/template_ref.ts @@ -1,4 +1,4 @@ -import {isBlank} from 'angular2/src/facade/lang'; +import {isBlank} from '../facade/lang'; import {ElementRef} from './element_ref'; import {AppElement} from './element'; import {AppView} from './view'; diff --git a/modules/@angular/core/src/linker/view.ts b/modules/@angular/core/src/linker/view.ts index c91cc9f2d1..77d769574c 100644 --- a/modules/@angular/core/src/linker/view.ts +++ b/modules/@angular/core/src/linker/view.ts @@ -1,13 +1,8 @@ import { ListWrapper, - MapWrapper, - Map, StringMapWrapper, - isListLikeIterable, - areIterablesEqual -} from 'angular2/src/facade/collection'; +} from '../../src/facade/collection'; -import {Injector} from 'angular2/src/core/di'; import {AppElement} from './element'; import { assertionsEnabled, @@ -19,15 +14,10 @@ import { stringify, isPrimitive, isString -} from 'angular2/src/facade/lang'; +} from '../../src/facade/lang'; -import {ObservableWrapper} from 'angular2/src/facade/async'; -import { - Renderer, - RootRenderer, - RenderComponentType, - RenderDebugInfo -} from 'angular2/src/core/render/api'; +import {ObservableWrapper} from '../../src/facade/async'; +import {Renderer, RootRenderer, RenderComponentType, RenderDebugInfo} from '../render/api'; import {ViewRef_} from './view_ref'; import {ViewType} from './view_type'; @@ -42,9 +32,7 @@ import { ChangeDetectorRef, ChangeDetectionStrategy, ChangeDetectorState, - isDefaultChangeDetectionStrategy, - devModeEqual -} from 'angular2/src/core/change_detection/change_detection'; +} from '../change_detection/change_detection'; import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile'; import { ExpressionChangedAfterItHasBeenCheckedException, @@ -53,6 +41,7 @@ import { } from './exceptions'; import {StaticNodeDebugInfo, DebugContext} from './debug_context'; import {ElementInjector} from './element_injector'; +import {Injector} from '../di/injector'; var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`); diff --git a/modules/@angular/core/src/linker/view_container_ref.ts b/modules/@angular/core/src/linker/view_container_ref.ts index 85b404e9ee..e1eb77c14f 100644 --- a/modules/@angular/core/src/linker/view_container_ref.ts +++ b/modules/@angular/core/src/linker/view_container_ref.ts @@ -1,13 +1,13 @@ -import {ListWrapper} from 'angular2/src/facade/collection'; -import {unimplemented} from 'angular2/src/facade/exceptions'; -import {Injector} from 'angular2/src/core/di/injector'; -import {isPresent, isBlank} from 'angular2/src/facade/lang'; +import {ListWrapper} from '../../src/facade/collection'; +import {unimplemented} from '../../src/facade/exceptions'; +import {Injector} from '../di/injector'; +import {isPresent} from '../../src/facade/lang'; import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile'; import {AppElement} from './element'; import {ElementRef} from './element_ref'; -import {TemplateRef, TemplateRef_} from './template_ref'; +import {TemplateRef} from './template_ref'; import {EmbeddedViewRef, ViewRef, ViewRef_} from './view_ref'; import {ComponentFactory, ComponentRef} from './component_factory'; diff --git a/modules/@angular/core/src/linker/view_ref.ts b/modules/@angular/core/src/linker/view_ref.ts index 4d7a8cc105..16788d85d7 100644 --- a/modules/@angular/core/src/linker/view_ref.ts +++ b/modules/@angular/core/src/linker/view_ref.ts @@ -1,8 +1,7 @@ -import {unimplemented} from 'angular2/src/facade/exceptions'; -import {isPresent} from 'angular2/src/facade/lang'; +import {unimplemented} from '../../src/facade/exceptions'; import {ChangeDetectorRef} from '../change_detection/change_detector_ref'; import {AppView} from './view'; -import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/constants'; +import {ChangeDetectionStrategy} from '../change_detection/constants'; export abstract class ViewRef { get destroyed(): boolean { return unimplemented(); } diff --git a/modules/@angular/core/src/linker/view_utils.ts b/modules/@angular/core/src/linker/view_utils.ts index 33ab6d0ec4..2c41724980 100644 --- a/modules/@angular/core/src/linker/view_utils.ts +++ b/modules/@angular/core/src/linker/view_utils.ts @@ -1,13 +1,18 @@ -import {isBlank, isPresent, Type, stringify, looseIdentical} from 'angular2/src/facade/lang'; -import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import { + isBlank, + isPresent, + looseIdentical +} from '../../src/facade/lang'; +import {ListWrapper, StringMapWrapper} from '../../src/facade/collection'; +import {BaseException} from '../../src/facade/exceptions'; import {AppElement} from './element'; import {ExpressionChangedAfterItHasBeenCheckedException} from './exceptions'; -import {devModeEqual, uninitialized} from 'angular2/src/core/change_detection/change_detection'; -import {Inject, Injectable} from 'angular2/src/core/di'; -import {RootRenderer, RenderComponentType, Renderer} from 'angular2/src/core/render/api'; -import {APP_ID} from 'angular2/src/core/application_tokens'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; +import {devModeEqual} from '../change_detection/change_detection'; +import {RootRenderer, RenderComponentType, Renderer} from '../render/api'; +import {APP_ID} from '../application_tokens'; +import {ViewEncapsulation} from '../metadata/view'; +import {Injectable, Inject} from '../di/decorators'; +import {uninitialized} from "../change_detection/change_detection_util"; @Injectable() export class ViewUtils { diff --git a/modules/@angular/core/src/metadata.ts b/modules/@angular/core/src/metadata.ts index 3528876be1..174adbac3d 100644 --- a/modules/@angular/core/src/metadata.ts +++ b/modules/@angular/core/src/metadata.ts @@ -57,16 +57,15 @@ import { } from './metadata/directives'; import {ViewMetadata, ViewEncapsulation} from './metadata/view'; -import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection/change_detection'; +import {ChangeDetectionStrategy} from './change_detection/change_detection'; import { makeDecorator, makeParamDecorator, makePropDecorator, TypeDecorator, - Class } from './util/decorators'; -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '../src/facade/lang'; /** * Interface for the {@link DirectiveMetadata} decorator function. @@ -262,7 +261,7 @@ export interface ComponentMetadataFactory { * ### Example as TypeScript Decorator * * ``` - * import {Component, View} from "angular2/core"; + * import {Component, View} from '@angular/core'; * * @Component({...}) * class MyComponent { @@ -364,7 +363,7 @@ export interface AttributeMetadataFactory { * ### Example as TypeScript Decorator * * ``` - * import {Query, QueryList, Component} from "angular2/core"; + * import {Query, QueryList, Component} from '@angular/core'; * * @Component({...}) * class MyComponent { diff --git a/modules/@angular/core/src/metadata/di.ts b/modules/@angular/core/src/metadata/di.ts index f01e7adce5..67d7afb1e6 100644 --- a/modules/@angular/core/src/metadata/di.ts +++ b/modules/@angular/core/src/metadata/di.ts @@ -1,6 +1,6 @@ -import {Type, stringify, isPresent, isString} from 'angular2/src/facade/lang'; -import {resolveForwardRef} from 'angular2/src/core/di'; -import {DependencyMetadata} from 'angular2/src/core/di/metadata'; +import {stringify, isString, Type} from '../../src/facade/lang'; +import {DependencyMetadata} from '../di/metadata'; +import {resolveForwardRef} from '../di/forward_ref'; /** * Specifies that a constant attribute value should be injected. diff --git a/modules/@angular/core/src/metadata/directives.ts b/modules/@angular/core/src/metadata/directives.ts index 20be8da4a3..9234828724 100644 --- a/modules/@angular/core/src/metadata/directives.ts +++ b/modules/@angular/core/src/metadata/directives.ts @@ -1,7 +1,7 @@ -import {isPresent, Type} from 'angular2/src/facade/lang'; -import {InjectableMetadata} from 'angular2/src/core/di/metadata'; -import {ChangeDetectionStrategy} from 'angular2/src/core/change_detection'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; +import {isPresent, Type} from '../../src/facade/lang'; +import {InjectableMetadata} from '../di/metadata'; +import {ViewEncapsulation} from './view'; +import {ChangeDetectionStrategy} from '../change_detection/constants'; /** * Directives allow you to attach behavior to elements in the DOM. diff --git a/modules/@angular/core/src/metadata/lifecycle_hooks.ts b/modules/@angular/core/src/metadata/lifecycle_hooks.ts index ff244a57d8..f6d8425a70 100644 --- a/modules/@angular/core/src/metadata/lifecycle_hooks.ts +++ b/modules/@angular/core/src/metadata/lifecycle_hooks.ts @@ -1,4 +1,4 @@ -import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util'; +import {SimpleChange} from '../change_detection/change_detection_util'; export enum LifecycleHooks { OnInit, @@ -242,7 +242,7 @@ export interface DoCheck { ngDoCheck(); } * the interval when the binding is destroyed or the countdown completes. * * ``` - * import {OnDestroy, Pipe, PipeTransform} from 'angular2/core' + * import {OnDestroy, Pipe, PipeTransform} from '@angular/core' * @Pipe({name: 'countdown', pure: false}) * class CountDown implements PipeTransform, OnDestroy { * remainingTime:Number; diff --git a/modules/@angular/core/src/metadata/view.ts b/modules/@angular/core/src/metadata/view.ts index b35931910f..8fbe28dafa 100644 --- a/modules/@angular/core/src/metadata/view.ts +++ b/modules/@angular/core/src/metadata/view.ts @@ -1,4 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '../../src/facade/lang'; /** * Defines template and style encapsulation options available for Component's {@link View}. diff --git a/modules/@angular/core/src/platform_common_providers.ts b/modules/@angular/core/src/platform_common_providers.ts index 1eedbc3643..3e5552d447 100644 --- a/modules/@angular/core/src/platform_common_providers.ts +++ b/modules/@angular/core/src/platform_common_providers.ts @@ -1,9 +1,9 @@ -import {Type} from 'angular2/src/facade/lang'; -import {Provider} from 'angular2/src/core/di'; -import {Console} from 'angular2/src/core/console'; +import {Type, isBlank, isPresent, assertionsEnabled} from '../src/facade/lang'; +import {provide, Provider, Injector, OpaqueToken} from './di'; +import {Console} from './console'; import {Reflector, reflector} from './reflection/reflection'; import {ReflectorReader} from './reflection/reflector_reader'; -import {TestabilityRegistry} from 'angular2/src/core/testability/testability'; +import {TestabilityRegistry} from './testability/testability'; import {PLATFORM_CORE_PROVIDERS} from './application_ref'; function _reflector(): Reflector { diff --git a/modules/@angular/core/src/platform_directives_and_pipes.ts b/modules/@angular/core/src/platform_directives_and_pipes.ts index 0ecdde7a2d..bf49d39875 100644 --- a/modules/@angular/core/src/platform_directives_and_pipes.ts +++ b/modules/@angular/core/src/platform_directives_and_pipes.ts @@ -1,4 +1,4 @@ -import {OpaqueToken} from "angular2/src/core/di"; +import {OpaqueToken} from './di'; /** * A token that can be provided when bootstraping an application to make an array of directives @@ -7,7 +7,7 @@ import {OpaqueToken} from "angular2/src/core/di"; * ### Example * * ```typescript - * import {PLATFORM_DIRECTIVES} from 'angular2/core'; + * import {PLATFORM_DIRECTIVES} from '@angular/core'; * import {OtherDirective} from './myDirectives'; * * @Component({ @@ -34,7 +34,7 @@ export const PLATFORM_DIRECTIVES: OpaqueToken = * ### Example * * ```typescript - * import {PLATFORM_PIPES} from 'angular2/core'; + * import {PLATFORM_PIPES} from '@angular/core'; * import {OtherPipe} from './myPipe'; * * @Component({ diff --git a/modules/@angular/core/src/prod_mode.ts b/modules/@angular/core/src/prod_mode.ts index e44014dae6..7d2cfc843f 100644 --- a/modules/@angular/core/src/prod_mode.ts +++ b/modules/@angular/core/src/prod_mode.ts @@ -1 +1 @@ -export {enableProdMode} from 'angular2/src/facade/lang'; \ No newline at end of file +export {enableProdMode} from '../src/facade/lang'; diff --git a/modules/@angular/core/src/profile/profile.ts b/modules/@angular/core/src/profile/profile.ts index eaefd058c9..220a24c6db 100644 --- a/modules/@angular/core/src/profile/profile.ts +++ b/modules/@angular/core/src/profile/profile.ts @@ -1,6 +1,6 @@ export {WtfScopeFn} from './wtf_impl'; -import * as impl from "./wtf_impl"; +import * as impl from './wtf_impl'; // Change exports to const once https://github.com/angular/ts2dart/issues/150 diff --git a/modules/@angular/core/src/profile/wtf_impl.ts b/modules/@angular/core/src/profile/wtf_impl.ts index 1a5e5e1074..f3b6e6b378 100644 --- a/modules/@angular/core/src/profile/wtf_impl.ts +++ b/modules/@angular/core/src/profile/wtf_impl.ts @@ -1,4 +1,4 @@ -import {global} from 'angular2/src/facade/lang'; +import {global} from '../../src/facade/lang'; /** * A scope function for the Web Tracing Framework (WTF). diff --git a/modules/@angular/core/src/reflection/platform_reflection_capabilities.ts b/modules/@angular/core/src/reflection/platform_reflection_capabilities.ts index 96d04a3d8a..ad4c13f27e 100644 --- a/modules/@angular/core/src/reflection/platform_reflection_capabilities.ts +++ b/modules/@angular/core/src/reflection/platform_reflection_capabilities.ts @@ -1,4 +1,4 @@ -import {Type} from 'angular2/src/facade/lang'; +import {Type} from '../../src/facade/lang'; import {GetterFn, SetterFn, MethodFn} from './types'; export interface PlatformReflectionCapabilities { diff --git a/modules/@angular/core/src/reflection/reflection.ts b/modules/@angular/core/src/reflection/reflection.ts index 2d4fc89f74..1028ce0159 100644 --- a/modules/@angular/core/src/reflection/reflection.ts +++ b/modules/@angular/core/src/reflection/reflection.ts @@ -1,5 +1,3 @@ -import {Type, isPresent} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {Reflector} from './reflector'; export {Reflector, ReflectionInfo} from './reflector'; import {ReflectionCapabilities} from './reflection_capabilities'; diff --git a/modules/@angular/core/src/reflection/reflection_capabilities.ts b/modules/@angular/core/src/reflection/reflection_capabilities.ts index 516f67f398..5ebe68a1c2 100644 --- a/modules/@angular/core/src/reflection/reflection_capabilities.ts +++ b/modules/@angular/core/src/reflection/reflection_capabilities.ts @@ -5,8 +5,8 @@ import { global, stringify, ConcreteType -} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {GetterFn, SetterFn, MethodFn} from './types'; import {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; diff --git a/modules/@angular/core/src/reflection/reflector.ts b/modules/@angular/core/src/reflection/reflector.ts index f8253c94bc..191db83e6c 100644 --- a/modules/@angular/core/src/reflection/reflector.ts +++ b/modules/@angular/core/src/reflection/reflector.ts @@ -1,5 +1,5 @@ -import {Type, isPresent, stringify} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +import {Type, isPresent, stringify} from '../../src/facade/lang'; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; import { ListWrapper, Map, @@ -7,7 +7,7 @@ import { Set, SetWrapper, StringMapWrapper -} from 'angular2/src/facade/collection'; +} from '../../src/facade/collection'; import {SetterFn, GetterFn, MethodFn} from './types'; import {ReflectorReader} from './reflector_reader'; import {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; diff --git a/modules/@angular/core/src/reflection/types.ts b/modules/@angular/core/src/reflection/types.ts index f7695de8ec..f53fd0eff8 100644 --- a/modules/@angular/core/src/reflection/types.ts +++ b/modules/@angular/core/src/reflection/types.ts @@ -1,5 +1,3 @@ -import {Type} from 'angular2/src/facade/lang'; - export type SetterFn = (obj: any, value: any) => void; export type GetterFn = (obj: any) => any; export type MethodFn = (obj: any, args: any[]) => any; diff --git a/modules/@angular/core/src/render/api.ts b/modules/@angular/core/src/render/api.ts index 5e2c1f6d9f..d2fb99e979 100644 --- a/modules/@angular/core/src/render/api.ts +++ b/modules/@angular/core/src/render/api.ts @@ -1,6 +1,6 @@ -import {unimplemented} from 'angular2/src/facade/exceptions'; -import {ViewEncapsulation} from 'angular2/src/core/metadata/view'; -import {Injector, Injectable} from 'angular2/src/core/di'; +import {unimplemented} from '../../src/facade/exceptions'; +import {ViewEncapsulation} from '../metadata/view'; +import {Injector} from '../di/injector'; export class RenderComponentType { constructor(public id: string, public templateUrl: string, public slotCount: number, diff --git a/modules/@angular/core/src/testability/testability.ts b/modules/@angular/core/src/testability/testability.ts index 3a68fd3e89..3c85877f30 100644 --- a/modules/@angular/core/src/testability/testability.ts +++ b/modules/@angular/core/src/testability/testability.ts @@ -1,9 +1,9 @@ -import {Injectable} from 'angular2/src/core/di'; -import {Map, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; -import {scheduleMicroTask} from 'angular2/src/facade/lang'; -import {BaseException} from 'angular2/src/facade/exceptions'; +import {Map, MapWrapper} from '../../src/facade/collection'; +import {scheduleMicroTask} from '../../src/facade/lang'; +import {BaseException} from '../../src/facade/exceptions'; import {NgZone} from '../zone/ng_zone'; -import {ObservableWrapper} from 'angular2/src/facade/async'; +import {ObservableWrapper} from '../../src/facade/async'; +import {Injectable} from '../di/decorators'; /** diff --git a/modules/@angular/core/src/util.ts b/modules/@angular/core/src/util.ts index a0004ebcd8..b28f30bfd7 100644 --- a/modules/@angular/core/src/util.ts +++ b/modules/@angular/core/src/util.ts @@ -1,2 +1,2 @@ // Public API for util -export {Class, ClassDefinition, TypeDecorator} from './util/decorators'; \ No newline at end of file +export {Class, ClassDefinition, TypeDecorator} from './util/decorators'; diff --git a/modules/@angular/core/src/util/decorators.ts b/modules/@angular/core/src/util/decorators.ts index 6e54ec84f7..a3427d27eb 100644 --- a/modules/@angular/core/src/util/decorators.ts +++ b/modules/@angular/core/src/util/decorators.ts @@ -1,4 +1,4 @@ -import {ConcreteType, global, Type, isFunction, stringify} from 'angular2/src/facade/lang'; +import {ConcreteType, global, Type, isFunction, stringify} from '../../src/facade/lang'; var _nextClassId = 0; @@ -222,7 +222,7 @@ export function Class(clsDef: ClassDefinition): ConcreteType { } for (var key in clsDef) { if (key != 'extends' && key != 'prototype' && clsDef.hasOwnProperty(key)) { - proto[key] = applyParams(clsDef[key], key); + proto[key] = applyParams(clsDef[key], key); } } diff --git a/modules/@angular/core/src/zone/ng_zone.ts b/modules/@angular/core/src/zone/ng_zone.ts index fb34d02b74..49821a2d6a 100644 --- a/modules/@angular/core/src/zone/ng_zone.ts +++ b/modules/@angular/core/src/zone/ng_zone.ts @@ -1,6 +1,6 @@ -import {EventEmitter} from 'angular2/src/facade/async'; +import {EventEmitter} from '../../src/facade/async'; import {NgZoneImpl, NgZoneError} from './ng_zone_impl'; -import {BaseException} from '../../facade/exceptions'; +import {BaseException} from '../../src/facade/exceptions'; export {NgZoneError} from './ng_zone_impl'; @@ -19,8 +19,8 @@ export {NgZoneError} from './ng_zone_impl'; * * ### Example ([live demo](http://plnkr.co/edit/lY9m8HLy7z06vDoUaSN2?p=preview)) * ``` - * import {Component, View, NgZone} from 'angular2/core'; - * import {NgIf} from 'angular2/common'; + * import {Component, View, NgZone} from '@angular/core'; + * import {NgIf} from '@angular/common'; * * @Component({ * selector: 'ng-zone-demo'. diff --git a/modules/@angular/core/src/zone/ng_zone_impl.ts b/modules/@angular/core/src/zone/ng_zone_impl.ts index 4d5a356631..f81855f8ae 100644 --- a/modules/@angular/core/src/zone/ng_zone_impl.ts +++ b/modules/@angular/core/src/zone/ng_zone_impl.ts @@ -1,5 +1,3 @@ -import {global} from 'angular2/src/facade/lang'; - /** * Stores error information; delivered via [NgZone.onError] stream. */ @@ -90,7 +88,7 @@ export class NgZoneImpl { } }); } else { - throw new Error('Angular2 needs to be run with Zone.js polyfill.'); + throw new Error('Angular requires Zone.js polyfill.'); } } diff --git a/modules/@angular/core/test/application_ref_spec.ts b/modules/@angular/core/test/application_ref_spec.ts index 674a941841..1d9f8658a6 100644 --- a/modules/@angular/core/test/application_ref_spec.ts +++ b/modules/@angular/core/test/application_ref_spec.ts @@ -7,21 +7,17 @@ import { expect, beforeEach, afterEach, - el, - AsyncTestCompleter, - fakeAsync, - tick, inject, - SpyObject -} from 'angular2/testing_internal'; -import {Type} from 'angular2/src/facade/lang'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {Type} from '@angular/core'; import {SpyChangeDetectorRef} from './spies'; import { ApplicationRef_, ApplicationRef, PLATFORM_CORE_PROVIDERS, APPLICATION_CORE_PROVIDERS -} from "angular2/src/core/application_ref"; +} from '@angular/core/src/application_ref'; import { Injector, Provider, @@ -35,16 +31,16 @@ import { disposePlatform, ComponentResolver, ChangeDetectorRef -} from "angular2/core"; -import {Console} from 'angular2/src/core/console'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {PromiseWrapper, PromiseCompleter, TimerWrapper} from "angular2/src/facade/async"; +} from '@angular/core'; +import {Console} from '@angular/core/src/console'; +import {BaseException} from '../src/facade/exceptions'; +import {PromiseWrapper, PromiseCompleter, TimerWrapper} from '../src/facade/async'; import { ComponentFactory, ComponentRef_, ComponentRef -} from 'angular2/src/core/linker/component_factory'; -import {ExceptionHandler} from 'angular2/src/facade/exception_handler'; +} from '@angular/core/src/linker/component_factory'; +import {ExceptionHandler} from '../src/facade/exception_handler'; export function main() { describe("bootstrap", () => { @@ -66,8 +62,8 @@ export function main() { var appInjector = ReflectiveInjector.resolveAndCreate( [ APPLICATION_CORE_PROVIDERS, - new Provider(Console, {useValue: new _MockConsole()}), - new Provider(ExceptionHandler, {useValue: new ExceptionHandler(errorLogger, false)}), + {provide: Console, useValue: new _MockConsole()}, + {provide: ExceptionHandler, useValue: new ExceptionHandler(errorLogger, false)}, new Provider(ComponentResolver, {useValue: new _MockComponentResolver(someCompFactory)}), providers @@ -117,8 +113,8 @@ export function main() { initializerDone = true; }, 1); var app = createApplication( - [new Provider(APP_INITIALIZER, {useValue: () => completer.promise, multi: true})]); - coreLoadAndBootstrap(app.injector, MyComp) + [{provide: APP_INITIALIZER, useValue: () => completer.promise, multi: true}]); + coreLoadAndBootstrap(app.injector, MyComp6) .then((compRef) => { expect(initializerDone).toBe(true); async.done(); @@ -142,7 +138,7 @@ export function main() { } @Component({selector: 'my-comp', template: ''}) -class MyComp { +class MyComp6 { } class _ArrayLogger { diff --git a/modules/@angular/core/test/change_detection/change_detector_util_spec.ts b/modules/@angular/core/test/change_detection/change_detector_util_spec.ts index 07e8c1c5c9..b707792b63 100644 --- a/modules/@angular/core/test/change_detection/change_detector_util_spec.ts +++ b/modules/@angular/core/test/change_detection/change_detector_util_spec.ts @@ -7,9 +7,9 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {devModeEqual} from 'angular2/src/core/change_detection/change_detection_util'; +import {devModeEqual} from '@angular/core/src/change_detection/change_detection_util'; export function main() { describe("ChangeDetectionUtil", () => { diff --git a/modules/@angular/core/test/change_detection/differs/default_iterable_differ_spec.ts b/modules/@angular/core/test/change_detection/differs/default_iterable_differ_spec.ts index d897999bf8..521310f8d0 100644 --- a/modules/@angular/core/test/change_detection/differs/default_iterable_differ_spec.ts +++ b/modules/@angular/core/test/change_detection/differs/default_iterable_differ_spec.ts @@ -7,17 +7,17 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import { DefaultIterableDiffer, DefaultIterableDifferFactory -} from 'angular2/src/core/change_detection/differs/default_iterable_differ'; +} from '@angular/core/src/change_detection/differs/default_iterable_differ'; -import {NumberWrapper} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {NumberWrapper} from '../../../src/facade/lang'; +import {ListWrapper} from '../../../src/facade/collection'; -import {TestIterable} from '../../../core/change_detection/iterable'; -import {iterableChangesAsString} from '../../../core/change_detection/util'; +import {TestIterable} from '../../change_detection/iterable'; +import {iterableChangesAsString} from '../../change_detection/util'; class ItemWithId { constructor(private id: string) {} diff --git a/modules/@angular/core/test/change_detection/differs/default_keyvalue_differ_spec.ts b/modules/@angular/core/test/change_detection/differs/default_keyvalue_differ_spec.ts index e44c399190..ae7d795540 100644 --- a/modules/@angular/core/test/change_detection/differs/default_keyvalue_differ_spec.ts +++ b/modules/@angular/core/test/change_detection/differs/default_keyvalue_differ_spec.ts @@ -7,13 +7,13 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import { DefaultKeyValueDiffer, DefaultKeyValueDifferFactory -} from 'angular2/src/core/change_detection/differs/default_keyvalue_differ'; -import {NumberWrapper, isJsObject} from 'angular2/src/facade/lang'; -import {kvChangesAsString} from '../../../core/change_detection/util'; +} from '@angular/core/src/change_detection/differs/default_keyvalue_differ'; +import {NumberWrapper, isJsObject} from '../../../src/facade/lang'; +import {kvChangesAsString} from '../../change_detection/util'; // todo(vicb): Update the code & tests for object equality export function main() { diff --git a/modules/@angular/core/test/change_detection/differs/iterable_differs_spec.ts b/modules/@angular/core/test/change_detection/differs/iterable_differs_spec.ts index 4cb2c2b010..cdcac4afc8 100644 --- a/modules/@angular/core/test/change_detection/differs/iterable_differs_spec.ts +++ b/modules/@angular/core/test/change_detection/differs/iterable_differs_spec.ts @@ -7,10 +7,10 @@ import { expect, beforeEach, afterEach -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import {SpyIterableDifferFactory} from '../../spies'; -import {IterableDiffers} from 'angular2/src/core/change_detection/differs/iterable_differs'; -import {Injector, provide, ReflectiveInjector} from 'angular2/core'; +import {IterableDiffers} from '@angular/core/src/change_detection/differs/iterable_differs'; +import {Injector, provide, ReflectiveInjector} from '@angular/core'; export function main() { describe('IterableDiffers', function() { diff --git a/modules/@angular/core/test/change_detection/iterable.ts b/modules/@angular/core/test/change_detection/iterable.ts index 95ab9ca7c1..0c64783651 100644 --- a/modules/@angular/core/test/change_detection/iterable.ts +++ b/modules/@angular/core/test/change_detection/iterable.ts @@ -1,4 +1,4 @@ -import {getSymbolIterator} from 'angular2/src/facade/lang'; +import {getSymbolIterator} from '../../src/facade/lang'; export class TestIterable { list: number[]; diff --git a/modules/@angular/core/test/change_detection/util.ts b/modules/@angular/core/test/change_detection/util.ts index 686884a15b..71e5dff25f 100644 --- a/modules/@angular/core/test/change_detection/util.ts +++ b/modules/@angular/core/test/change_detection/util.ts @@ -1,4 +1,4 @@ -import {isBlank} from 'angular2/src/facade/lang'; +import {isBlank} from '../../src/facade/lang'; export function iterableChangesAsString( {collection = /*@ts2dart_const*/[], previous = /*@ts2dart_const*/[], diff --git a/modules/@angular/core/test/debug/debug_node_spec.ts b/modules/@angular/core/test/debug/debug_node_spec.ts index d00e36a1db..0e636aa9ca 100644 --- a/modules/@angular/core/test/debug/debug_node_spec.ts +++ b/modules/@angular/core/test/debug/debug_node_spec.ts @@ -1,36 +1,35 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, xdescribe, describe, - dispatchEvent, expect, iit, inject, beforeEachProviders, it, xit, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder} from '@angular/compiler/testing'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; -import {PromiseWrapper, EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; +import {PromiseWrapper, EventEmitter, ObservableWrapper} from '../../src/facade/async'; -import {Injectable} from 'angular2/core'; -import {NgFor, NgIf} from 'angular2/common'; -import {By} from 'angular2/platform/common_dom'; +import {Injectable} from '@angular/core'; +import {NgFor, NgIf} from '@angular/common'; +import {By} from '@angular/platform-browser/src/dom/debug/by'; -import {Directive, Component, Input} from 'angular2/src/core/metadata'; +import {Directive, Component, Input} from '@angular/core/src/metadata'; @Injectable() class Logger { - log: string[]; + logs: string[]; - constructor() { this.log = []; } + constructor() { this.logs = []; } - add(thing: string) { this.log.push(thing); } + add(thing: string) { this.logs.push(thing); } } @Directive({selector: '[message]', inputs: ['message']}) @@ -208,24 +207,24 @@ export function main() { // The root component has 3 elements in its view. expect(childEls.length).toEqual(3); - expect(DOM.hasClass(childEls[0].nativeElement, 'parent')).toBe(true); - expect(DOM.hasClass(childEls[1].nativeElement, 'parent')).toBe(true); - expect(DOM.hasClass(childEls[2].nativeElement, 'child-comp-class')).toBe(true); + expect(getDOM().hasClass(childEls[0].nativeElement, 'parent')).toBe(true); + expect(getDOM().hasClass(childEls[1].nativeElement, 'parent')).toBe(true); + expect(getDOM().hasClass(childEls[2].nativeElement, 'child-comp-class')).toBe(true); var nested = childEls[0].children; expect(nested.length).toEqual(1); - expect(DOM.hasClass(nested[0].nativeElement, 'parentnested')).toBe(true); + expect(getDOM().hasClass(nested[0].nativeElement, 'parentnested')).toBe(true); var childComponent = childEls[2]; var childCompChildren = childComponent.children; expect(childCompChildren.length).toEqual(2); - expect(DOM.hasClass(childCompChildren[0].nativeElement, 'child')).toBe(true); - expect(DOM.hasClass(childCompChildren[1].nativeElement, 'child')).toBe(true); + expect(getDOM().hasClass(childCompChildren[0].nativeElement, 'child')).toBe(true); + expect(getDOM().hasClass(childCompChildren[1].nativeElement, 'child')).toBe(true); var childNested = childCompChildren[0].children; expect(childNested.length).toEqual(1); - expect(DOM.hasClass(childNested[0].nativeElement, 'childnested')).toBe(true); + expect(getDOM().hasClass(childNested[0].nativeElement, 'childnested')).toBe(true); async.done(); }); @@ -241,8 +240,8 @@ export function main() { // The root component has 2 elements in its view. expect(childEls.length).toEqual(2); - expect(DOM.hasClass(childEls[0].nativeElement, 'parent')).toBe(true); - expect(DOM.hasClass(childEls[1].nativeElement, 'cond-content-comp-class')) + expect(getDOM().hasClass(childEls[0].nativeElement, 'parent')).toBe(true); + expect(getDOM().hasClass(childEls[1].nativeElement, 'cond-content-comp-class')) .toBe(true); var conditionalContentComp = childEls[1]; @@ -295,7 +294,7 @@ export function main() { var childTestEls = fixture.debugElement.queryAll(By.css('child-comp')); expect(childTestEls.length).toBe(1); - expect(DOM.hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true); + expect(getDOM().hasClass(childTestEls[0].nativeElement, 'child-comp-class')).toBe(true); async.done(); }); @@ -310,10 +309,10 @@ export function main() { var childTestEls = fixture.debugElement.queryAll(By.directive(MessageDir)); expect(childTestEls.length).toBe(4); - expect(DOM.hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true); - expect(DOM.hasClass(childTestEls[1].nativeElement, 'parentnested')).toBe(true); - expect(DOM.hasClass(childTestEls[2].nativeElement, 'child')).toBe(true); - expect(DOM.hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true); + expect(getDOM().hasClass(childTestEls[0].nativeElement, 'parent')).toBe(true); + expect(getDOM().hasClass(childTestEls[1].nativeElement, 'parentnested')).toBe(true); + expect(getDOM().hasClass(childTestEls[2].nativeElement, 'child')).toBe(true); + expect(getDOM().hasClass(childTestEls[3].nativeElement, 'childnested')).toBe(true); async.done(); }); @@ -351,7 +350,7 @@ export function main() { .then((fixture) => { fixture.detectChanges(); - expect(((fixture.debugElement.children[0].inject(Logger))).log) + expect(((fixture.debugElement.children[0].inject(Logger))).logs) .toEqual(['parent', 'nestedparent', 'child', 'nestedchild']); async.done(); diff --git a/modules/@angular/core/test/dev_mode_spec.ts b/modules/@angular/core/test/dev_mode_spec.ts index 08879ee819..2527514202 100644 --- a/modules/@angular/core/test/dev_mode_spec.ts +++ b/modules/@angular/core/test/dev_mode_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -9,9 +8,9 @@ import { it, xdescribe, xit -} from 'angular2/testing_internal'; +} from '../testing'; -import {assertionsEnabled, IS_DART} from 'angular2/src/facade/lang'; +import {assertionsEnabled, IS_DART} from '../../router/src/facade/lang'; export function main() { describe('dev mode', () => { diff --git a/modules/@angular/core/test/di/binding_spec.dart b/modules/@angular/core/test/di/binding_spec.dart index 68bf695fba..204bb1e67f 100644 --- a/modules/@angular/core/test/di/binding_spec.dart +++ b/modules/@angular/core/test/di/binding_spec.dart @@ -3,7 +3,7 @@ library angular2.test.di.binding_dart_spec; import 'dart:mirrors'; -import 'package:angular2/testing_internal.dart'; +import 'package:@angular/core/testing/testing_internal.dart'; import 'package:angular2/core.dart'; main() { diff --git a/modules/@angular/core/test/di/binding_spec.ts b/modules/@angular/core/test/di/binding_spec.ts index b69742538c..164aa85513 100644 --- a/modules/@angular/core/test/di/binding_spec.ts +++ b/modules/@angular/core/test/di/binding_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -8,9 +7,9 @@ import { inject, it, xit, -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {bind, provide} from 'angular2/core'; +import {bind, provide} from '@angular/core'; export function main() { describe('provider', () => { diff --git a/modules/@angular/core/test/di/forward_ref_spec.ts b/modules/@angular/core/test/di/forward_ref_spec.ts index c4e4688a4e..5c0d3d421b 100644 --- a/modules/@angular/core/test/di/forward_ref_spec.ts +++ b/modules/@angular/core/test/di/forward_ref_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -8,9 +7,9 @@ import { inject, it, xit, -} from 'angular2/testing_internal'; -import {forwardRef, resolveForwardRef} from 'angular2/src/core/di'; -import {Type} from 'angular2/src/facade/lang'; +} from '@angular/core/testing/testing_internal'; +import {forwardRef, resolveForwardRef} from '@angular/core/src/di'; +import {Type} from '../../src/facade/lang'; export function main() { describe("forwardRef", function() { diff --git a/modules/@angular/core/test/di/reflective_injector_spec.ts b/modules/@angular/core/test/di/reflective_injector_spec.ts index c143deab23..620ac4d921 100644 --- a/modules/@angular/core/test/di/reflective_injector_spec.ts +++ b/modules/@angular/core/test/di/reflective_injector_spec.ts @@ -1,6 +1,6 @@ -import {isBlank, stringify, isPresent} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {describe, ddescribe, it, iit, expect, beforeEach} from 'angular2/testing_internal'; +import {isBlank, stringify, isPresent} from '../../src/facade/lang'; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; +import {describe, ddescribe, it, iit, expect, beforeEach} from '@angular/core/testing'; import { provide, ReflectiveKey, @@ -14,15 +14,15 @@ import { Optional, Inject, Provider -} from 'angular2/core'; +} from '@angular/core'; import { ReflectiveInjector_, ReflectiveInjectorInlineStrategy, ReflectiveInjectorDynamicStrategy, ReflectiveProtoInjector -} from 'angular2/src/core/di/reflective_injector'; -import {DependencyMetadata} from 'angular2/src/core/di/metadata'; -import {ResolvedReflectiveProvider_} from 'angular2/src/core/di/reflective_provider'; +} from '@angular/core/src/di/reflective_injector'; +import {DependencyMetadata} from '@angular/core/src/di/metadata'; +import {ResolvedReflectiveProvider_} from '@angular/core/src/di/reflective_provider'; class CustomDependencyMetadata extends DependencyMetadata {} diff --git a/modules/@angular/core/test/di/reflective_key_spec.ts b/modules/@angular/core/test/di/reflective_key_spec.ts index 031cd6acae..fb639f6d34 100644 --- a/modules/@angular/core/test/di/reflective_key_spec.ts +++ b/modules/@angular/core/test/di/reflective_key_spec.ts @@ -1,5 +1,5 @@ -import {describe, iit, it, expect, beforeEach} from 'angular2/testing_internal'; -import {ReflectiveKey, KeyRegistry} from 'angular2/src/core/di/reflective_key'; +import {describe, iit, it, expect, beforeEach} from '@angular/core/testing'; +import {ReflectiveKey, KeyRegistry} from '@angular/core/src/di/reflective_key'; export function main() { describe("key", function() { @@ -17,4 +17,4 @@ export function main() { function() { expect(registry.get(registry.get('car'))).toBe(registry.get('car')); }); }); -} \ No newline at end of file +} diff --git a/modules/@angular/core/test/directive_lifecycle_integration_spec.ts b/modules/@angular/core/test/directive_lifecycle_integration_spec.ts index 58e158dda5..3256260dd1 100644 --- a/modules/@angular/core/test/directive_lifecycle_integration_spec.ts +++ b/modules/@angular/core/test/directive_lifecycle_integration_spec.ts @@ -1,5 +1,4 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, @@ -9,9 +8,10 @@ import { it, xdescribe, xit, - Log, - TestComponentBuilder -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import { Log } from '@angular/core/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder} from '@angular/compiler/testing'; import { OnChanges, @@ -21,8 +21,8 @@ import { AfterContentChecked, AfterViewInit, AfterViewChecked -} from 'angular2/core'; -import {Directive, Component, ViewMetadata} from 'angular2/src/core/metadata'; +} from '@angular/core'; +import {Directive, Component, ViewMetadata} from '@angular/core/src/metadata'; export function main() { describe('directive lifecycle integration spec', () => { @@ -31,10 +31,10 @@ export function main() { inject([TestComponentBuilder, Log, AsyncTestCompleter], (tcb: TestComponentBuilder, log: Log, async) => { tcb.overrideView( - MyComp, + MyComp5, new ViewMetadata( {template: '
', directives: [LifecycleCmp]})) - .createAsync(MyComp) + .createAsync(MyComp5) .then((tc) => { tc.detectChanges(); @@ -90,5 +90,5 @@ class LifecycleCmp implements OnChanges, } @Component({selector: 'my-comp', directives: []}) -class MyComp { +class MyComp5 { } diff --git a/modules/@angular/core/test/dom/dom_adapter_spec.ts b/modules/@angular/core/test/dom/dom_adapter_spec.ts index 11bf4cf7ad..6123871447 100644 --- a/modules/@angular/core/test/dom/dom_adapter_spec.ts +++ b/modules/@angular/core/test/dom/dom_adapter_spec.ts @@ -1,103 +1,100 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit, beforeEachProviders, - SpyObject, - stringifyElement -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {el, stringifyElement} from '@angular/platform-browser/testing'; export function main() { describe('dom adapter', () => { it('should not coalesque text nodes', () => { var el1 = el('
a
'); var el2 = el('
b
'); - DOM.appendChild(el2, DOM.firstChild(el1)); - expect(DOM.childNodes(el2).length).toBe(2); + getDOM().appendChild(el2, getDOM().firstChild(el1)); + expect(getDOM().childNodes(el2).length).toBe(2); - var el2Clone = DOM.clone(el2); - expect(DOM.childNodes(el2Clone).length).toBe(2); + var el2Clone = getDOM().clone(el2); + expect(getDOM().childNodes(el2Clone).length).toBe(2); }); it('should clone correctly', () => { var el1 = el('
ab
'); - var clone = DOM.clone(el1); + var clone = getDOM().clone(el1); expect(clone).not.toBe(el1); - DOM.setAttribute(clone, 'test', '1'); + getDOM().setAttribute(clone, 'test', '1'); expect(stringifyElement(clone)).toEqual('
ab
'); - expect(DOM.getAttribute(el1, 'test')).toBeFalsy(); + expect(getDOM().getAttribute(el1, 'test')).toBeFalsy(); - var cNodes = DOM.childNodes(clone); + var cNodes = getDOM().childNodes(clone); var firstChild = cNodes[0]; var secondChild = cNodes[1]; - expect(DOM.parentElement(firstChild)).toBe(clone); - expect(DOM.nextSibling(firstChild)).toBe(secondChild); - expect(DOM.isTextNode(firstChild)).toBe(true); + expect(getDOM().parentElement(firstChild)).toBe(clone); + expect(getDOM().nextSibling(firstChild)).toBe(secondChild); + expect(getDOM().isTextNode(firstChild)).toBe(true); - expect(DOM.parentElement(secondChild)).toBe(clone); - expect(DOM.nextSibling(secondChild)).toBeFalsy(); - expect(DOM.isElementNode(secondChild)).toBe(true); + expect(getDOM().parentElement(secondChild)).toBe(clone); + expect(getDOM().nextSibling(secondChild)).toBeFalsy(); + expect(getDOM().isElementNode(secondChild)).toBe(true); }); it('should be able to create text nodes and use them with the other APIs', () => { - var t = DOM.createTextNode('hello'); - expect(DOM.isTextNode(t)).toBe(true); - var d = DOM.createElement('div'); - DOM.appendChild(d, t); - expect(DOM.getInnerHTML(d)).toEqual('hello'); + var t = getDOM().createTextNode('hello'); + expect(getDOM().isTextNode(t)).toBe(true); + var d = getDOM().createElement('div'); + getDOM().appendChild(d, t); + expect(getDOM().getInnerHTML(d)).toEqual('hello'); }); it('should set className via the class attribute', () => { - var d = DOM.createElement('div'); - DOM.setAttribute(d, 'class', 'class1'); + var d = getDOM().createElement('div'); + getDOM().setAttribute(d, 'class', 'class1'); expect(d.className).toEqual('class1'); }); it('should allow to remove nodes without parents', () => { - var d = DOM.createElement('div'); - expect(() => DOM.remove(d)).not.toThrow(); + var d = getDOM().createElement('div'); + expect(() => getDOM().remove(d)).not.toThrow(); }); - if (DOM.supportsDOMEvents()) { + if (getDOM().supportsDOMEvents()) { describe('getBaseHref', () => { - beforeEach(() => DOM.resetBaseElement()); + beforeEach(() => getDOM().resetBaseElement()); it('should return null if base element is absent', - () => { expect(DOM.getBaseHref()).toBeNull(); }); + () => { expect(getDOM().getBaseHref()).toBeNull(); }); it('should return the value of the base element', () => { - var baseEl = DOM.createElement('base'); - DOM.setAttribute(baseEl, 'href', '/drop/bass/connon/'); - var headEl = DOM.defaultDoc().head; - DOM.appendChild(headEl, baseEl); + var baseEl = getDOM().createElement('base'); + getDOM().setAttribute(baseEl, 'href', '/drop/bass/connon/'); + var headEl = getDOM().defaultDoc().head; + getDOM().appendChild(headEl, baseEl); - var baseHref = DOM.getBaseHref(); - DOM.removeChild(headEl, baseEl); - DOM.resetBaseElement(); + var baseHref = getDOM().getBaseHref(); + getDOM().removeChild(headEl, baseEl); + getDOM().resetBaseElement(); expect(baseHref).toEqual('/drop/bass/connon/'); }); it('should return a relative url', () => { - var baseEl = DOM.createElement('base'); - DOM.setAttribute(baseEl, 'href', 'base'); - var headEl = DOM.defaultDoc().head; - DOM.appendChild(headEl, baseEl); + var baseEl = getDOM().createElement('base'); + getDOM().setAttribute(baseEl, 'href', 'base'); + var headEl = getDOM().defaultDoc().head; + getDOM().appendChild(headEl, baseEl); - var baseHref = DOM.getBaseHref(); - DOM.removeChild(headEl, baseEl); - DOM.resetBaseElement(); + var baseHref = getDOM().getBaseHref(); + getDOM().removeChild(headEl, baseEl); + getDOM().resetBaseElement(); expect(baseHref.endsWith('/base')).toBe(true); }); diff --git a/modules/@angular/core/test/dom/shim_spec.ts b/modules/@angular/core/test/dom/shim_spec.ts index bd2b5c3103..735bf55993 100644 --- a/modules/@angular/core/test/dom/shim_spec.ts +++ b/modules/@angular/core/test/dom/shim_spec.ts @@ -1,15 +1,13 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, - el, expect, iit, inject, it, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; export function main() { describe('Shim', () => { diff --git a/modules/@angular/core/test/facade/observable_spec.ts b/modules/@angular/core/test/facade/observable_spec.ts index ae51a1b204..c0d6785da2 100644 --- a/modules/@angular/core/test/facade/observable_spec.ts +++ b/modules/@angular/core/test/facade/observable_spec.ts @@ -6,13 +6,11 @@ import { ddescribe, iit, xit, - el, - SpyObject, - AsyncTestCompleter, inject -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; -import {Observable, Subject, EventEmitter, PromiseWrapper} from 'angular2/src/facade/async'; +import {Observable, Subject, EventEmitter, PromiseWrapper} from '../../src/facade/async'; export function main() { describe("Observable", () => { diff --git a/modules/@angular/core/test/fake_async_spec.ts b/modules/@angular/core/test/fake_async_spec.ts index 69976190d1..6d468e3ea6 100644 --- a/modules/@angular/core/test/fake_async_spec.ts +++ b/modules/@angular/core/test/fake_async_spec.ts @@ -1,21 +1,22 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, describe, expect, - fakeAsync, - flushMicrotasks, iit, inject, it, + xit +} from '@angular/core/testing/testing_internal'; +import { + fakeAsync, + flushMicrotasks, Log, tick, - xit -} from 'angular2/testing_internal'; -import {TimerWrapper, PromiseWrapper} from 'angular2/src/facade/async'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {Parser} from 'angular2/src/compiler/expression_parser/parser'; +} from '@angular/core/testing'; +import {TimerWrapper, PromiseWrapper} from '../../router/src/facade/async'; +import {BaseException} from '../../router/src/facade/exceptions'; +import {Parser} from '../../compiler/src/expression_parser/parser'; export function main() { describe('fake async', () => { diff --git a/modules/@angular/core/test/forward_ref_integration_spec.ts b/modules/@angular/core/test/forward_ref_integration_spec.ts index 79e990c03c..14059bc439 100644 --- a/modules/@angular/core/test/forward_ref_integration_spec.ts +++ b/modules/@angular/core/test/forward_ref_integration_spec.ts @@ -1,6 +1,4 @@ import { - AsyncTestCompleter, - TestComponentBuilder, beforeEach, ddescribe, describe, @@ -9,7 +7,7 @@ import { inject, it, xit -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; import { bind, provide, @@ -20,10 +18,12 @@ import { Inject, Query, QueryList -} from 'angular2/core'; -import {NgFor} from 'angular2/common'; -import {Type} from 'angular2/src/facade/lang'; -import {asNativeElements} from 'angular2/core'; +} from '@angular/core'; +import {TestComponentBuilder} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {NgFor} from '@angular/common'; +import {Type} from '../src/facade/lang'; +import {asNativeElements} from '@angular/core'; export function main() { describe("forwardRef integration", function() { diff --git a/modules/@angular/core/test/linker/change_detection_integration_spec.ts b/modules/@angular/core/test/linker/change_detection_integration_spec.ts index 5fc9e0ba0e..2bf2aac892 100644 --- a/modules/@angular/core/test/linker/change_detection_integration_spec.ts +++ b/modules/@angular/core/test/linker/change_detection_integration_spec.ts @@ -7,17 +7,18 @@ import { expect, beforeEach, afterEach, - tick, - fakeAsync, - TestComponentBuilder, - ComponentFixture, inject, beforeEachProviders -} from 'angular2/testing_internal'; +} from '@angular/core/testing/testing_internal'; +import { + fakeAsync, + flushMicrotasks, + Log, + tick, +} from '@angular/core/testing'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; import { - IS_DART, - Type, isPresent, isBlank, isNumber, @@ -25,20 +26,21 @@ import { FunctionWrapper, NumberWrapper, normalizeBool -} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; -import {MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; +} from '../../src/facade/lang'; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; +import {MapWrapper, StringMapWrapper} from '../../src/facade/collection'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import { PipeTransform, ChangeDetectionStrategy, WrappedValue, -} from 'angular2/src/core/change_detection/change_detection'; +} from '@angular/core/src/change_detection/change_detection'; -import {OnDestroy} from 'angular2/src/core/metadata/lifecycle_hooks'; +import {OnDestroy} from '@angular/core/src/metadata/lifecycle_hooks'; -import {EventEmitter, ObservableWrapper} from 'angular2/src/facade/async'; +import {IS_DART, Type} from '../../src/facade/lang'; +import {EventEmitter, ObservableWrapper} from '../../src/facade/async'; import { @@ -65,15 +67,15 @@ import { AfterContentChecked, AfterViewInit, AfterViewChecked -} from 'angular2/core'; -import {By} from 'angular2/platform/common_dom'; -import {AsyncPipe} from 'angular2/common'; +} from '@angular/core'; +import {By} from '@angular/platform-browser/src/dom/debug/by'; +import {AsyncPipe} from '@angular/common'; -import {ElementSchemaRegistry} from 'angular2/src/compiler/schema/element_schema_registry'; -import {MockSchemaRegistry} from '../../compiler/schema_registry_mock'; -import {TEST_PROVIDERS} from '../../compiler/test_bindings'; -import {DebugDomRootRenderer, DebugDomRenderer} from 'angular2/src/core/debug/debug_renderer'; -import {DomRootRenderer} from 'angular2/src/platform/dom/dom_renderer'; +import {ElementSchemaRegistry} from '@angular/compiler/src/schema/element_schema_registry'; +import {MockSchemaRegistry} from '@angular/compiler/testing'; +import {TEST_PROVIDERS} from '@angular/compiler/test/test_bindings'; +import {DebugDomRenderer} from '@angular/core/src/debug/debug_renderer'; +import {DomRootRenderer} from '@angular/platform-browser/src/dom/dom_renderer'; export function main() { var tcb: TestComponentBuilder; @@ -117,7 +119,7 @@ export function main() { describe(`ChangeDetection`, () => { // On CJS fakeAsync is not supported... - if (!DOM.supportsDOMEvents()) return; + if (!getDOM().supportsDOMEvents()) return; beforeEachProviders(() => [ RenderLog, diff --git a/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts b/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts index 6a5567e474..de972d7584 100644 --- a/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts +++ b/modules/@angular/core/test/linker/dynamic_component_loader_spec.ts @@ -1,30 +1,27 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, xdescribe, describe, - el, - dispatchEvent, expect, iit, inject, beforeEachProviders, it, xit, - TestComponentBuilder, - ComponentFixture -} from 'angular2/testing_internal'; - -import {Predicate} from 'angular2/src/facade/collection'; -import {Injector, OnDestroy, DebugElement, Type, ViewContainerRef, ViewChild} from 'angular2/core'; -import {Component, ViewMetadata} from 'angular2/src/core/metadata'; -import {DynamicComponentLoader} from 'angular2/src/core/linker/dynamic_component_loader'; -import {ElementRef} from 'angular2/src/core/linker/element_ref'; -import {DOCUMENT} from 'angular2/src/platform/dom/dom_tokens'; -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; -import {BaseException} from 'angular2/src/facade/exceptions'; -import {PromiseWrapper} from 'angular2/src/facade/promise'; +} from '@angular/core/testing/testing_internal'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {Predicate} from '../../src/facade/collection'; +import {Injector, OnDestroy, DebugElement, Type, ViewContainerRef, ViewChild} from '@angular/core'; +import {Component, ViewMetadata} from '@angular/core/src/metadata'; +import {DynamicComponentLoader} from '@angular/core/src/linker/dynamic_component_loader'; +import {ElementRef} from '@angular/core/src/linker/element_ref'; +import {DOCUMENT} from '@angular/platform-browser/src/dom/dom_tokens'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; +import {BaseException} from '../../src/facade/exceptions'; +import {PromiseWrapper} from '../../src/facade/promise'; +import {el} from '@angular/platform-browser/testing'; export function main() { describe('DynamicComponentLoader', function() { @@ -32,7 +29,7 @@ export function main() { it('should work', inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc) => { + tcb.createAsync(MyComp3).then((tc) => { tc.detectChanges(); loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef) @@ -48,7 +45,7 @@ export function main() { inject( [DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc) => { + tcb.createAsync(MyComp3).then((tc) => { tc.detectChanges(); loader.loadNextToLocation(DynamicallyLoaded, tc.componentInstance.viewContainerRef) .then(ref => { @@ -71,7 +68,7 @@ export function main() { it('should update host properties', inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc) => { + tcb.createAsync(MyComp3).then((tc) => { tc.detectChanges(); loader.loadNextToLocation(DynamicallyLoadedWithHostProps, @@ -94,7 +91,7 @@ export function main() { it('should leave the view tree in a consistent state if hydration fails', inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc: ComponentFixture) => { + tcb.createAsync(MyComp3).then((tc: ComponentFixture) => { tc.detectChanges(); PromiseWrapper.catchError( loader.loadNextToLocation(DynamicallyLoadedThrows, @@ -111,11 +108,11 @@ export function main() { it('should allow to pass projectable nodes', inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc) => { + tcb.createAsync(MyComp3).then((tc) => { tc.detectChanges(); loader.loadNextToLocation(DynamicallyLoadedWithNgContent, tc.componentInstance.viewContainerRef, null, - [[DOM.createTextNode('hello')]]) + [[getDOM().createTextNode('hello')]]) .then(ref => { tc.detectChanges(); var newlyInsertedElement = tc.debugElement.childNodes[1].nativeNode; @@ -128,7 +125,7 @@ export function main() { it('should not throw if not enough projectable nodes are passed in', inject([DynamicComponentLoader, TestComponentBuilder, AsyncTestCompleter], (loader: DynamicComponentLoader, tcb: TestComponentBuilder, async) => { - tcb.createAsync(MyComp).then((tc) => { + tcb.createAsync(MyComp3).then((tc) => { tc.detectChanges(); loader.loadNextToLocation(DynamicallyLoadedWithNgContent, tc.componentInstance.viewContainerRef, null, []) @@ -143,7 +140,7 @@ export function main() { inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector], (async, loader: DynamicComponentLoader, doc, injector: Injector) => { var rootEl = createRootElement(doc, 'child-cmp'); - DOM.appendChild(doc.body, rootEl); + getDOM().appendChild(doc.body, rootEl); loader.loadAsRoot(ChildComp, null, injector) .then((componentRef) => { var el = new ComponentFixture(componentRef, null, false); @@ -172,9 +169,9 @@ export function main() { inject([AsyncTestCompleter, DynamicComponentLoader, DOCUMENT, Injector], (async, loader: DynamicComponentLoader, doc, injector: Injector) => { var rootEl = createRootElement(doc, 'dummy'); - DOM.appendChild(doc.body, rootEl); + getDOM().appendChild(doc.body, rootEl); loader.loadAsRoot(DynamicallyLoadedWithNgContent, null, injector, null, - [[DOM.createTextNode('hello')]]) + [[getDOM().createTextNode('hello')]]) .then((_) => { expect(rootEl).toHaveText('dynamic(hello)'); @@ -188,12 +185,12 @@ export function main() { } function createRootElement(doc: any, name: string): any { - var nodes = DOM.querySelectorAll(doc, name); + var nodes = getDOM().querySelectorAll(doc, name); for (var i = 0; i < nodes.length; i++) { - DOM.remove(nodes[i]); + getDOM().remove(nodes[i]); } var rootEl = el(`<${name}>`); - DOM.appendChild(doc.body, rootEl); + getDOM().appendChild(doc.body, rootEl); return rootEl; } @@ -235,7 +232,7 @@ class DynamicallyLoadedWithNgContent { } @Component({selector: 'my-comp', directives: [], template: '
'}) -class MyComp { +class MyComp3 { ctxBoolProp: boolean; @ViewChild('loc', {read: ViewContainerRef}) viewContainerRef: ViewContainerRef; diff --git a/modules/@angular/core/test/linker/integration_dart_spec.dart b/modules/@angular/core/test/linker/integration_dart_spec.dart index b5f778c349..1b7b376883 100644 --- a/modules/@angular/core/test/linker/integration_dart_spec.dart +++ b/modules/@angular/core/test/linker/integration_dart_spec.dart @@ -4,7 +4,7 @@ library angular2.test.di.integration_dart_spec; import 'package:angular2/angular2.dart'; import 'package:angular2/core.dart'; import 'package:angular2/src/core/debug/debug_node.dart'; -import 'package:angular2/testing_internal.dart'; +import 'package:@angular/core/testing/testing_internal.dart'; import 'package:observe/observe.dart'; import 'package:angular2/src/core/change_detection/differs/default_iterable_differ.dart'; import 'package:angular2/src/core/change_detection/change_detection.dart'; diff --git a/modules/@angular/core/test/linker/integration_spec.ts b/modules/@angular/core/test/linker/integration_spec.ts index 010946a20f..9b82e96779 100644 --- a/modules/@angular/core/test/linker/integration_spec.ts +++ b/modules/@angular/core/test/linker/integration_spec.ts @@ -1,28 +1,24 @@ import { - AsyncTestCompleter, beforeEach, ddescribe, xdescribe, describe, - el, - dispatchEvent, expect, iit, inject, beforeEachProviders, it, xit, +} from '@angular/core/testing/testing_internal'; +import { containsRegexp, - stringifyElement, - TestComponentBuilder, fakeAsync, tick, - clearPendingTimers, - ComponentFixture -} from 'angular2/testing_internal'; - - -import {DOM} from 'angular2/src/platform/dom/dom_adapter'; + clearPendingTimers +} from '@angular/core/testing'; +import {TestComponentBuilder, ComponentFixture} from '@angular/compiler/testing'; +import {AsyncTestCompleter} from '@angular/core/testing/testing_internal'; +import {getDOM} from '@angular/platform-browser/src/dom/dom_adapter'; import { Type, isPresent, @@ -31,15 +27,14 @@ import { global, stringify, isBlank, - IS_DART -} from 'angular2/src/facade/lang'; -import {BaseException, WrappedException} from 'angular2/src/facade/exceptions'; +} from '../../src/facade/lang'; +import {BaseException, WrappedException} from '../../src/facade/exceptions'; import { PromiseWrapper, EventEmitter, ObservableWrapper, PromiseCompleter, -} from 'angular2/src/facade/async'; +} from '../../src/facade/async'; import { Injector, @@ -55,17 +50,17 @@ import { SkipSelfMetadata, OnDestroy, ReflectiveInjector -} from 'angular2/core'; +} from '@angular/core'; -import {NgIf, NgFor, AsyncPipe} from 'angular2/common'; +import {NgIf, NgFor, AsyncPipe} from '@angular/common'; import { PipeTransform, ChangeDetectorRef, ChangeDetectionStrategy -} from 'angular2/src/core/change_detection/change_detection'; +} from '@angular/core/src/change_detection/change_detection'; -import {CompilerConfig} from 'angular2/compiler'; +import {CompilerConfig} from '@angular/compiler'; import { Directive, @@ -78,18 +73,20 @@ import { Output, HostBinding, HostListener -} from 'angular2/src/core/metadata'; +} from '@angular/core/src/metadata'; -import {QueryList} from 'angular2/src/core/linker/query_list'; +import {QueryList} from '@angular/core/src/linker/query_list'; -import {ViewContainerRef} from 'angular2/src/core/linker/view_container_ref'; -import {EmbeddedViewRef} from 'angular2/src/core/linker/view_ref'; +import {ViewContainerRef} from '@angular/core/src/linker/view_container_ref'; +import {EmbeddedViewRef} from '@angular/core/src/linker/view_ref'; -import {ComponentResolver} from 'angular2/src/core/linker/component_resolver'; -import {ElementRef} from 'angular2/src/core/linker/element_ref'; -import {TemplateRef_, TemplateRef} from 'angular2/src/core/linker/template_ref'; +import {ComponentResolver} from '@angular/core/src/linker/component_resolver'; +import {ElementRef} from '@angular/core/src/linker/element_ref'; +import {TemplateRef, TemplateRef_} from '@angular/core/src/linker/template_ref'; -import {Renderer} from 'angular2/src/core/render'; +import {Renderer} from '@angular/core/src/render'; +import {IS_DART} from '../../src/facade/lang'; +import {el, dispatchEvent} from '@angular/platform-browser/testing'; const ANCHOR_ELEMENT = /*@ts2dart_const*/ new OpaqueToken('AnchorElement'); @@ -167,13 +164,13 @@ function declareTests(isJit: boolean) { fixture.debugElement.componentInstance.ctxProp = 'Initial aria label'; fixture.detectChanges(); expect( - DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label')) + getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label')) .toEqual('Initial aria label'); fixture.debugElement.componentInstance.ctxProp = 'Changed aria label'; fixture.detectChanges(); expect( - DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label')) + getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'aria-label')) .toEqual('Changed aria label'); async.done(); @@ -190,12 +187,12 @@ function declareTests(isJit: boolean) { fixture.debugElement.componentInstance.ctxProp = 'bar'; fixture.detectChanges(); - expect(DOM.getAttribute(fixture.debugElement.children[0].nativeElement, 'foo')) + expect(getDOM().getAttribute(fixture.debugElement.children[0].nativeElement, 'foo')) .toEqual('bar'); fixture.debugElement.componentInstance.ctxProp = null; fixture.detectChanges(); - expect(DOM.hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo')) + expect(getDOM().hasAttribute(fixture.debugElement.children[0].nativeElement, 'foo')) .toBeFalsy(); async.done(); @@ -212,12 +209,12 @@ function declareTests(isJit: boolean) { fixture.debugElement.componentInstance.ctxProp = '10'; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'height')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'height')) .toEqual('10px'); fixture.debugElement.componentInstance.ctxProp = null; fixture.detectChanges(); - expect(DOM.getStyle(fixture.debugElement.children[0].nativeElement, 'height')) + expect(getDOM().getStyle(fixture.debugElement.children[0].nativeElement, 'height')) .toEqual(''); async.done(); @@ -272,12 +269,12 @@ function declareTests(isJit: boolean) { fixture.debugElement.componentInstance.ctxProp = 'Some HTML'; fixture.detectChanges(); - expect(DOM.getInnerHTML(fixture.debugElement.children[0].nativeElement)) + expect(getDOM().getInnerHTML(fixture.debugElement.children[0].nativeElement)) .toEqual('Some HTML'); fixture.debugElement.componentInstance.ctxProp = 'Some other
HTML
'; fixture.detectChanges(); - expect(DOM.getInnerHTML(fixture.debugElement.children[0].nativeElement)) + expect(getDOM().getInnerHTML(fixture.debugElement.children[0].nativeElement)) .toEqual('Some other
HTML
'); async.done(); @@ -480,7 +477,7 @@ function declareTests(isJit: boolean) { fixture.detectChanges(); - var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement); + var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement); // 1 template + 2 copies. expect(childNodesOfWrapper.length).toBe(3); expect(childNodesOfWrapper[1]).toHaveText('hello'); @@ -495,9 +492,9 @@ function declareTests(isJit: boolean) { .createAsync(MyComp) .then((fixture) => { - var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement); + var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement); expect(childNodesOfWrapper.length).toBe(1); - expect(DOM.isCommentNode(childNodesOfWrapper[0])).toBe(true); + expect(getDOM().isCommentNode(childNodesOfWrapper[0])).toBe(true); async.done(); }); })); @@ -515,7 +512,7 @@ function declareTests(isJit: boolean) { .then((fixture) => { fixture.detectChanges(); - var childNodesOfWrapper = DOM.childNodes(fixture.debugElement.nativeElement); + var childNodesOfWrapper = getDOM().childNodes(fixture.debugElement.nativeElement); // 1 template + 2 copies. expect(childNodesOfWrapper.length).toBe(3); expect(childNodesOfWrapper[1]).toHaveText('hello'); @@ -705,7 +702,7 @@ function declareTests(isJit: boolean) { .then((fixture) => { fixture.detectChanges(); // Get the element at index 2, since index 0 is the