Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Get tests working again with latest angular version. Complete NgGridI…
Browse files Browse the repository at this point in the history
…tem tests
  • Loading branch information
BTMorton committed Oct 17, 2015
1 parent 0cd4b52 commit ff4c690
Show file tree
Hide file tree
Showing 8 changed files with 410 additions and 160 deletions.
37 changes: 25 additions & 12 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ var del = require('del');
var gulp = require('gulp');
var typescript = require('gulp-typescript');
var uglify = require('gulp-uglify');
var symlink = require('gulp-symlink');
var sourcemaps = require('gulp-sourcemaps');
var runSequence = require('run-sequence');
var merge = require('merge2');
var KarmaServer = require('karma').Server;

Expand All @@ -11,7 +13,8 @@ var tsProject = typescript.createProject({
module: 'commonjs',
target: 'ES5',
emitDecoratorMetadata: true,
experimentalDecorators: true
experimentalDecorators: true,
noExternalResolve: true
});

var PATHS = {
Expand All @@ -31,15 +34,20 @@ var PATHS = {
'node_modules/traceur/bin/traceur-runtime.js'
],
rx: 'node_modules/\@reactivex/rxjs/dist/**/*.js',
typings: ['node_modules/angular2/bundles/typings/angular2/angular2.d.ts'],
typings: [
'node_modules/angular2/bundles/typings/angular2/angular2.d.ts',
'node_modules/angular2/typings/**/*.d.ts'
],
testTypings: [
'node_modules/angular2/bundles/typings/angular2/angular2.d.ts',
'typings/jasmine/jasmine.d.ts'
'node_modules/angular2/typings/**/*.d.ts',
'dist/*.d.ts'
// 'typings/jasmine/jasmine.d.ts'
],
};

gulp.task('clean', function (done) {
del(['dist'], done);
return del(['dist'], done);
});

gulp.task('ts', function () {
Expand All @@ -49,12 +57,12 @@ gulp.task('ts', function () {

return merge([
tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest('dist')),//.pipe(uglify())
tsResult.dts.pipe(gulp.dest('src'))
tsResult.dts.pipe(gulp.dest('src')).pipe(gulp.dest('dist'))
]);
});

gulp.task('test-clean-build', function(done) {
del(['test/*.js'], done)
return del(['test/*.js'], done)
});

gulp.task('test-build', ['test-clean-build'], function () {
Expand All @@ -65,10 +73,15 @@ gulp.task('test-build', ['test-clean-build'], function () {
return tsResult.js.pipe(sourcemaps.write()).pipe(gulp.dest('test'));
});

gulp.task('test', ['test-build'], function() {
gulp.start('test-run');
gulp.task('test', ['test-build'], function(done) {
runSequence('test-link', 'test-run', ['test-link-clean', 'test-clean-build'], done);
});
gulp.task('test-link-clean', function(done) {
return del(['\@reactivex'], done);
});
gulp.task('test-link', ['test-link-clean'], function() {
return gulp.src('node_modules/\@reactivex/').pipe(symlink('\@reactivex'));
});

gulp.task('test-run', function(done) {
new KarmaServer({
configFile: __dirname + '/karma.conf.js',
Expand Down Expand Up @@ -100,11 +113,11 @@ gulp.task('libs', ['rx'], function () {
});

gulp.task('build', function() {
gulp.start('libs', 'html', 'css', 'ts');
return gulp.start('libs', 'html', 'css', 'ts');
});

gulp.task('rebuild', ['clean'], function() {
gulp.start('build');
return gulp.start('build');
});

gulp.task('watch', ['build'], function () {
Expand All @@ -114,5 +127,5 @@ gulp.task('watch', ['build'], function () {
});

gulp.task('default', function() {
gulp.start('build');
return gulp.start('rebuild');
});
10 changes: 5 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ module.exports = function(config) {
'dist/lib/system.js',
'node_modules/babel-core/browser-polyfill.min.js',
'node_modules/babel-core/browser.min.js',
'node_modules/angular2/node_modules/reflect-metadata/Reflect.js',
'node_modules/reflect-metadata/Reflect.js',
'test-main.js',
{ pattern: 'node_modules/babel-core/*.js', included: false, serve: true },
{ pattern: 'node_modules/angular2/*.js', included: false, serve: true },
{ pattern: 'node_modules/angular2/src/**/*.js', included: false, serve: true },
{ pattern: 'node_modules/angular2/node_modules/rx/dist/rx.min.js', included: false, serve: true },
{ pattern: 'node_modules/babel-core/*.js', included: false, serve: true, watch: false },
{ pattern: 'node_modules/angular2/*.js', included: false, serve: true, watch: false },
{ pattern: 'node_modules/angular2/src/**/*.js', included: false, serve: true, watch: false },
{ pattern: 'dist/*.js', included: false, serve: true, watch: true },
{ pattern: '\@reactivex/rxjs/dist/cjs/**/*.js', included: false, serve: true, watch: false },
{
pattern: 'test/**/*spec.js',
included: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"peerDependencies": {
"angular2": "2.0.0-alpha.44",
"systemjs": "^0.19.4"
"@reactivex/rxjs": "^5.0.0-alpha.5",
"\@reactivex/rxjs": "^5.0.0-alpha.5",
"traceur": "0.0.91"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/NgGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ export class NgGridItem implements OnInit {
// Private methods
private _recalculatePosition(): void {
var x = (this._ngGrid.colWidth + this._ngGrid.marginLeft + this._ngGrid.marginRight) * (this._col - 1) + this._ngGrid.marginLeft;
var y = (this._ngGrid.rowHeight + this._ngGrid.marginTop + this._ngGrid.marginBottom) * (this._row - 1) + this._ngGrid.marginRight;
var y = (this._ngGrid.rowHeight + this._ngGrid.marginTop + this._ngGrid.marginBottom) * (this._row - 1) + this._ngGrid.marginTop;

this.setPosition(x, y);
}
Expand Down
3 changes: 0 additions & 3 deletions test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ System.config({
transpiler: 'babel',
defaultJSExtensions: true,
paths: {
'test/*': 'test/*',
'src/*': 'dist/*',
'angular2/*': 'node_modules/angular2/*',
'rx': 'node_modules/angular2/node_modules/rx/dist/rx.min.js'
}
})

Expand Down
Loading

0 comments on commit ff4c690

Please sign in to comment.