From cb9e66760444580f2a25c27330b67229940217fc Mon Sep 17 00:00:00 2001 From: CapitaineJSparrow <6690149+CapitaineJSparrow@users.noreply.github.com> Date: Tue, 4 Oct 2022 18:48:18 +0200 Subject: [PATCH] add unit test --- tests/signal.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/signal.js b/tests/signal.js index 77c8c63..f181ff6 100644 --- a/tests/signal.js +++ b/tests/signal.js @@ -86,6 +86,19 @@ window.on('show', () => { ) }) + describe('Trigger "on-focus-out-event" should work', async () => new Promise((resolve, reject) => { + const searchEntry = new Gtk.SearchEntry(); + const event = new Gdk.EventFocus() + event.type = Gdk.EventType.FOCUS_CHANGE + event.window = searchEntry.getWindow() + event.sendEvent = 1 + + searchEntry.on('focus-out-event', (event) => resolve()) + searchEntry.emit('focus-out-event', event); + // In case resolve is never called, do not block test indefinitely + setTimeout(() => reject(), 1000); + })); + describe('types are as correct as possible', () => { const event = new Gdk.EventButton() event.type = Gdk.EventType.BUTTON_PRESS