Skip to content

Commit

Permalink
Modify gulpfile.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed May 5, 2018
1 parent 4da24ca commit f9f209b
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 83 deletions.
2 changes: 1 addition & 1 deletion docs/Browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/Screen.html
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/ScreenConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/Window.html
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/WindowConfig.html
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/classes.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h4 class="modal-title">Search results</h4>
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on 2017/10/12 22:59:52
on 2018/05/05 19:03:05

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
2 changes: 1 addition & 1 deletion docs/quicksearch.html

Large diffs are not rendered by default.

92 changes: 45 additions & 47 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
'use strict'

const gulp = require('gulp')
const fun = require('gulp-fun-style')
const eslint = require('gulp-eslint')
const plumber = require('gulp-plumber')
const mocha = require('gulp-spawn-mocha')
const jsdoc = require('gulp-jsdoc3')

fun.lint = () =>
gulp.src(['src/**/*.js', '!src/**/*.doc.js'])
.pipe(plumber())
.pipe(eslint())
.pipe(eslint.format())

fun.lint.description = 'Lint js source files.'


fun.jsdoc = done =>
gulp.src(['docs/src/**/*.js', 'README.md'])
.pipe(plumber())
.pipe(jsdoc(require('./.jsdoc.json'), done))

fun.jsdoc.description = 'Create API document.'


fun.test = () =>
gulp.src(['src/**/*.test.js', 'test/**/*.test.js'])
.pipe(plumber())
.pipe(mocha())

fun.test.description = 'Run the unit tests.'


fun.coverage = () =>
gulp.src(['src/**/*.test.js', 'test/**/*.test.js'])
.pipe(plumber())
.pipe(mocha({ istanbul: true }))

fun.coverage.description = 'Measure the coverage of the unit tests.'


fun.watch_test = {
watch: ['src/**/*.js', '!src/**/*.doc.js', 'src/**/*.json'],
call: [['lint', 'coverage']]
const ghelp = require('gulp-showhelp')

var srcs = ['src/**/*.js', 'test/**/*.js']
var tests = srcs.concat(['src/**/*.json'])
var docs = ['docs/**/*.js', 'README.md']

gulp.task('help', done => {
ghelp.show()
done()
}).help = 'Show help message.'

gulp.task('lint', () => {
return gulp.src(srcs)
.pipe(plumber())
.pipe(eslint())
.pipe(eslint.format())
}).help = 'Lint js source files.'

gulp.task('mkdoc', done => {
gulp.src(docs)
.pipe(plumber())
.pipe(jsdoc(require('./.jsdoc.json'), done))
}).help = 'Create API document.'

gulp.task('test', () => {
return gulp.src(tests)
.pipe(plumber())
.pipe(mocha())
}).help = 'Run the unit tests.'

gulp.task('coverage', () => {
return gulp.src(tests)
.pipe(plumber())
.pipe(mocha({ istanbul: true }))
}).help = 'Measure the coverage of the unit tests.'


function watch_for_test() {
return gulp.watch(srcs, gulp.series('lint', 'test'))
}


fun.watch_doc = {
watch: ['docs/src/**/*.js', 'README.md'],
call: [['jsdoc']]
function watch_for_doc() {
return gulp.watch(docs, gulp.series('mkdoc'))
}


fun.watch = ['watch_test', 'watch_doc']

fun.watch.description = 'Watch file changes, then lint, test or jsdoc'
gulp.task('watch', gulp.parallel(watch_for_test, watch_for_doc))
.help = 'Watch file changes, then lint, test or jsdoc'


fun.default = [['lint', 'coverage', 'jsdoc']]
gulp.task('default', gulp.series('lint', 'coverage', 'mkdoc'))
.help = 'Default task: lint & coverage & mkdoc'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"coveralls": "^3.0.0",
"gulp": "^4.0.0",
"gulp-eslint": "^4.0.2",
"gulp-fun-style": "^0.3.2",
"gulp-jsdoc3": "^2.0.0",
"gulp-plumber": "^1.2.0",
"gulp-showhelp": "^1.2.0",
"gulp-spawn-mocha": "^5.0.1",
"istanbul": "^0.4.5",
"mocha": "^5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion test/behavior/run-script.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ document.body.innerHTML = '<p>Hello</p>';
</html>
`)
const window = browser.openWindow('http://test/script')
window.addEventListener('load', event => {
window.addEventListener('load', () => {
expect(window.document.querySelector('p').textContent).to.equal('Hello')
done()
})
Expand Down
20 changes: 10 additions & 10 deletions test/unit/window/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,8 @@ describe('window/config', () => {
expect(windowConfig.popup.minSize.height).to.equal(12)
})

it('Should use .frame.minOpeningSize.* when .isFrameWindow is true',
() => {
it('Should use .frame.minOpeningSize.* when .isFrameWindow is true' +
'', () => {
const windowConfig = new WindowConfig({ screen })
expect(windowConfig.isFrameWindow).to.be.true

Expand Down Expand Up @@ -586,8 +586,8 @@ describe('window/config', () => {
expect(windowConfig.popup.minOpeningSize.height).to.equal(18)
})

it('Should use .frame.minResizableSize.* when .isFrameWindow is true',
() => {
it('Should use .frame.minResizableSize.* when .isFrameWindow is true' +
'', () => {
const windowConfig = new WindowConfig({ screen })
expect(windowConfig.isFrameWindow).to.be.true

Expand Down Expand Up @@ -802,8 +802,8 @@ describe('window/config', () => {
expect(windowConfig.popup.minSize.height).to.equal(12)
})

it('Should use .popup.minOpeningSize.* when .isFrameWindow is true',
() => {
it('Should use .popup.minOpeningSize.* when .isFrameWindow is true' +
'', () => {
const windowConfig = new WindowConfig({ screen })
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
Expand Down Expand Up @@ -846,8 +846,8 @@ describe('window/config', () => {
expect(windowConfig.popup.minOpeningSize.height).to.equal(18)
})

it('Should use .popup.minResizableSize.* when .isFrameWindow is true',
() => {
it('Should use .popup.minResizableSize.* when .isFrameWindow is true' +
'', () => {
const windowConfig = new WindowConfig({ screen })
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
Expand Down Expand Up @@ -1033,13 +1033,13 @@ describe('window/config', () => {
expect(a).to.equal('A')
expect(b).to.equal('B')
expect(c).to.equal('C')
callCount.on ++
callCount.on++
})
windowConfig.once('event1', (a, b, c) => {
expect(a).to.equal('A')
expect(b).to.equal('B')
expect(c).to.equal('C')
callCount.once ++
callCount.once++
})

windowConfig.$events.emit('event1', 'A', 'B', 'C')
Expand Down
8 changes: 4 additions & 4 deletions test/unit/window/opening.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ describe('window/opening', () => {
})
})

it('Should open a window : url is nullish and target is "_blank"',
done => {
it('Should open a window : url is nullish and target is "_blank"' +
'', done => {
const win0 = createWindow()
const win1 = win0.open(null, '_blank')
expect(win1).to.not.equal(win0)
Expand Down Expand Up @@ -447,8 +447,8 @@ describe('window/opening', () => {
done()
})

it('Should open a named frame window even if features is not empty ',
done => {
it('Should open a named frame window even if features is not empty ' +
'', done => {
browser.contentManager.add('http://sample.com/aaa', '<p>Sample</p>')

const win0 = createWindow()
Expand Down
24 changes: 12 additions & 12 deletions test/unit/window/window.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should move to left-top side if specified delta is too small',
() => {
it('Should move to left-top side if specified delta is too small' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isMovableByScript).to.be.true
Expand Down Expand Up @@ -616,8 +616,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should move to right-bottom side if specified delta are too large',
() => {
it('Should move to right-bottom side if specified delta are too large' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isMovableByScript).to.be.true
Expand Down Expand Up @@ -735,8 +735,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should resize to minimum size if specified size is too small',
() => {
it('Should resize to minimum size if specified size is too small' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isResizableByScript).to.be.true
Expand All @@ -758,8 +758,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should resize to screen avail size if specified size is too large',
() => {
it('Should resize to screen avail size if specified size is too large' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isResizableByScript).to.be.true
Expand Down Expand Up @@ -860,8 +860,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should resize to minimum size if specified delta is too small',
() => {
it('Should resize to minimum size if specified delta is too small' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isResizableByScript).to.be.true
Expand All @@ -883,8 +883,8 @@ describe('window', () => {
expect(window.devicePixelRatio).to.equal(1)
})

it('Should resize to screen avail size if specified delta is too large',
() => {
it('Should resize to screen avail size if specified delta is too large' +
'', () => {
windowConfig.isFrameWindow = false
expect(windowConfig.isFrameWindow).to.be.false
expect(windowConfig.isResizableByScript).to.be.true
Expand Down

0 comments on commit f9f209b

Please sign in to comment.