diff --git a/gulpfile.js b/gulpfile.js index 7be7385fa3..16c6d4e8f6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,9 +27,12 @@ var traceur = require('gulp-traceur') require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig) -gulp.task('default', ['build', 'lib', 'e2e']) +gulp.task('default', ['clean'], function() { + gulp.run('build') +}) + +gulp.task('build', ['e2e', 'ionic-js', 'lib', 'sass']) -gulp.task('build', ['sass', 'ionic-js']) gulp.task('lib', ['ng2', 'fonts', 'dependencies']) gulp.task('watch', ['default'], function() { @@ -78,36 +81,89 @@ gulp.task('clean', function(done) { del([buildConfig.dist], done) }) -gulp.task('e2e', ['build'], function() { +gulp.task('e2e', ['ionic-js', 'sass'], function() { var indexContents = _.template( fs.readFileSync('scripts/e2e/index.template.html') )({ buildConfig: buildConfig - }) + }); + var platformJsTemplate = _.template( fs.readFileSync('scripts/e2e/platform.template.js') ) var testTemplate = _.template( fs.readFileSync('scripts/e2e/e2e.template.js') ) - return gulp.src(buildConfig.src.e2e) - .pipe(rename(function(file) { - file.dirname = file.dirname.replace('/test/', '/') - })) - .pipe(gulpif(/main.html$/, through2.obj(function(file, enc, next) { - var indexClone = _.clone(file) - this.push(new VinylFile(_.assign(indexClone, { - contents: new Buffer(indexContents), - path: file.path.replace(/main.html$/, 'index.html'), - }))) - next(null, file) - }))) - .pipe(gulpif(/.e2e.js$/, through2.obj(function(file, enc, next) { - var relativePath = path.dirname(file.path.replace(/^.*?src.components/, '')) - var contents = file.contents.toString() - contents = testTemplate({ - contents: contents, - buildConfig: buildConfig, - relativePath: relativePath + var platforms = [ + 'android', + 'default', + 'ios', + ] + + return gulp.src(buildConfig.src.e2eTest) + .pipe(through2.obj(function(file, enc, next) { + var self = this + gulp.src(file.path + '/**/*', { + base: file.path }) - file.contents = new Buffer(contents) - next(null, file) - }))) - .pipe(gulpif({ isFile: true }, gulp.dest(buildConfig.dist + '/e2e'))) + .pipe(gulpif(/main.html$/, processMainHtml())) + .on('data', function(file) { + if (file.stat && !file.stat.isFile()) return; + + file.path = file.path.replace(/(\\|\/)test/, '') + file.base = path.join(__dirname, 'src', 'components'); + var dirname = path.dirname(file.path) + var basename = path.basename(file.path); + + platforms.forEach(function(platform) { + var platformDir = dirname + '-' + platform; + var platformFilePath = file.path.replace(dirname, platformDir); + self.push(new VinylFile({ + path: platformFilePath, + base: file.base, + contents: file.contents.slice() + })); + + // Add a new platform.js file beside each index.html + if (basename === 'index.html') { + self.push(new VinylFile({ + path: platformFilePath.replace(/index.html$/, 'platform.js'), + base: file.base, + contents: new Buffer(platformJsTemplate({ + platform: platform + })) + })) + } + }) + }) + .on('end', next) + + function processMainHtml() { + return through2.obj(function(file, enc, next) { + this.push(new VinylFile({ + base: file.base, + contents: new Buffer(indexContents), + path: file.path.replace(/main.html$/, 'index.html'), + })) + next(null, file) + }) + } + })) + .pipe(gulp.dest(buildConfig.dist + '/e2e')); + // .pipe(gulpif(/main.html$/, through2.obj(function(file, enc, next) { + // var indexClone = _.clone(file) + // this.push(new VinylFile(_.assign(indexClone, { + // contents: new Buffer(indexContents), + // path: file.path.replace(/main.html$/, 'index.html'), + // }))) + // next(null, file) + // }))) + // .pipe(gulpif(/e2e.js$/, through2.obj(function(file, enc, next) { + // var relativePath = path.dirname(file.path.replace(/^.*?src.components/, '')) + // var contents = file.contents.toString() + // contents = testTemplate({ + // contents: contents, + // buildConfig: buildConfig, + // relativePath: relativePath + // }) + // file.contents = new Buffer(contents) + // next(null, file) + // }))) + // .pipe(gulpif({ isFile: true }, gulp.dest(buildConfig.dist + '/e2e'))) }) // Take es6 files from angular2's output, rename to js, and move to dist/lib/ diff --git a/scripts/build/config.js b/scripts/build/config.js index 86513d7fb9..2fc8f464c3 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -2,9 +2,10 @@ module.exports = { dist: 'dist', distLib: 'dist/lib', src: { - test: ['src/**/test/*.spec.js'], + spec: ['src/**/test/*.spec.js'], js: ['src/**/*.js', '!src/**/test/**/*.js'], - e2e: ['src/components/*/test/*/**/*'], + e2eTest: ['src/components/*/test/*/'], + e2e: ['src/components/*/test/**/*'], html: 'src/**/*.html', scss: 'src/components/**/*.scss', }, diff --git a/scripts/e2e/index.template.html b/scripts/e2e/index.template.html index 390939f13f..21be5b6f74 100644 --- a/scripts/e2e/index.template.html +++ b/scripts/e2e/index.template.html @@ -19,6 +19,7 @@ } }) +
diff --git a/scripts/e2e/platform.template.js b/scripts/e2e/platform.template.js new file mode 100644 index 0000000000..b3ab2abd3d --- /dev/null +++ b/scripts/e2e/platform.template.js @@ -0,0 +1,2 @@ +//TODO find a better override than window +window.IONIC_PLATFORM = '<%= platform %>'; diff --git a/src/components/aside/aside.js b/src/components/aside/aside.js index a572a4a215..5a90efc5df 100644 --- a/src/components/aside/aside.js +++ b/src/components/aside/aside.js @@ -3,6 +3,22 @@ import {ComponentConfig} from 'ionic2/config/component-config' import * as types from 'ionic2/components/aside/extensions/types' import * as gestures from 'ionic2/components/aside/extensions/gestures'; +export let AsideConfig = new ComponentConfig('aside') + +AsideConfig.classes('side', 'type') + +AsideConfig.delegate('gesture') + .when({side: 'left'}, gestures.LeftAsideGesture) + .when({side: 'right'}, gestures.RightAsideGesture) + .when({side: 'top'}, gestures.TopAsideGesture) + .when({side: 'bottom'}, gestures.BottomAsideGesture) + +AsideConfig.delegate('type') + .when({type: 'overlay'}, types.AsideTypeOverlay) + .when({type: 'push'}, types.AsideTypePush) + .when({type: 'reveal'}, types.AsideTypeReveal) + + @Component({ selector: 'ion-aside', bind: { @@ -59,19 +75,3 @@ export class Aside { } } } - -export let AsideConfig = new ComponentConfig(Aside) - -AsideConfig.classes('side', 'type') - -AsideConfig.delegate('gesture') - .when({side: 'left'}, gestures.LeftAsideGesture) - .when({side: 'right'}, gestures.RightAsideGesture) - .when({side: 'top'}, gestures.TopAsideGesture) - .when({side: 'bottom'}, gestures.BottomAsideGesture) - -AsideConfig.delegate('type') - .when({type: 'overlay'}, types.AsideTypeOverlay) - .when({type: 'push'}, types.AsideTypePush) - .when({type: 'reveal'}, types.AsideTypeReveal) - diff --git a/src/components/checkbox/checkbox.html b/src/components/checkbox/checkbox.html new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/components/checkbox/checkbox.html @@ -0,0 +1 @@ + diff --git a/src/components/checkbox/checkbox.js b/src/components/checkbox/checkbox.js index e69de29bb2..0e11da3587 100644 --- a/src/components/checkbox/checkbox.js +++ b/src/components/checkbox/checkbox.js @@ -0,0 +1,50 @@ +import {Component, Template, NgElement, PropertySetter} from 'angular2/angular2'; +import {ComponentConfig} from 'ionic2/config/component-config'; + +export let CheckboxConfig = new ComponentConfig('checkbox'); + +@Component({ + selector: 'ion-checkbox', + bind: { + checked: 'checked' + }, + events: { + 'click': 'onClick' + }, + services: [CheckboxConfig] +}) +@Template({ + inline: ` +