Upgrade angular #31

Merged
merged 3 commits into from Mar 4, 2017
Jump to file or symbol
Failed to load files and symbols.
+586 −265
Diff settings

Always

Just for now

View
@@ -1,6 +1,6 @@
declare namespace Spectron {
export interface ApplicationOptions {
- path: string;
+ path: any;
args?: string[];
cwd?: string;
env?: Object;
View
@@ -18,25 +18,24 @@
"watch": "npm run prebuild && concurrently --kill-others \"webpack -w\" \"gulp watch\"",
"start": "electron .",
"package": "npm run build && gulp package",
- "test": "concurrently \"npm run test:unit\" \"npm run test:e2e\"",
+ "test": "concurrently \"npm run test:e2e\"",
"test:unit:watch": "concurrently --kill-others \"webpack --config ./webpack_for_spec.config.coffee -w\" \"karma start spec/karma.conf.coffee\"",
- "test:unit": "webpack --config ./webpack_for_spec.config.coffee && karma start spec/karma.conf.coffee --single-run",
"test:e2e": "mocha --compilers ts:espower-typescript/guess spec/e2e/**/*.story.ts"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
- "@angular/common": "2.0.0-rc.4",
- "@angular/compiler": "2.0.0-rc.4",
- "@angular/core": "2.0.0-rc.4",
- "@angular/http": "2.0.0-rc.4",
- "@angular/platform-browser": "2.0.0-rc.4",
- "@angular/platform-browser-dynamic": "2.0.0-rc.4",
- "@angular/router": "3.0.0-beta.1",
+ "@angular/common": "^2.4.0",
+ "@angular/compiler": "^2.4.0",
+ "@angular/core": "^2.4.0",
+ "@angular/forms": "^2.4.0",
+ "@angular/http": "^2.4.0",
+ "@angular/platform-browser": "^2.4.0",
+ "@angular/platform-browser-dynamic": "^2.4.0",
+ "@angular/router": "^3.4.0",
"ace-min-noconflict": "^1.1.9",
"electron": "^1.6.1",
- "electron-prebuilt": "^1.2.0",
"emoji-images": "^0.1.1",
"es6-shim": "^0.35.0",
"font-awesome": "^4.5.0",
@@ -45,8 +44,8 @@
"lodash": "^4.3.0",
"marked": "^0.3.5",
"reflect-metadata": "0.1.2",
- "rxjs": "5.0.0-beta.6",
- "zone.js": "^0.6.12"
+ "rxjs": "^5.1.0",
+ "zone.js": "^0.7.6"
},
"devDependencies": {
"coffee-script": "^1.10.0",
@@ -60,16 +59,17 @@
"jasmine-core": "^2.4.1",
"jquery": "^2.2.3",
"jsdom": "^9.4.0",
- "karma": "^0.13.22",
- "karma-chrome-launcher": "^0.2.3",
- "karma-commonjs": "0.0.13",
- "karma-firefox-launcher": "^0.1.7",
- "karma-jasmine": "^0.3.8",
- "karma-mocha-reporter": "^2.0.2",
+ "karma": "~1.4.1",
+ "karma-chrome-launcher": "~2.0.0",
+ "karma-cli": "~1.0.1",
+ "karma-coverage-istanbul-reporter": "^0.2.0",
+ "karma-jasmine": "~1.1.0",
+ "karma-jasmine-html-reporter": "^0.2.2",
"mocha": "^2.5.3",
"power-assert": "^1.4.1",
+ "protractor": "~5.1.0",
"run-sequence": "^1.1.5",
- "spectron": "^3.2.4",
+ "spectron": "^3.6.0",
"ts-loader": "^2.0.1",
"tsconfig-cli": "^1.0.2",
"typescript": "^2.2.1",
@@ -1,9 +1,9 @@
import {join} from 'path';
-import * as electron from 'electron-prebuilt';
+import * as electron from 'electron';
import * as spectron from 'spectron';
export class Application {
- private app: Spectron.Application;
+ private app: spectron.Application;
start() {
if (!this.app) {
@@ -1,5 +1,7 @@
+import spectron from 'spectron';
+
export default class SlideEditorPage {
- constructor(private client: Spectron.Client<void>) {}
+ constructor(private client: spectron.Client<void>) {}
inputText(text: string): Promise<void> {
return this.client.waitForExist('#editor').then(() => {
@@ -20,7 +22,7 @@ export default class SlideEditorPage {
return html.some((text) => loop(text));
}
}
- return this.client.waitForExist('.slide-inner')
+ return this.client.waitForExist('.slide-inner img')
.then(() => this.client.getHTML('.slide-inner img') )
.then((html) => loop(html));
}
@@ -1,3 +1,5 @@
+/// <reference path="../../../typings/globals/mocha/index.d.ts" />
+
import {Application} from '../e2e_test_helper';
import * as assert from 'power-assert';
import SlideEditorPage from '../page/slide_editor.page';
View
@@ -1,28 +0,0 @@
-module.exports = (config) ->
- configuration =
- basePath: ''
- frameworks: ['jasmine']
- files: [
- '../node_modules/es6-shim/es6-sham.js'
- '../node_modules/reflect-metadata/Reflect.js'
- '../node_modules/rxjs/Rx.js'
- '../node_modules/zone.js/dist/zone.js'
- '../spec_dist/**/*.js'
- ]
- exclude: [ ]
- preprocessors:
- '../node_modules/rxjs/Rx.js': ['commonjs']
- '../node_modules/angular2/testing.js': ['commonjs']
- reporters: ['mocha']
- port: 9876
- colors: true
- logLevel: config.LOG_INFO
- autoWatch: true
- browsers: ['Chrome']
- singleRun: false
- concurrency: Infinity
- if process.env.TRAVIS
- # Chrome has dropped support for Ubuntu Precise so it's no longer possible to install the latest version.
- # So use firefox only if run in travis. https://github.com/travis-ci/travis-ci/issues/5899
- configuration.browsers = ['Firefox']
- config.set(configuration)
@@ -1,77 +0,0 @@
-import { describe, it, inject, expect, beforeEachProviders, beforeEach } from '@angular/core/testing';
-import { SlideService } from '../../src/renderer/services/slide.service';
-
-describe('SlideService', () => {
-
- beforeEachProviders(() => [
- SlideService
- ]);
-
- it('Should service exist', inject([SlideService], (testee: SlideService) => {
- expect(testee).toBeDefined();
- }));
-
- describe('#getPageText', () => {
- let testee: SlideService;
- beforeEach(inject([SlideService], (s: SlideService) => testee = s));
-
- describe('text is nothing', () => {
- it('should be empty', () => {
- expect(testee.getPageText(1)).toEqual('');
- });
- });
-
- describe('text has been setted', () => {
- beforeEach(() => {
- testee.setText('# page1\n---\n# page2');
- });
- it('should get text by page', () => {
- expect(testee.getPageText(1)).toEqual('# page1\n');
- expect(testee.getPageText(2)).toEqual('\n# page2');
- expect(testee.getPageText(3)).toEqual('');
- });
- });
- });
-
- describe('#getMaxPage', () => {
- let testee: SlideService;
- beforeEach(inject([SlideService], (s: SlideService) => testee = s));
-
- describe('text is nothing', () => {
- it('should be 1', () => {
- expect(testee.getMaxPage()).toEqual(1);
- });
- });
-
- describe('text has been setted', () => {
- beforeEach(() => {
- testee.setText('# page1\n---\n# page2');
- });
- it('should get last page number', () => {
- expect(testee.getMaxPage()).toEqual(2);
- });
- });
- });
-
- describe('#getPageNo', () => {
- let testee: SlideService;
- beforeEach(inject([SlideService], (s: SlideService) => testee = s));
-
- describe('text is nothing', () => {
- it('should be 1', () => {
- expect(testee.getPageNo(1)).toEqual(1);
- });
- });
-
- describe('text has been setted', () => {
- beforeEach(() => {
- testee.setText('# page1\n---\n# page2');
- });
- it('should get page number', () => {
- expect(testee.getPageNo(1)).toEqual(1);
- expect(testee.getPageNo(2)).toEqual(2);
- expect(testee.getPageNo(3)).toEqual(2);
- });
- });
- });
-});
@@ -2,7 +2,7 @@ import * as electron from 'electron';
import FileManager from './file_manager';
export default class ExportWindow {
- private window: Electron.BrowserWindow;
+ private window: electron.BrowserWindow;
private static instance;
private text: string;
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
import MainWindow from './main_window';
import { dialog } from 'electron';
import {EVENTS} from './../constants/events';
+import * as electron from 'electron';
export default class FileManager extends EventEmitter {
private readingFilePath = '';
@@ -77,7 +78,7 @@ export default class FileManager extends EventEmitter {
});
}
- public exportToPdf(webContents: Electron.WebContents): Promise<{}> {
+ public exportToPdf(webContents: electron.WebContents): Promise<{}> {
return new Promise((resolve, reject) => {
dialog.showSaveDialog(
this.mainWinsow.getBrowserWindow(),
@@ -96,7 +97,7 @@ export default class FileManager extends EventEmitter {
});
};
- private writePdf(webContents: Electron.WebContents, filePath: string): Promise<{}> {
+ private writePdf(webContents: electron.WebContents, filePath: string): Promise<{}> {
return new Promise((resolve, reject) => {
webContents.printToPDF({ marginsType: 1, printBackground: true, landscape: true, pageSize: 'A4' }, (error, data) => {
if (error) {
@@ -3,7 +3,7 @@ import FileManager from './file_manager';
import {EVENTS} from './../constants/events';
export default class MainWindow {
- private window: Electron.BrowserWindow;
+ private window: electron.BrowserWindow;
private static instance: MainWindow;
private text: string;
@@ -32,7 +32,7 @@ export default class MainWindow {
FileManager.getInstance().on(EVENTS.FILE_MANAGER.RESET_FILE, this.handleResetFile.bind(this));
}
- public getBrowserWindow(): Electron.BrowserWindow {
+ public getBrowserWindow(): electron.BrowserWindow {
return this.window;
}
View
@@ -61,7 +61,7 @@ const setMenu = (mainWindow: MainWindow) => {
}
]
}
- ] as Electron.MenuItemOptions[];
+ ] as electron.MenuItemOptions[];
Menu.setApplicationMenu(Menu.buildFromTemplate(menuItems));
};
@@ -3,7 +3,7 @@ import MainWindow from './../browser/main_window';
import * as electron from 'electron';
export default class PresentationWindow {
- private window: Electron.BrowserWindow;
+ private window: electron.BrowserWindow;
private text: string;
private static instance: PresentationWindow;
View
@@ -2,9 +2,21 @@ import 'es6-shim';
import 'reflect-metadata';
import 'rxjs/Rx';
import 'zone.js/dist/zone';
-import { bootstrap } from '@angular/platform-browser-dynamic';
-import {AppComponent} from './components/app.component';
+import { NgModule } from '@angular/core';
+import { AppComponent } from './components/app.component';
+import { BrowserModule } from '@angular/platform-browser';
+import { Editor } from './components/editor/editor.component';
+import { Slide } from './components/slide/slide.component';
+import { SlidePreview } from './components/slide/slide_preview.component';
+import { MarkdownDirective } from './directives/markdown.directive';
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
-document.addEventListener('DOMContentLoaded', function() {
- bootstrap(AppComponent);
-});
+@NgModule({
+ declarations: [ AppComponent, Editor, SlidePreview, MarkdownDirective, Slide ],
+ imports: [ BrowserModule, ],
+ providers: [],
+ bootstrap: [AppComponent]
+})
+class App { }
+
+platformBrowserDynamic().bootstrapModule(App);
@@ -39,7 +39,6 @@ import {EVENTS} from './../../constants/events';
</div>
</div>
`,
- directives: [Editor, SlidePreview],
providers: [SlideService]
})
export class AppComponent {
@@ -1,7 +1,9 @@
+/// <reference path="../../../../typings/globals/ace/index.d.ts" />
+
import {Component, Output, Input, EventEmitter } from '@angular/core';
-require('ace-min-noconflict');
-require('ace-min-noconflict/mode-markdown');
-require('ace-min-noconflict/theme-monokai');
+import 'ace-min-noconflict';
+import 'ace-min-noconflict/mode-markdown';
+import 'ace-min-noconflict/theme-monokai';
@Component({
selector: 'editor',
@@ -31,7 +31,6 @@ const ipcRenderer = require('electron').ipcRenderer;
</div>
</div>
`,
- directives: [Slide],
providers: [SlideService]
})
export class ExportComponent {
@@ -33,7 +33,6 @@ import {EVENTS} from './../../constants/events';
</div>
</div>
`,
- directives: [Slide],
providers: [SlideService]
})
export class PresentationComponent {
@@ -1,5 +1,4 @@
import {Component, ElementRef, ViewEncapsulation} from '@angular/core';
-import {MarkdownDirective} from '../../directives/markdown.directive';
@Component({
selector: 'slide',
@@ -40,8 +39,7 @@ import {MarkdownDirective} from '../../directives/markdown.directive';
'./../solarized-light.css'
],
encapsulation: ViewEncapsulation.None,
- inputs: ['text'],
- directives: [MarkdownDirective]
+ inputs: ['text']
})
export class Slide {
constructor(private el: ElementRef) { }
@@ -22,7 +22,6 @@ import {Slide} from './slide.component';
}
`
],
- inputs: ['text'],
- directives: [Slide]
+ inputs: ['text']
})
export class SlidePreview { }
Oops, something went wrong.