Repository: incubator-weex Updated Branches: refs/heads/0.15-dev 831cb26d3 -> 9764e25ea
* [html5] improve test case Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/635d27a2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/635d27a2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/635d27a2 Branch: refs/heads/0.15-dev Commit: 635d27a296ed26c93e3170965c5fbc906e4fe3a7 Parents: 59c0ef9 Author: erha19 <faterr...@gmail.com> Authored: Sun Jul 9 20:12:25 2017 +0800 Committer: erha19 <faterr...@gmail.com> Committed: Sun Jul 9 20:12:25 2017 +0800 ---------------------------------------------------------------------- html5/test/render/vue/utils/pref.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/635d27a2/html5/test/render/vue/utils/pref.js ---------------------------------------------------------------------- diff --git a/html5/test/render/vue/utils/pref.js b/html5/test/render/vue/utils/pref.js index 79a234f..3aad2b8 100644 --- a/html5/test/render/vue/utils/pref.js +++ b/html5/test/render/vue/utils/pref.js @@ -19,9 +19,18 @@ import { collectStatPerf, tagFirstScreen, - tagImg + tagImg, + tagBeforeCreate, + tagRootMounted, + tagMounted, + tagBeforeUpdate, + tagUpdated, + tagBegin, + tagEnd } from '../../../../render/vue/utils/perf' describe('utils', function () { + before(function(){ + }) describe('pref', function () { before(function () { this.clock = sinon.useFakeTimers() @@ -31,17 +40,26 @@ describe('utils', function () { }) it('collectStatPerf', function () { expect(collectStatPerf).to.be.a('function') - collectStatPerf('totalTime', (new Date()).getTime()) + expect(collectStatPerf('totalTime', (new Date()).getTime())).to.be.a('undefined') + expect(collectStatPerf()).to.be.a('undefined') }) it('tagFirstScreen', function () { + const weexEmit = sinon.stub(window.weex,'emit') expect(tagFirstScreen).to.be.a('function') tagFirstScreen() + expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1) + expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(0) window._first_screen_detected = false tagFirstScreen() + expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(2) + expect(weexEmit.withArgs('firstscreenfinish').callCount).to.be.equal(1) + weexEmit.restore() }) it('tagImg', function () { + const weexEmit = sinon.stub(window.weex,'emit') tagImg() this.clock.tick(500) + expect(weexEmit.withArgs('renderfinish').callCount).to.be.equal(1) expect(tagImg).to.be.a('function') }) })