Skip to content

Commit

Permalink
fix test and example refs
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFrankel committed Jun 14, 2018
1 parent bda1c7f commit 282f571
Show file tree
Hide file tree
Showing 13 changed files with 612 additions and 525 deletions.
4 changes: 2 additions & 2 deletions example/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component, ElementRef, ViewEncapsulation, OnInit, ViewChild} from '@angular/core';
import {PopperContent} from '../../src/popper-content';
import {PopperContent} from '../../dist';
/**
* This class represents the main application component.
*/
Expand All @@ -16,7 +16,7 @@ export class AppComponent implements OnInit {
}
};
example1select: string = 'top';
@ViewChild('popper3Content') popper3Content: PopperContent;
@ViewChild('popper3Content') popper3Content: any;

constructor(private elem: ElementRef) {
}
Expand Down
2 changes: 1 addition & 1 deletion example/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {NgxPopperModule, Triggers} from '../../dist/ngx-popper.js';
import {NgxPopperModule, Triggers} from '../../dist';
import {Draggable} from 'ng2draggable/draggable.directive';

@NgModule({
Expand Down
41 changes: 41 additions & 0 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"skipLibCheck": true,
"lib": [
"es7",
"dom",
"es2017.object",
"es2015.iterable",
"ScriptHost"
]
},
"typeRoots": [
"./node_modules/@types",
"./node_modules"
],
"types": [
"node"
],
"include": [
"."
],
"exclude": [
"node_modules",
"dist",
"dist-tsc",
"test",
"example-cli"
],
"angularCompilerOptions": {
"preserveWhiteSpace": false

}
}
6 changes: 3 additions & 3 deletions webpack.config.js → example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ module.exports = {
{
test: /\.ts?$/,
use: ['awesome-typescript-loader', 'angular2-template-loader'],
exclude: ['node_modules']
exclude: ['node_modules', 'dist', 'dist-tsc', 'test', 'public_api']
},
{
test: /\.(html|css)$/,
use: 'raw-loader',
exclude: ['node_modules']
exclude: ['node_modules', 'dist', 'dist-tsc', 'test']
}
]
},
plugins: [
new CheckerPlugin(),
new AngularCompilerPlugin({
tsConfigPath: './tsconfig.json',
tsConfigPath: './example/tsconfig.json',
entryModule: 'example/app/app.module#AppModule',
sourceMap: true
}),
Expand Down
11 changes: 0 additions & 11 deletions index.html

This file was deleted.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"test": "test"
},
"scripts": {
"create_test_server": "rm -rf test_dist && webpack --config webpack.test.config.js && http-server test_dist -p 8888",
"test-server": "http-server test_dist -p 8888",
"create_test_server": "rm -rf test_dist && webpack --config ./test/webpack.test.config.js && npm run test-server",
"test": "jest",
"start_test": "start-server-and-test create_test_server http://localhost:8888 test",
"build": "ng-packagr -p ng-package.json",
"deploy": "npm run build && npm publish --access=public dist",
"dev": "webpack-dev-server"
"dev": "webpack-dev-server --config ./example/webpack.config.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -55,11 +56,13 @@
"html-webpack-plugin": "^2.30.1",
"http-server": "^0.11.1",
"install": "^0.11.0",
"jest": "^23.0.0",
"jest-puppeteer": "^3.0.1",
"ng-packagr": "^1.6.0",
"ng-packagr": "^3.0.1",
"ng2draggable": "^1.3.2",
"open-browser-webpack-plugin": "^0.0.5",
"progress-bar-webpack-plugin": "^1.10.0",
"puppeteer": "^1.4.0",
"raw-loader": "^0.5.1",
"reflect-metadata": "^0.1.12",
"rxjs": "^5.5.6",
Expand All @@ -72,11 +75,9 @@
"webpack-dev-server": "^2.11.1",
"webpack-shell-plugin": "^0.5.0",
"yarn": "^1.3.2",
"puppeteer": "^1.4.0",
"jest": "^23.0.0",
"zone.js": "^0.8.20"
},
"dependencies": {
"popper.js": "^1.14.1"
"peerDependencies": {
"popper.js": "^1.14.3"
}
}
2 changes: 1 addition & 1 deletion test/__tests__/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let testCounter = 0;

jest.setTimeout(timeout);
describe(
'/ (Home Page)',
'/basic tests',
() => {
let page;

Expand Down
3 changes: 3 additions & 0 deletions test/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@
<div>
<div class="popperTarget" [popper]="popper1" [popperTrigger]="'click'" [popperPlacement]="'right'">click</div>
<popper-content #popper1>testing</popper-content>
</div>
<div>
<div class="popperTarget" popper="testing" [popperTrigger]="'click'" [popperDelay]="5000" popperPlacement]="'right'">click</div>
</div>
4 changes: 2 additions & 2 deletions test/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {BrowserModule} from '@angular/platform-browser';
import {AppComponent} from './app.component';
import {NgxPopperModule, Triggers} from '../../dist/ngx-popper.js';
import {NgxPopperModule, Triggers} from '../../dist';

@NgModule({
imports: [
BrowserModule,
FormsModule,
NgxPopperModule.forRoot({
trigger: Triggers.NONE,
trigger: Triggers.CLICK,
hideOnClickOutside: false
})],
declarations: [
Expand Down
41 changes: 41 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"declaration": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"skipLibCheck": true,
"lib": [
"es7",
"dom",
"es2017.object",
"es2015.iterable",
"ScriptHost"
]
},
"typeRoots": [
"./node_modules/@types",
"./node_modules"
],
"types": [
"node"
],
"include": [
"."
],
"exclude": [
"node_modules",
"dist",
"dist-tsc",
"example",
"example-cli"
],
"angularCompilerOptions": {
"preserveWhiteSpace": false

}
}
66 changes: 66 additions & 0 deletions test/webpack.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const path = require('path');
const {CheckerPlugin} = require('awesome-typescript-loader');
const webpack = require('webpack');
const OpenBrowserPlugin = require('open-browser-webpack-plugin');
const chalk = require('chalk');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;

module.exports = {
entry: './test/app/index.ts',
output: {
filename: '[name].js',
path: path.resolve(__dirname, '../test_dist')
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.html', '.css']
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.ts?$/,
use: ['awesome-typescript-loader', 'angular2-template-loader'],
exclude: ['node_modules', /__tests__/, 'example', 'dist', 'dist_tsc']
},
{
test: /\.(html|css)$/,
use: 'raw-loader',
exclude: ['node_modules', /__tests__/, 'example', 'dist', 'dist_tsc']
}
]
},
plugins: [
new CheckerPlugin(),
new AngularCompilerPlugin({
tsConfigPath: './test/tsconfig.json',
entryModule: 'test/app/app.module#AppModule',
sourceMap: true
}),

new HtmlWebpackPlugin({
inject: true,
template: 'test/index.html'
}),
new ProgressBarPlugin({
format: ' build [' + chalk.blue.bold(':bar') + ']' + chalk.green.bold(':percent') + ' (:elapsed seconds) => :msg... ',
clear: false
}),
new OpenBrowserPlugin({
url: `http://localhost:8888`
}),
new webpack.HotModuleReplacementPlugin()
],
devServer: {
// https: true,
hot: true,
stats: 'errors-only',
port: 8888,
inline: true,
historyApiFallback: {
index: './test/'
},
open: false
}
};
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@
"types": [
"node"
],
"include": [
"example"
],
"exclude": [
"node_modules",
"dist",
"dist-tsc",
"test",
"example",
"example-cli"
],
"angularCompilerOptions": {
// "fullTemplateTypeCheck": true,
"preserveWhiteSpace": false

}
Expand Down
Loading

0 comments on commit 282f571

Please sign in to comment.