From 6c6867e9f3db8f2745f51389a79a6fe29b893bd3 Mon Sep 17 00:00:00 2001 From: "Alexey Mulyukin (alexprey)" Date: Mon, 24 Aug 2020 12:39:30 +0300 Subject: [PATCH] Add tests to reproduce issue #32 --- .../event.dispatcher.externalCallback.svelte | 15 +++++++++++++ .../svelte3/integration/events/events.spec.js | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/svelte3/integration/events/event.dispatcher.externalCallback.svelte diff --git a/test/svelte3/integration/events/event.dispatcher.externalCallback.svelte b/test/svelte3/integration/events/event.dispatcher.externalCallback.svelte new file mode 100644 index 0000000..ba93131 --- /dev/null +++ b/test/svelte3/integration/events/event.dispatcher.externalCallback.svelte @@ -0,0 +1,15 @@ + + +
+ Simple component +
+ diff --git a/test/svelte3/integration/events/events.spec.js b/test/svelte3/integration/events/events.spec.js index 503c10f..4cc708d 100644 --- a/test/svelte3/integration/events/events.spec.js +++ b/test/svelte3/integration/events/events.spec.js @@ -267,4 +267,26 @@ describe('SvelteDoc v3 - Events', () => { done(e); }); }); + + it('Dispatch event from external callback', (done) => { + parser.parse({ + version: 3, + filename: path.resolve(__dirname, 'event.dispatcher.externalCallback.svelte'), + features: ['events'], + ignoredVisibilities: [] + }).then((doc) => { + expect(doc, 'Document should be provided').to.exist; + expect(doc.events, 'Document events should be parsed').to.exist; + + const event = doc.events.find(e => e.name === 'change'); + + expect(event, 'Event should be a valid entity').to.exist; + expect(event.name).to.equal('change'); + expect(event.visibility).to.equal('public'); + + done(); + }).catch(e => { + done(e); + }); + }); });