From a7522ac5b104654f5b7d50c6b6807b760738ec14 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 3 Mar 2021 23:37:29 +0100 Subject: [PATCH] test(Viewer): verify saveXML.done on no definitions loaded --- test/spec/ViewerSpec.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index 923a9427..980ba199 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -1302,6 +1302,44 @@ describe('Viewer', function() { }); + + it('should emit on no definitions loaded', async function() { + + var viewer; + var events = []; + + var viewer = new Viewer({ + container: container + }); + + viewer.on([ + 'saveXML.start', + 'saveXML.serialized', + 'saveXML.done' + ], function(e) { + + // log event type + event arguments + events.push([ + e.type, + Object.keys(e).filter(function(key) { + return key !== 'type'; + }) + ]); + }); + + return viewer.saveXML().catch(function(error) { + events.push([ 'error' ]); + }).finally(function() { + + // then + expect(events).to.eql([ + [ 'saveXML.done', [ 'error' ] ], + [ 'error' ] + ]); + }); + + }); + });