test(Viewer): verify saveXML.done on no definitions loaded

This commit is contained in:
Nico Rehwaldt 2021-03-03 23:37:29 +01:00 committed by fake-join[bot]
parent 3567565514
commit a7522ac5b1
1 changed files with 38 additions and 0 deletions

View File

@ -1302,6 +1302,44 @@ describe('Viewer', function() {
}); });
it('should emit <saveXML.done> 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' ]
]);
});
});
}); });