X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Fnode_modules%2Fnpmlog%2Fnode_modules%2Fgauge%2Ftest%2Fprogress-bar.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Fnode_modules%2Fnpmlog%2Fnode_modules%2Fgauge%2Ftest%2Fprogress-bar.js;h=5d3e7e78fe000e73e2ef613e96caabbb36691c85;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npmlog/node_modules/gauge/test/progress-bar.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npmlog/node_modules/gauge/test/progress-bar.js new file mode 100644 index 00000000..5d3e7e78 --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/npmlog/node_modules/gauge/test/progress-bar.js @@ -0,0 +1,176 @@ +"use strict" +var test = require("tap").test +var ProgressBar = require("../progress-bar.js") + +var cursor = [] +var C +var bar = new ProgressBar({theme: ProgressBar.ascii, maxUpdateFrequency: 0}, C = { + show: function () { + cursor.push(["show"]) + return C + }, + hide: function () { + cursor.push(["hide"]) + return C + }, + up: function (lines) { + cursor.push(["up",lines]) + return C + }, + horizontalAbsolute: function (col) { + cursor.push(["horizontalAbsolute", col]) + return C + }, + eraseLine: function () { + cursor.push(["eraseLine"]) + return C + }, + write: function (line) { + cursor.push(["write", line]) + return C + } +}) + + +function isOutput(t, msg, output) { + var tests = [] + for (var ii = 0; ii P | |----|\n' ], + [ 'show' ] ]) +}) + +test("window resizing", function (t) { + t.plan(16) + process.stderr.isTTY = true + process.stdout.columns = 32 + bar.show("NAME", 0.1) + cursor = [] + bar.last = new Date(0) + bar.pulse() + isOutput(t, "32 columns", + [ [ 'up', 1 ], + [ 'hide' ], + [ 'horizontalAbsolute', 0 ], + [ 'write', 'NAME / |##------------------|\n' ], + [ 'show' ] ]) + + process.stdout.columns = 16 + bar.show("NAME", 0.5) + cursor = [] + bar.last = new Date(0) + bar.pulse() + isOutput(t, "16 columns", + [ [ 'up', 1 ], + [ 'hide' ], + [ 'horizontalAbsolute', 0 ], + [ 'write', 'NAME - |##--|\n' ], + [ 'show' ] ]); +});