From 21ba4650a7338f26e9bf293368da17fb14c4dcc6 Mon Sep 17 00:00:00 2001 From: Stephen Hazleton Date: Thu, 3 Mar 2016 21:44:05 +1300 Subject: [PATCH] workaround for ionic-angular/index, closes #27 --- app/app.spec.ts | 2 +- app/app.ts | 2 +- .../clickerButton/clickerButton.spec.ts | 2 +- app/components/clickerButton/clickerButton.ts | 2 +- .../clickerForm/clickerForm.spec.ts | 2 +- app/components/clickerForm/clickerForm.ts | 2 +- app/pages/clickerList/clickerList.ts | 2 +- app/pages/page2/page2.ts | 2 +- app/services/clickers.ts | 2 +- test/ionic-angular.js | 25 +++++++++++++++++++ test/karma.config.js | 2 ++ test/test-main.js | 1 - 12 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 test/ionic-angular.js diff --git a/app/app.spec.ts b/app/app.spec.ts index 11682dd..683d25e 100644 --- a/app/app.spec.ts +++ b/app/app.spec.ts @@ -1,6 +1,6 @@ import { TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS} from 'angular2/platform/testing/browser'; import { setBaseTestProviders } from 'angular2/testing'; -import { IonicApp, Platform } from 'ionic-angular/index'; +import { IonicApp, Platform } from 'ionic-angular'; import { ClickerApp } from './app'; // this needs doing _once_ for the entire test suite, hence it's here diff --git a/app/app.ts b/app/app.ts index 3538ae2..e970915 100644 --- a/app/app.ts +++ b/app/app.ts @@ -1,7 +1,7 @@ 'use strict'; import { Type } from 'angular2/core'; -import { App, IonicApp, Platform } from 'ionic-angular/index'; +import { App, IonicApp, Platform } from 'ionic-angular'; import { ClickerList } from './pages/clickerList/clickerList'; import { Page2 } from './pages/page2/page2'; diff --git a/app/components/clickerButton/clickerButton.spec.ts b/app/components/clickerButton/clickerButton.spec.ts index 8faa4ea..a17bc2f 100644 --- a/app/components/clickerButton/clickerButton.spec.ts +++ b/app/components/clickerButton/clickerButton.spec.ts @@ -9,7 +9,7 @@ import { TestComponentBuilder, } from 'angular2/testing'; import { provide } from 'angular2/core'; -import { Config } from 'ionic-angular/index'; +import { Config } from 'ionic-angular'; import { ClickerButton } from './clickerButton'; import { Clickers } from '../../services/clickers'; import { TestUtils } from '../../../test/testUtils'; diff --git a/app/components/clickerButton/clickerButton.ts b/app/components/clickerButton/clickerButton.ts index bd8e5d2..320ac0f 100644 --- a/app/components/clickerButton/clickerButton.ts +++ b/app/components/clickerButton/clickerButton.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, View } from 'angular2/core'; -import { Button } from 'ionic-angular/index'; +import { Button } from 'ionic-angular'; import { Clickers } from '../../services/clickers'; @Component({ diff --git a/app/components/clickerForm/clickerForm.spec.ts b/app/components/clickerForm/clickerForm.spec.ts index bd77bdb..25db84c 100644 --- a/app/components/clickerForm/clickerForm.spec.ts +++ b/app/components/clickerForm/clickerForm.spec.ts @@ -64,7 +64,7 @@ export function main(): void { // Form, // IonicApp, // Platform, -// } from 'ionic-angular/index'; +// } from 'ionic-angular'; // import { ClickerForm } from '../../../app/components/clickerForm/clickerForm'; // import { Clickers } from '../../../app/services/clickers'; // import { TestUtils } from '../../testUtils'; diff --git a/app/components/clickerForm/clickerForm.ts b/app/components/clickerForm/clickerForm.ts index 17220a5..f4d52f4 100644 --- a/app/components/clickerForm/clickerForm.ts +++ b/app/components/clickerForm/clickerForm.ts @@ -2,7 +2,7 @@ import { AbstractControl, ControlGroup, FormBuilder, Validators } from 'angular2/common'; import { Component, View } from 'angular2/core'; -import { Button, Icon, Item, Label, TextInput } from 'ionic-angular/index'; +import { Button, Icon, Item, Label, TextInput } from 'ionic-angular'; import { Clickers } from '../../services/clickers'; import { Utils } from '../../services/utils'; diff --git a/app/pages/clickerList/clickerList.ts b/app/pages/clickerList/clickerList.ts index 3920ef1..ec9b218 100644 --- a/app/pages/clickerList/clickerList.ts +++ b/app/pages/clickerList/clickerList.ts @@ -1,6 +1,6 @@ 'use strict'; -import { Page, NavController } from 'ionic-angular/index'; +import { Page, NavController } from 'ionic-angular'; import { Clickers } from '../../services/clickers'; import { ClickerButton } from '../../components/clickerButton/clickerButton'; import { ClickerForm } from '../../components/clickerForm/clickerForm'; diff --git a/app/pages/page2/page2.ts b/app/pages/page2/page2.ts index 6d95ac6..2af5eb5 100644 --- a/app/pages/page2/page2.ts +++ b/app/pages/page2/page2.ts @@ -1,6 +1,6 @@ 'use strict'; -import { Page } from 'ionic-angular/index'; +import { Page } from 'ionic-angular'; @Page({ templateUrl: 'build/pages/page2/page2.html', diff --git a/app/services/clickers.ts b/app/services/clickers.ts index 6c80841..31a048c 100644 --- a/app/services/clickers.ts +++ b/app/services/clickers.ts @@ -1,7 +1,7 @@ 'use strict'; import { Injectable } from 'angular2/core'; -import { SqlStorage } from 'ionic-angular/index'; +import { SqlStorage } from 'ionic-angular'; import { Clicker } from '../models/clicker'; import { Click } from '../models/click'; diff --git a/test/ionic-angular.js b/test/ionic-angular.js new file mode 100644 index 0000000..63a82cb --- /dev/null +++ b/test/ionic-angular.js @@ -0,0 +1,25 @@ +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +__export(require('./node_modules/ionic-angular/config/bootstrap')); +__export(require('./node_modules/ionic-angular/config/config')); +__export(require('./node_modules/ionic-angular/config/directives')); +__export(require('./node_modules/ionic-angular/decorators/app')); +__export(require('./node_modules/ionic-angular/decorators/page')); +__export(require('./node_modules/ionic-angular/components')); +__export(require('./node_modules/ionic-angular/platform/platform')); +__export(require('./node_modules/ionic-angular/platform/storage')); +__export(require('./node_modules/ionic-angular/util/click-block')); +__export(require('./node_modules/ionic-angular/util/events')); +__export(require('./node_modules/ionic-angular/util/keyboard')); +__export(require('./node_modules/ionic-angular/util/form')); +__export(require('./node_modules/ionic-angular/animations/animation')); +__export(require('./node_modules/ionic-angular/transitions/transition')); +__export(require('./node_modules/ionic-angular/translation/translate')); +__export(require('./node_modules/ionic-angular/translation/translate_pipe')); +// these modules don't export anything +require('./node_modules/ionic-angular/config/modes'); +require('./node_modules/ionic-angular/platform/registry'); +require('./node_modules/ionic-angular/animations/builtins'); +require('./node_modules/ionic-angular/transitions/transition-ios'); +require('./node_modules/ionic-angular/transitions/transition-md'); diff --git a/test/karma.config.js b/test/karma.config.js index f35c222..42eecc9 100644 --- a/test/karma.config.js +++ b/test/karma.config.js @@ -22,6 +22,7 @@ module.exports = function(config) { 'node_modules/systemjs/dist/system.src.js', 'node_modules/reflect-metadata/Reflect.js', + { pattern: 'test/ionic-angular.js', included: false, watched: false }, { pattern: 'node_modules/angular2/**/*.js', included: false, watched: false }, { pattern: 'node_modules/ionic-angular/**/*.js', included: false, watched: false }, { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false }, @@ -67,6 +68,7 @@ module.exports = function(config) { proxies: { // allows us to keep test code separate from app code and still have the references work '/base/node_modules/ionic-angular/decorators/app.js': '/base/www/build/test/app.stub.js', // stub out Ionic's @App decorator + '/base/ionic-angular.js': '/base/test/ionic-angular.js' }, // level of logging diff --git a/test/test-main.js b/test/test-main.js index c264ca5..2dd8f77 100644 --- a/test/test-main.js +++ b/test/test-main.js @@ -11,7 +11,6 @@ System.config({ baseURL: '/base/', defaultJSExtensions: true, paths: { - 'ionic/*': 'node_modules/ionic-angular/*.js', 'ionic-angular/*': 'node_modules/ionic-angular/*.js', 'angular2/*': 'node_modules/angular2/*.js', 'rxjs/*': 'node_modules/rxjs/*.js'