Skip to content

Commit

Permalink
Merge master to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 24, 2023
2 parents 480186b + b26d596 commit 7a9b656
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
18 changes: 9 additions & 9 deletions client/src/app/AppParent.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ export default class AppParent extends PureComponent {
this.appRef = React.createRef();
}

triggerAction = (event, action, options) => {
triggerAction = (action, context) => {

// fail-safe trigger given action
const exec = async () => {

log('trigger action %s, %o', action, options);
log('trigger action %s, %o', action, context);

const {
backend
} = this.props.globals;

const result = await this.getApp().triggerAction(action, options);
const result = await this.getApp().triggerAction(action, context);

if (action === 'quit') {

Expand Down Expand Up @@ -243,11 +243,11 @@ export default class AppParent extends PureComponent {
this.getBackend().sendReady();
};

handleResize = () => this.triggerAction(null, 'resize');
handleResize = () => this.triggerAction('resize');

handleFocus = (event) => {
this.triggerAction(event, 'check-file-changed');
this.triggerAction(event, 'notify-focus-change');
handleFocus = () => {
this.triggerAction('check-file-changed');
this.triggerAction('notify-focus-change');
};

handleStarted = async () => {
Expand Down Expand Up @@ -316,7 +316,7 @@ export default class AppParent extends PureComponent {
* @param {string} entry.action
*/
logToClient(entry) {
this.triggerAction(null, 'log', entry);
this.triggerAction('log', entry);
}

/**
Expand All @@ -338,7 +338,7 @@ export default class AppParent extends PureComponent {
backend.once('client:started', this.handleStarted);

this.subscriptions = [
backend.on('menu:action', this.triggerAction),
backend.on('menu:action', (_, action, options) => this.triggerAction(action, options)),
backend.on('client:open-files', this.handleOpenFiles),
backend.on('client:window-focused', this.handleFocus),
backend.on('backend:error', this.handleBackendError)
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/KeyboardBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default class KeyboardBindings {
}

if (action && onAction) {
onAction(null, action);
onAction(action, event);

event.preventDefault();
}
Expand All @@ -167,7 +167,7 @@ export default class KeyboardBindings {
var { key } = event;

if (action && onAction && !this.pressedKeys[ key ]) {
onAction(null, action);
onAction(action, event);

this.pressedKeys[ key ] = true;

Expand All @@ -186,7 +186,7 @@ export default class KeyboardBindings {
}

if (action && onAction) {
onAction(null, action);
onAction(action, event);

event.preventDefault();
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/__tests__/AppParentSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe('<AppParent>', function() {
const quitAllowedSpy = spy(backend, 'sendQuitAllowed');

// when
await appParent.triggerAction({}, 'quit');
await appParent.triggerAction('quit');

// then
expect(closeAllTabsSpy).to.be.calledWith('close-all-tabs');
Expand All @@ -271,7 +271,7 @@ describe('<AppParent>', function() {
const quitAbortedSpy = spy(backend, 'sendQuitAborted');

// when
await appParent.triggerAction({}, 'quit');
await appParent.triggerAction('quit');

// then
expect(closeTabsStub).to.be.calledOnce;
Expand Down
28 changes: 14 additions & 14 deletions client/src/app/__tests__/KeyboardBindingsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('KeyboardBindings', function() {
// then
expect(actionSpy).to.have.been.calledTwice;

expect(actionSpy.alwaysCalledWith(null, 'foo')).to.be.true;
expect(actionSpy.alwaysCalledWith('foo', event)).to.be.true;
});


Expand Down Expand Up @@ -89,7 +89,7 @@ describe('KeyboardBindings', function() {
// then
expect(actionSpy).to.have.been.calledTwice;

expect(actionSpy.alwaysCalledWith(null, 'foo')).to.be.true;
expect(actionSpy.alwaysCalledWith('foo', event)).to.be.true;
});


Expand All @@ -113,7 +113,7 @@ describe('KeyboardBindings', function() {
// then
expect(actionSpy).to.have.been.calledTwice;

expect(actionSpy.alwaysCalledWith(null, 'foo')).to.be.true;
expect(actionSpy.alwaysCalledWith('foo', event)).to.be.true;
});

});
Expand All @@ -133,7 +133,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'copy');
expect(actionSpy).to.have.been.calledWith('copy', event);
});


Expand All @@ -151,7 +151,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'cut');
expect(actionSpy).to.have.been.calledWith('cut', event);
});


Expand All @@ -169,7 +169,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'paste');
expect(actionSpy).to.have.been.calledWith('paste', event);
});


Expand All @@ -187,7 +187,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'undo');
expect(actionSpy).to.have.been.calledWith('undo', event);
});


Expand All @@ -207,7 +207,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'redo');
expect(actionSpy).to.have.been.calledWith('redo', event);
});


Expand All @@ -225,7 +225,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'redo');
expect(actionSpy).to.have.been.calledWith('redo', event);
});

});
Expand All @@ -245,7 +245,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'selectAll');
expect(actionSpy).to.have.been.calledWith('selectAll', event);
});


Expand Down Expand Up @@ -315,7 +315,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'removeSelection');
expect(actionSpy).to.have.been.calledWith('removeSelection', event);
});


Expand All @@ -338,7 +338,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'removeSelection');
expect(actionSpy).to.have.been.calledWith('removeSelection', event);
});
});

Expand All @@ -359,7 +359,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

// then
expect(actionSpy).to.have.been.calledWith(null, 'replaceElement');
expect(actionSpy).to.have.been.calledWith('replaceElement', event);

});

Expand Down Expand Up @@ -404,7 +404,7 @@ describe('KeyboardBindings', function() {
keyboardBindings._keyDownHandler(event);

expect(actionSpy).not.to.have.been.called;
expect(newActionSpy).to.have.been.calledWith(null, 'selectAll');
expect(newActionSpy).to.have.been.calledWith('selectAll', event);
});


Expand Down

0 comments on commit 7a9b656

Please sign in to comment.