diff --git a/.editorconfig b/.editorconfig index af440cbf..be141b7d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -16,7 +16,7 @@ trim_trailing_whitespace = true indent_size = 2 -[{*.md,*.jade}] +[{*.md,*.jade,*.pug}] trim_trailing_whitespace = false diff --git a/ghu.js b/ghu.js index 441b3c56..e031b19e 100644 --- a/ghu.js +++ b/ghu.js @@ -9,7 +9,7 @@ const SRC = join(ROOT, 'src'); const TEST = join(ROOT, 'test'); const BUILD = join(ROOT, 'build'); -const mapper = mapfn.p(SRC, BUILD).s('.less', '.css').s('.jade', ''); +const mapper = mapfn.p(SRC, BUILD).s('.less', '.css').s('.pug', ''); ghu.defaults('release'); @@ -88,8 +88,8 @@ ghu.task('build:styles', runtime => { }); ghu.task('build:pages', runtime => { - return read(`${SRC}: **/*.jade, ! **/*.tpl.jade`) - .then(newerThan(mapper, `${SRC}/**/*.tpl.jade`)) + return read(`${SRC}: **/*.pug, ! **/*.tpl.pug`) + .then(newerThan(mapper, `${SRC}/**/*.tpl.pug`)) .then(pug({pkg: runtime.pkg})) .then(wrap('', runtime.commentHtml)) .then(write(mapper, {overwrite: true})); @@ -104,7 +104,7 @@ ghu.task('build:copy', runtime => { .then(wrap(runtime.commentJs)) .then(write(mapper, {overwrite: true, cluster: true})), - read(`${SRC}: **, ! **/*.js, ! **/*.less, ! **/*.jade, ! **/conf/*.json`) + read(`${SRC}: **, ! **/*.js, ! **/*.less, ! **/*.pug, ! **/conf/*.json`) .then(newerThan(mapper)) .then(each(obj => { if (/index\.php$/.test(obj.source)) { diff --git a/src/_h5ai/private/php/pages/index.php.jade b/src/_h5ai/private/php/pages/index.php.pug similarity index 88% rename from src/_h5ai/private/php/pages/index.php.jade rename to src/_h5ai/private/php/pages/index.php.pug index 4b785a59..90a5ad67 100644 --- a/src/_h5ai/private/php/pages/index.php.jade +++ b/src/_h5ai/private/php/pages/index.php.pug @@ -1,4 +1,4 @@ -extends ./page.tpl.jade +extends ./page.tpl.pug block init - var title = 'index - powered by h5ai v' + pkg.version + ' (' + pkg.homepage + ')' diff --git a/src/_h5ai/private/php/pages/info.php.jade b/src/_h5ai/private/php/pages/info.php.pug similarity index 87% rename from src/_h5ai/private/php/pages/info.php.jade rename to src/_h5ai/private/php/pages/info.php.pug index 2ef019b1..029caaf9 100644 --- a/src/_h5ai/private/php/pages/info.php.jade +++ b/src/_h5ai/private/php/pages/info.php.pug @@ -1,4 +1,4 @@ -extends ./page.tpl.jade +extends ./page.tpl.pug block init - var title = 'h5ai info page - v' + pkg.version diff --git a/src/_h5ai/private/php/pages/page.tpl.jade b/src/_h5ai/private/php/pages/page.tpl.pug similarity index 100% rename from src/_h5ai/private/php/pages/page.tpl.jade rename to src/_h5ai/private/php/pages/page.tpl.pug diff --git a/test/tests.js b/test/tests.js index a9401423..4de0d30f 100644 --- a/test/tests.js +++ b/test/tests.js @@ -2,6 +2,8 @@ const {test} = require('scar'); const {pinHtml} = require('./util/pin'); require('./tests/premisses'); +require('./tests/unit/core/event'); +require('./tests/unit/core/format'); pinHtml(); diff --git a/test/tests/unit/core/event.js b/test/tests/unit/core/event.js new file mode 100644 index 00000000..a0157e0a --- /dev/null +++ b/test/tests/unit/core/event.js @@ -0,0 +1,22 @@ +const {test, assert} = require('scar'); +const event = require('../../../../src/_h5ai/public/js/lib/core/event'); + +test('event is object', () => { + assert.equal(typeof event, 'object'); +}); + +test('event has the right props', () => { + assert.deepEqual(Object.keys(event), ['sub', 'unsub', 'pub']); +}); + +test('event.sub is function', () => { + assert.equal(typeof event.sub, 'function'); +}); + +test('event.unsub is function', () => { + assert.equal(typeof event.unsub, 'function'); +}); + +test('event.pub is function', () => { + assert.equal(typeof event.pub, 'function'); +}); diff --git a/test/tests/unit/core/format.js b/test/tests/unit/core/format.js new file mode 100644 index 00000000..06b83264 --- /dev/null +++ b/test/tests/unit/core/format.js @@ -0,0 +1,26 @@ +const {test, assert} = require('scar'); +const format = require('../../../../src/_h5ai/public/js/lib/core/format'); + +test('format is object', () => { + assert.equal(typeof format, 'object'); +}); + +test('format has the right props', () => { + assert.deepEqual(Object.keys(format), ['setDefaultMetric', 'formatSize', 'setDefaultDateFormat', 'formatDate']); +}); + +test('format.setDefaultMetric is function', () => { + assert.equal(typeof format.setDefaultMetric, 'function'); +}); + +test('format.formatSize is function', () => { + assert.equal(typeof format.formatSize, 'function'); +}); + +test('format.setDefaultDateFormat is function', () => { + assert.equal(typeof format.setDefaultDateFormat, 'function'); +}); + +test('format.formatDate is function', () => { + assert.equal(typeof format.formatDate, 'function'); +});