mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-28 09:51:06 -06:00
Electron-417 (Reposition active notifications whenever the config is updated) (#339)
- Reposition active notifications when the config is updated - Fix spectron test cases
This commit is contained in:
parent
1ea6c2af3c
commit
a24255bf69
@ -165,7 +165,12 @@ function updateConfig(customConfig) {
|
|||||||
if (customConfig.display) {
|
if (customConfig.display) {
|
||||||
displayId = customConfig.display;
|
displayId = customConfig.display;
|
||||||
}
|
}
|
||||||
closeAll();
|
// Reposition active notification on config changes
|
||||||
|
setupConfig();
|
||||||
|
moveOneDown(0)
|
||||||
|
.then(() => {
|
||||||
|
log.send(logLevels.INFO, 'updateConfig: repositioned '+ activeNotifications.length +' active notification');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -739,31 +744,6 @@ function cleanUpInactiveWindow() {
|
|||||||
inactiveWindows = [];
|
inactiveWindows = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Closes all the notifications and windows
|
|
||||||
*/
|
|
||||||
function closeAll() {
|
|
||||||
// Clear out animation Queue and close windows
|
|
||||||
animationQueue.clear();
|
|
||||||
|
|
||||||
let notificationWindows = Array.from(activeNotifications);
|
|
||||||
|
|
||||||
notificationWindows.forEach((window) => {
|
|
||||||
if (window.displayTimer) {
|
|
||||||
clearTimeout(window.displayTimer);
|
|
||||||
}
|
|
||||||
if (!window.isDestroyed()) {
|
|
||||||
window.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cleanUpInactiveWindow();
|
|
||||||
|
|
||||||
// Reset certain vars
|
|
||||||
nextInsertPos = {};
|
|
||||||
activeNotifications = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.notify = notify;
|
module.exports.notify = notify;
|
||||||
module.exports.updateConfig = updateConfig;
|
module.exports.updateConfig = updateConfig;
|
||||||
|
@ -144,7 +144,7 @@ describe('Tests for Notification position', () => {
|
|||||||
it('should change notification position to upper-right', (done) => {
|
it('should change notification position to upper-right', (done) => {
|
||||||
return app.client
|
return app.client
|
||||||
.click('#open-config-win')
|
.click('#open-config-win')
|
||||||
.windowByIndex(2)
|
.windowByIndex(3)
|
||||||
.click('#upper-right')
|
.click('#upper-right')
|
||||||
.click('#ok-button')
|
.click('#ok-button')
|
||||||
.windowByIndex(0)
|
.windowByIndex(0)
|
||||||
@ -194,7 +194,7 @@ describe('Tests for Notification position', () => {
|
|||||||
.windowByIndex(0)
|
.windowByIndex(0)
|
||||||
.click('#notf')
|
.click('#notf')
|
||||||
.getWindowCount().then((count) => {
|
.getWindowCount().then((count) => {
|
||||||
expect(count === 3).toBeTruthy();
|
expect(count === 4).toBeTruthy();
|
||||||
done();
|
done();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
done.fail(new Error(`notificationPosition failed in getWindowCount with error: ${err}`));
|
done.fail(new Error(`notificationPosition failed in getWindowCount with error: ${err}`));
|
||||||
|
Loading…
Reference in New Issue
Block a user