Skip to content

Commit

Permalink
feat(client/App): trigger tab resize when layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac authored and merge-me[bot] committed Feb 22, 2019
1 parent a219288 commit 8592eb4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions client/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,9 @@ export class App extends PureComponent {
this.updateMenu(tabState);
}

if (layout !== prevState.layout) {
this.triggerAction('resize');
}
}

componentDidCatch(error, info) {
Expand Down
29 changes: 27 additions & 2 deletions client/src/app/__tests__/AppSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2194,12 +2194,12 @@ describe('<App>', function() {
});


describe('window resize', function() {
describe('resize', function() {

afterEach(sinon.restore);


it('should notify tab about window resize', async function() {
it('should trigger tab resize when window is resized', async function() {
// given
const {
app,
Expand All @@ -2218,6 +2218,31 @@ describe('<App>', function() {
tree.unmount();
});


it('should trigger tab resize when layout changes', async function() {
// given
const {
app,
tree
} = createApp({}, mount);

const resizeTabStub = sinon.stub(app, 'resizeTab').resolves();

// when
app.setLayout({
log: {
open: true,
height: 100
}
});

// then
expect(resizeTabStub).to.be.calledOnce;

// clean
tree.unmount();
});

});


Expand Down

0 comments on commit 8592eb4

Please sign in to comment.